@@ -167,9 +167,7 @@ def stru_ele(supercell_stru, stru_out, eles, natoms, jdata, path_work):
167
167
os .path .join (path_work , orb_file_names [ipp ]),
168
168
)
169
169
if "dpks_descriptor" in jdata :
170
- os .symlink (
171
- absolute_dpks_descriptor_path , os .path .join (path_work , dpks_descriptor_name )
172
- )
170
+ os .symlink (absolute_dpks_descriptor_path , os .path .join (path_work , dpks_descriptor_name ))
173
171
174
172
175
173
def poscar_natoms (lines ):
@@ -255,9 +253,7 @@ def poscar_scale_abacus(poscar_in, poscar_out, scale, jdata):
255
253
orb_file_names = [os .path .basename (a ) for a in jdata ["orb_files" ]]
256
254
if "dpks_descriptor" in jdata :
257
255
dpks_descriptor_name = os .path .basename (jdata ["dpks_descriptor" ])
258
- ret = make_abacus_scf_stru (
259
- stru , pp_files , orb_file_names , dpks_descriptor_name , type_map = jdata ["elements" ]
260
- )
256
+ ret = make_abacus_scf_stru (stru , pp_files , orb_file_names , dpks_descriptor_name , type_map = jdata ["elements" ])
261
257
# ret = make_abacus_scf_stru(stru, pp_files)
262
258
with open (poscar_out , "w" ) as fp :
263
259
fp .write (ret )
@@ -572,9 +568,7 @@ def make_vasp_relax(jdata, mdata):
572
568
573
569
def make_abacus_relax (jdata , mdata ):
574
570
relax_incar = jdata ["relax_incar" ]
575
- standard_incar = get_abacus_input_parameters (
576
- relax_incar
577
- ) # a dictionary in which all of the values are strings
571
+ standard_incar = get_abacus_input_parameters (relax_incar ) # a dictionary in which all of the values are strings
578
572
if "kspacing" not in standard_incar :
579
573
if "gamma_only" in standard_incar :
580
574
if isinstance (standard_incar ["gamma_only" ], str ):
@@ -584,9 +578,7 @@ def make_abacus_relax(jdata, mdata):
584
578
raise RuntimeError ("Cannot find any k-points information." )
585
579
else :
586
580
relax_kpt_path = jdata ["relax_kpt" ]
587
- assert os .path .isfile (
588
- relax_kpt_path
589
- ), f"file { relax_kpt_path } should exists"
581
+ assert os .path .isfile (relax_kpt_path ), f"file { relax_kpt_path } should exists"
590
582
else :
591
583
gamma_param = {"k_points" : [1 , 1 , 1 , 0 , 0 , 0 ]}
592
584
ret_kpt = make_abacus_scf_kpt (gamma_param )
@@ -595,9 +587,7 @@ def make_abacus_relax(jdata, mdata):
595
587
raise RuntimeError ("Cannot find any k-points information." )
596
588
else :
597
589
relax_kpt_path = jdata ["relax_kpt" ]
598
- assert os .path .isfile (
599
- relax_kpt_path
600
- ), f"file { relax_kpt_path } should exists"
590
+ assert os .path .isfile (relax_kpt_path ), f"file { relax_kpt_path } should exists"
601
591
602
592
out_dir = jdata ["out_dir" ]
603
593
cwd = os .getcwd ()
@@ -675,9 +665,7 @@ def make_scale(jdata):
675
665
else :
676
666
pos_src = os .path .join (os .path .join (init_path , ii ), "CONTCAR" )
677
667
if not os .path .isfile (pos_src ):
678
- raise RuntimeError (
679
- f"file { pos_src } not found, vasp relaxation should be run before scale poscar"
680
- )
668
+ raise RuntimeError (f"file { pos_src } not found, vasp relaxation should be run before scale poscar" )
681
669
scale_path = os .path .join (work_path , ii )
682
670
scale_path = os .path .join (scale_path , f"scale-{ jj :.3f} " )
683
671
create_path (scale_path )
@@ -763,13 +751,8 @@ def pert_scaled(jdata):
763
751
fp_style = "abacus"
764
752
poscar_name = "STRU"
765
753
766
- python_exec = os .path .join (
767
- os .path .dirname (__file__ ), "tools" , "create_random_disturb.py"
768
- )
769
- pert_cmd = (
770
- sys .executable
771
- + f" { python_exec } -etmax { pert_box } -ofmt { fp_style } { poscar_name } { pert_numb } { pert_atom } > /dev/null"
772
- )
754
+ python_exec = os .path .join (os .path .dirname (__file__ ), "tools" , "create_random_disturb.py" )
755
+ pert_cmd = f"{ sys .executable } { python_exec } -etmax { pert_box } -ofmt { fp_style } { poscar_name } { pert_numb } { pert_atom } > /dev/null"
773
756
774
757
### Loop over each system and scale
775
758
for ii in sys_pe :
@@ -917,9 +900,7 @@ def make_vasp_md(jdata, mdata):
917
900
918
901
def make_abacus_md (jdata , mdata ):
919
902
md_incar = jdata ["md_incar" ]
920
- standard_incar = get_abacus_input_parameters (
921
- md_incar
922
- ) # a dictionary in which all of the values are strings
903
+ standard_incar = get_abacus_input_parameters (md_incar ) # a dictionary in which all of the values are strings
923
904
# assert("md_kpt" in jdata or "kspacing" in standard_incar or "gamma_only" in standard_incar) \
924
905
# "Cannot find any k-points information."
925
906
if "kspacing" not in standard_incar :
@@ -931,9 +912,7 @@ def make_abacus_md(jdata, mdata):
931
912
raise RuntimeError ("Cannot find any k-points information." )
932
913
else :
933
914
md_kpt_path = jdata ["md_kpt" ]
934
- assert os .path .isfile (
935
- md_kpt_path
936
- ), f"file { md_kpt_path } should exists"
915
+ assert os .path .isfile (md_kpt_path ), f"file { md_kpt_path } should exists"
937
916
else :
938
917
ret_kpt = make_abacus_scf_kpt ({"k_points" : [1 , 1 , 1 , 0 , 0 , 0 ]})
939
918
else :
@@ -981,9 +960,7 @@ def make_abacus_md(jdata, mdata):
981
960
if "dpks_descriptor" in jdata :
982
961
dpks_descriptor_name = os .path .basename (jdata ["dpks_descriptor" ])
983
962
dpks_descriptor_abspath = os .path .abspath (jdata ["dpks_descriptor" ])
984
- shutil .copy2 (
985
- dpks_descriptor_abspath , os .path .join (path_md , dpks_descriptor_name )
986
- )
963
+ shutil .copy2 (dpks_descriptor_abspath , os .path .join (path_md , dpks_descriptor_name ))
987
964
if "dpks_model" in jdata :
988
965
dpks_model_name = os .path .basename (jdata ["dpks_model" ])
989
966
dpks_model_abspath = os .path .abspath (jdata ["dpks_model" ])
@@ -1019,9 +996,7 @@ def make_abacus_md(jdata, mdata):
1019
996
pass
1020
997
try :
1021
998
for pp_file in [os .path .basename (a ) for a in jdata ["potcars" ]]:
1022
- os .symlink (
1023
- os .path .relpath (os .path .join (path_md , pp_file )), pp_file
1024
- )
999
+ os .symlink (os .path .relpath (os .path .join (path_md , pp_file )), pp_file )
1025
1000
if "orb_files" in jdata :
1026
1001
for orb_file in orb_file_names :
1027
1002
os .symlink (
@@ -1035,9 +1010,7 @@ def make_abacus_md(jdata, mdata):
1035
1010
)
1036
1011
if "dpks_descriptor" in jdata :
1037
1012
os .symlink (
1038
- os .path .relpath (
1039
- os .path .join (path_md , dpks_descriptor_name )
1040
- ),
1013
+ os .path .relpath (os .path .join (path_md , dpks_descriptor_name )),
1041
1014
dpks_descriptor_name ,
1042
1015
)
1043
1016
except FileExistsError :
@@ -1222,9 +1195,7 @@ def coll_abacus_md(jdata):
1222
1195
)
1223
1196
)
1224
1197
else :
1225
- dlog .info (
1226
- f"WARNING : in directory { os .getcwd ()} NO running_md.log file found."
1227
- )
1198
+ dlog .info (f"WARNING : in directory { os .getcwd ()} NO running_md.log file found." )
1228
1199
arg_cvt = " "
1229
1200
if len (valid_outcars ) == 0 :
1230
1201
raise RuntimeError (
@@ -1276,9 +1247,7 @@ def run_abacus_relax(jdata, mdata):
1276
1247
if "dpks_model" in jdata :
1277
1248
dpks_model_name = [os .path .basename (jdata ["dpks_model" ])]
1278
1249
relax_incar = jdata ["relax_incar" ]
1279
- standard_incar = get_abacus_input_parameters (
1280
- relax_incar
1281
- ) # a dictionary in which all of the values are strings
1250
+ standard_incar = get_abacus_input_parameters (relax_incar ) # a dictionary in which all of the values are strings
1282
1251
forward_files = ["STRU" , "INPUT" ]
1283
1252
if "kspacing" not in standard_incar :
1284
1253
forward_files = ["STRU" , "INPUT" , "KPT" ]
@@ -1398,9 +1367,7 @@ def run_abacus_md(jdata, mdata):
1398
1367
if "dpks_model" in jdata :
1399
1368
dpks_model_name = [os .path .basename (jdata ["dpks_model" ])]
1400
1369
md_incar = jdata ["md_incar" ]
1401
- standard_incar = get_abacus_input_parameters (
1402
- md_incar
1403
- ) # a dictionary in which all of the values are strings
1370
+ standard_incar = get_abacus_input_parameters (md_incar ) # a dictionary in which all of the values are strings
1404
1371
forward_files = ["STRU" , "INPUT" ]
1405
1372
if "kspacing" not in standard_incar :
1406
1373
forward_files = ["STRU" , "INPUT" , "KPT" ]
@@ -1492,9 +1459,7 @@ def gen_init_bulk(args):
1492
1459
nsw_steps = int (standard_incar ["md_nstep" ])
1493
1460
if nsw_flag :
1494
1461
if nsw_steps != md_nstep_jdata :
1495
- dlog .info (
1496
- "WARNING: your set-up for MD steps in PARAM and md_incar are not consistent!"
1497
- )
1462
+ dlog .info ("WARNING: your set-up for MD steps in PARAM and md_incar are not consistent!" )
1498
1463
dlog .info ("MD steps in PARAM is %d" % (md_nstep_jdata ))
1499
1464
dlog .info ("MD steps in md_incar is %d" % (nsw_steps ))
1500
1465
dlog .info ("DP-GEN will use settings in md_incar!" )
@@ -1575,9 +1540,7 @@ def gen_init_bulk(args):
1575
1540
1576
1541
1577
1542
if __name__ == "__main__" :
1578
- parser = argparse .ArgumentParser (
1579
- description = "Generating initial data for bulk systems."
1580
- )
1543
+ parser = argparse .ArgumentParser (description = "Generating initial data for bulk systems." )
1581
1544
parser .add_argument ("PARAM" , type = str , help = "parameter file, json/yaml format" )
1582
1545
parser .add_argument (
1583
1546
"MACHINE" ,
0 commit comments