dft_managers.vasp_manager
Contains the handling of the VASP process. It can start VASP, reactivate it, check if the lock file is there and finally kill VASP. Needed for CSC calculations.
This functionality is contained in the simpler public functions.
- dft_managers.vasp_manager._fork_and_start_vasp(mpi_exe, arguments, env_vars)[source]
Forks a process from the master process that then calls mpi to start vasp. The child process running VASP never leaves this function whereas the main process returns the child’s process id and continues. We use explicitly os.fork as os.execve here because subprocess does not return, and as VASP needs to keep running throughout the whole DFT+DMFT calculation that is not a viable solution here.
- Parameters:
- mpi_exe: string, mpi command
- arguments: list of string, arguments to start mpi with
- env_vars: dict of string, environment variables containing PATH
- Returns:
- int: id of the VASP child process
- dft_managers.vasp_manager._is_lock_file_present()[source]
Checks if the lock file ‘vasp.lock’ is there, i.e. if VASP is still working.
- dft_managers.vasp_manager.kill(vasp_process_id)[source]
Kills the VASP process and aborts, after an error. Use stop() for a regular end.
- dft_managers.vasp_manager.read_dft_energy()[source]
Reads DFT energy from the last line of Vasp’s OSZICAR or from vasptriqs.h5
- dft_managers.vasp_manager.read_dft_iter()[source]
Reads DFT iteration number from the last line of the OSZICAR or from Vasp’s vasptriqs.h5
- dft_managers.vasp_manager.read_irred_kpoints(kpts)[source]
Reads the indices of the irreducible k-points from the OUTCAR.
- dft_managers.vasp_manager.remove_legacy_projections_suppressed()[source]
Removes legacy file vasp.suppress_projs if present.
- dft_managers.vasp_manager.run_charge_update()[source]
Performs one step of the charge update with VASP by creating the vasp.lock file and then waiting until it gets delete by VASP when it has finished.
- dft_managers.vasp_manager.run_initial_scf(number_cores, vasp_command, mpi_exe_param, cluster_name)[source]
Starts the VASP child process. Takes care of initializing a clean environment for the child process. This is needed so that VASP does not get confused with all the standard slurm environment variables. Returns when VASP has completed its initial scf cycle.
- Parameters:
- number_cores: int, the number of cores that vasp runs on
- vasp_command: string, the command to start vasp
- cluster_name: string, name of the cluster so that settings can be tailored to it
- dft_managers.vasp_manager.stop(vasp_process_id, timeout=600)[source]
Stops the VASP process at the end of a calculation such that VASP writes its final output.
VASP only writes CHGCAR and WAVECAR when it leaves its electronic loop regularly. In the CSC loop it waits for vasp.lock before every charge update, so it is released once more after the STOPCAR is written: VASP then performs one last update, reads LABORT and exits. The CHGCAR holds the DFT+DMFT charge density, which is needed to restart or to compute bands with ICHARG = 11. Falls back to SIGTERM if VASP does not exit within the timeout (in s).
Returns True if VASP exited by itself.