@@ -99,7 +99,7 @@ def remove_legacy_projections_suppressed():
9999 mpi .barrier ()
100100
101101
102- def run_initial_scf (number_cores , vasp_command , cluster_name ):
102+ def run_initial_scf (number_cores , vasp_command , mpi_exe_param , cluster_name ):
103103 """
104104 Starts the VASP child process. Takes care of initializing a clean
105105 environment for the child process. This is needed so that VASP does not
@@ -133,7 +133,8 @@ def run_initial_scf(number_cores, vasp_command, cluster_name):
133133 env_vars [var_name ] = var
134134
135135 # assuming that mpirun points to the correct mpi env
136- mpi_exe = mpi_helpers .find_path_to_mpi_command (env_vars , 'mpirun' )
136+ mpi_exe = mpi_helpers .find_path_to_mpi_command (env_vars , mpi_exe_param )
137+ print ('\n MPI executable for Vasp:' , mpi_exe )
137138
138139 arguments = mpi_helpers .get_mpi_arguments (cluster_name , mpi_exe , number_cores , vasp_command , hostfile )
139140 vasp_process_id = _fork_and_start_vasp (mpi_exe , arguments , env_vars )
@@ -171,17 +172,44 @@ def run_charge_update():
171172
172173def read_dft_energy ():
173174 """
174- Reads DFT energy from the last line of Vasp's OSZICAR.
175+ Reads DFT energy from the last line of Vasp's OSZICAR or from vasptriqs.h5
175176 """
176- with open ('OSZICAR' , 'r' ) as file :
177- nextline = file .readline ()
178- while nextline .strip ():
179- line = nextline
177+ h5_energy = False
178+ if os .path .isfile ('vaspout.h5' ):
179+ with HDFArchive ('vaspout.h5' , 'r' ) as h5 :
180+ if 'oszicar' in h5 ['intermediate/ion_dynamics' ]:
181+ dft_energy = h5 ['intermediate/ion_dynamics/oszicar' ][- 1 ,1 ]
182+ h5_energy = True
183+
184+ # as backup use OSZICAR file
185+ if not h5_energy :
186+ with open ('OSZICAR' , 'r' ) as file :
180187 nextline = file .readline ()
181188 dft_energy = float (line .split ()[2 ])
182189
183190 return dft_energy
184191
192+ def read_dft_iter ():
193+ """
194+ Reads DFT iteration number from the last line of the OSZICAR or from Vasp's vasptriqs.h5
195+ """
196+ h5_iter = False
197+ if os .path .isfile ('vaspout.h5' ):
198+ with HDFArchive ('vaspout.h5' , 'r' ) as h5 :
199+ if 'oszicar' in h5 ['intermediate/ion_dynamics' ]:
200+ dft_iter = int (h5 ['intermediate/ion_dynamics/oszicar' ][- 1 ,0 ])
201+ h5_iter = True
202+
203+ # as backup use OSZICAR file
204+ if not h5_iter :
205+ with open ('OSZICAR' , 'r' ) as file :
206+ nextline = file .readline ()
207+ while nextline .strip ():
208+ line = nextline
209+ nextline = file .readline ()
210+ dft_iter = int (line .split ()[1 ])
211+
212+ return dft_iter
185213
186214def read_irred_kpoints (kpts ):
187215 """ Reads the indices of the irreducible k-points from the OUTCAR. """
0 commit comments