|
68 | 68 | make_abacus_scf_input, |
69 | 69 | make_abacus_scf_kpt, |
70 | 70 | ) |
71 | | -from dpgen.generator.lib.abacus_scf import get_abacus_input_parameters |
| 71 | +from dpgen.generator.lib.abacus_scf import get_abacus_input_parameters, get_abacus_STRU |
72 | 72 |
|
73 | 73 | # from dpgen.generator.lib.pwscf import cvt_1frame |
74 | 74 | from dpgen.generator.lib.pwmat import make_pwmat_input_dict |
@@ -3000,41 +3000,65 @@ def sys_link_fp_vasp_pp(iter_index, jdata): |
3000 | 3000 | os.chdir(cwd) |
3001 | 3001 |
|
3002 | 3002 |
|
3003 | | -def _link_fp_abacus_orb_descript(iter_index, jdata): |
3004 | | - # assume lcao orbital files, numerical descrptors and model for dpks are all in fp_pp_path. |
3005 | | - fp_pp_path = jdata["fp_pp_path"] |
3006 | | - |
3007 | | - fp_orb_files = jdata["fp_orb_files"] |
3008 | | - assert os.path.exists(fp_pp_path) |
3009 | | - fp_dpks_descriptor = None |
3010 | | - fp_dpks_model = None |
3011 | | - if "fp_dpks_descriptor" in jdata: |
3012 | | - fp_dpks_descriptor = jdata["fp_dpks_descriptor"] |
3013 | | - if "user_fp_params" in jdata: |
3014 | | - if "deepks_model" in jdata["user_fp_params"]: |
3015 | | - fp_dpks_model = jdata["user_fp_params"]["deepks_model"] |
3016 | | - |
3017 | | - fp_pp_path = os.path.abspath(fp_pp_path) |
| 3003 | +def _link_fp_abacus_pporb_descript(iter_index, jdata): |
| 3004 | + # assume pp orbital files, numerical descrptors and model for dpks are all in fp_pp_path. |
| 3005 | + fp_pp_path = os.path.abspath(jdata["fp_pp_path"]) |
3018 | 3006 |
|
3019 | 3007 | iter_name = make_iter_name(iter_index) |
3020 | 3008 | work_path = os.path.join(iter_name, fp_name) |
3021 | | - |
3022 | 3009 | fp_tasks = glob.glob(os.path.join(work_path, "task.*")) |
3023 | 3010 | fp_tasks.sort() |
3024 | 3011 | if len(fp_tasks) == 0: |
3025 | 3012 | return |
| 3013 | + |
3026 | 3014 | cwd = os.getcwd() |
3027 | 3015 | for ii in fp_tasks: |
3028 | 3016 | os.chdir(ii) |
3029 | | - for jj in fp_orb_files: |
3030 | | - orb_file = os.path.join(fp_pp_path, jj) |
3031 | | - os.symlink(orb_file, jj) |
3032 | | - if fp_dpks_descriptor is not None: |
3033 | | - descrptor = os.path.join(fp_pp_path, fp_dpks_descriptor) |
3034 | | - os.symlink(descrptor, fp_dpks_descriptor) |
3035 | | - if fp_dpks_model is not None: |
3036 | | - dpks_model = os.path.join(fp_pp_path, fp_dpks_model) |
3037 | | - os.symlink(dpks_model, fp_dpks_model) |
| 3017 | + |
| 3018 | + # get value of 'deepks_model' from INPUT |
| 3019 | + input_param = get_abacus_input_parameters("INPUT") |
| 3020 | + fp_dpks_model = input_param.get("deepks_model", None) |
| 3021 | + if fp_dpks_model != None: |
| 3022 | + model_file = os.path.join(fp_pp_path, fp_dpks_model) |
| 3023 | + assert os.path.isfile(model_file), ( |
| 3024 | + "Can not find the deepks model file %s, which is defined in %s/INPUT" |
| 3025 | + % (model_file, ii) |
| 3026 | + ) |
| 3027 | + os.symlink(model_file, fp_dpks_model) |
| 3028 | + |
| 3029 | + # get pp, orb, descriptor filenames from STRU |
| 3030 | + stru_param = get_abacus_STRU("STRU") |
| 3031 | + pp_files = stru_param.get("pp_files", []) |
| 3032 | + orb_files = stru_param.get("orb_files", []) |
| 3033 | + descriptor_file = stru_param.get("dpks_descriptor", None) |
| 3034 | + pp_files = [] if pp_files == None else pp_files |
| 3035 | + orb_files = [] if orb_files == None else orb_files |
| 3036 | + |
| 3037 | + for jj in pp_files: |
| 3038 | + ifile = os.path.join(fp_pp_path, jj) |
| 3039 | + assert os.path.isfile(ifile), ( |
| 3040 | + "Can not find the pseudopotential file %s, which is defined in %s/STRU" |
| 3041 | + % (ifile, ii) |
| 3042 | + ) |
| 3043 | + os.symlink(ifile, jj) |
| 3044 | + |
| 3045 | + for jj in orb_files: |
| 3046 | + ifile = os.path.join(fp_pp_path, jj) |
| 3047 | + assert os.path.isfile( |
| 3048 | + ifile |
| 3049 | + ), "Can not find the orbital file %s, which is defined in %s/STRU" % ( |
| 3050 | + ifile, |
| 3051 | + ii, |
| 3052 | + ) |
| 3053 | + os.symlink(ifile, jj) |
| 3054 | + |
| 3055 | + if descriptor_file != None: |
| 3056 | + ifile = os.path.join(fp_pp_path, descriptor_file) |
| 3057 | + assert os.path.isfile(ifile), ( |
| 3058 | + "Can not find the deepks descriptor file %s, which is defined in %s/STRU" |
| 3059 | + % (ifile, ii) |
| 3060 | + ) |
| 3061 | + os.symlink(ifile, descriptor_file) |
3038 | 3062 | os.chdir(cwd) |
3039 | 3063 |
|
3040 | 3064 |
|
@@ -3248,11 +3272,8 @@ def make_fp_abacus_scf(iter_index, jdata): |
3248 | 3272 | fp.write(ret_stru) |
3249 | 3273 |
|
3250 | 3274 | os.chdir(cwd) |
3251 | | - # link pp files |
3252 | | - _link_fp_vasp_pp(iter_index, jdata) |
3253 | | - if "basis_type" in fp_params: |
3254 | | - if fp_params["basis_type"] == "lcao": |
3255 | | - _link_fp_abacus_orb_descript(iter_index, jdata) |
| 3275 | + # link pp and orbital files |
| 3276 | + _link_fp_abacus_pporb_descript(iter_index, jdata) |
3256 | 3277 |
|
3257 | 3278 |
|
3258 | 3279 | def make_fp_siesta(iter_index, jdata): |
|
0 commit comments