File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1281,6 +1281,22 @@ def incar(self) -> Incar:
1281
1281
incar [p ] = self .prev_incar [p ]
1282
1282
return incar
1283
1283
1284
+ @classmethod
1285
+ def from_prev_calc (cls , prev_calc_dir , ** kwargs ):
1286
+ """
1287
+ Generate a set of VASP input files for static calculations from a directory of previous VASP run.
1288
+
1289
+ Args:
1290
+ prev_calc_dir (str): Directory containing the outputs(
1291
+ vasprun.xml and OUTCAR) of previous vasp run.
1292
+ **kwargs: All kwargs supported by MatPESStaticSet, other than prev_incar
1293
+ and prev_structure and prev_kpoints which are determined from
1294
+ the prev_calc_dir.
1295
+ """
1296
+ vrun = sorted (f for f in os .listdir (prev_calc_dir ) if f .startswith ("vasprun.xml" ))[- 1 ]
1297
+ v = Vasprun (os .path .join (prev_calc_dir , vrun ))
1298
+ return cls (v .final_structure , prev_incar = v .incar , ** kwargs )
1299
+
1284
1300
1285
1301
class MPScanStaticSet (MPScanRelaxSet ):
1286
1302
"""
Original file line number Diff line number Diff line change @@ -847,6 +847,15 @@ def test_functionals(self):
847
847
diff_potcar = MatPESStaticSet (self .struct , user_potcar_functional = "PBE" )
848
848
assert str (diff_potcar .potcar [0 ]) == str (PotcarSingle .from_symbol_and_functional ("Fe_pv" , "PBE" ))
849
849
850
+ def test_from_prev_calc (self ):
851
+ vis = MatPESStaticSet .from_prev_calc (f"{ TEST_FILES_DIR } /relaxation" )
852
+ incar = vis .incar
853
+ assert incar ["GGA" ] == "Pe"
854
+ assert incar ["ALGO" ] == "Normal"
855
+ assert vis .potcar_symbols == ["Li_sv" ]
856
+ assert vis .potcar .functional == "PBE_54"
857
+ assert vis .kpoints is None
858
+
850
859
851
860
class TestMPNonSCFSet (PymatgenTest ):
852
861
def setUp (self ):
You can’t perform that action at this time.
0 commit comments