Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in run_abacus_md and delete redundant line about gamma_only. #850

Merged
merged 4 commits into from
Aug 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ If you want to specify a structure as starting point for `init_bulk`, you may se
```
`init_bulk` support both VASP and ABACUS for first-principle calculation. You can choose the software by specifying the key `init_fp_style`. If `init_fp_style` is not specified, the default software will be VASP.

When using ABACUS for `init_fp_style`, the keys of the paths of `INPUT` files for relaxation and MD simulations are the same as `INCAR` for VASP, which are `relax_incar` and `md_incar` respectively. Use `relax_kpt` and `md_kpt` for the relative path for `KPT` files of relaxation and MD simulations. They two can be ommited if `kspacing` or `gamma_only` has been set in corresponding INPUT files. If `from_poscar` is set to `false`, you have to specify `atom_masses` in the same order as `elements`.
When using ABACUS for `init_fp_style`, the keys of the paths of `INPUT` files for relaxation and MD simulations are the same as `INCAR` for VASP, which are `relax_incar` and `md_incar` respectively. Use `relax_kpt` and `md_kpt` for the relative path for `KPT` files of relaxation and MD simulations. They two can be ommited if `kspacing` (in unit of 1/Bohr) or `gamma_only` has been set in corresponding INPUT files. If `from_poscar` is set to `false`, you have to specify `atom_masses` in the same order as `elements`.

The following table gives explicit descriptions on keys in `PARAM`.

Expand All @@ -173,9 +173,7 @@ The bold notation of key (such as **Elements**) means that it's a necessary key.
| type_map | List | [ "Mg", "Al"] | The indices of elements in deepmd formats will be set in this order.
| init_fp_style | String | "ABACUS" or "VASP" | First-principle software. If this key is abscent, the default value will be "VASP".
| relax_kpt | String | "....../KPT" | Path of `KPT` file for relaxation in stage 1. Only useful if `init_fp_style` is "ABACUS".
| relax_kspacing | Integer or List of 3 integers | 10 | kspacing parameter for relaxation in stage 1. Only useful if `init_fp_style` is "ABACUS".
| md_kpt | String | "....../KPT" | Path of `KPT` file for MD simulations in stage 3. Only useful if `init_fp_style` is "ABACUS".
| md_kspacing | Integer or List of 3 integers | 10 | kspacing parameter for MD simulations in stage 3. Only useful if `init_fp_style` is "ABACUS".
| atom_masses | List of float | [24] | List of atomic masses of elements. The order should be the same as `Elements`. Only useful if `init_fp_style` is "ABACUS".

### Init_surf
Expand Down Expand Up @@ -572,7 +570,7 @@ The bold notation of key (such aas **type_map**) means that it's a necessary key
| **user_fp_params** | Dict | |Parameters for ABACUS INPUT. find detail [Here](https://github.com/deepmodeling/abacus-develop/blob/develop/docs/input-main.md#out-descriptor). If `deepks_model` is set, the model file should be in the pseudopotential directory. You can also set `KPT` file by adding `k_points` that corresponds to a list of six integers in this dictionary. Any key beginning with "_" will be ignored.
| **fp_incar** | String | "./abacus/INPUT" | INPUT file for ABACUS. This is another way of providing input parameters. Users must choose one of these two ways. Any keywords beginning with "_" will be ignored
| **k_points** | List of integers | [2,2,2,0,0,0] | Monkhorst-Pack k-grids setting for generating KPT file of ABACUS
| **fp_kpt_file** | String | "./abacus/KPT" | KPT file for ABACUS. This is another way to provide KPT file for ABACUS and has lower priority than the above `k_points` key. They two have lower priority than kspacing and gamma_only in INPUT file of ABACUS.
| **fp_kpt_file** | String | "./abacus/KPT" | KPT file for ABACUS. This is another way to provide KPT file for ABACUS and has lower priority than the above `k_points` key. They two have lower priority than kspacing (in unit of 1/Bohr) and gamma_only in INPUT file of ABACUS.
| **fp_orb_files** | List | |List of atomic orbital files. The files should be in pseudopotential directory.
| **fp_dpks_descriptor** | String | |DeePKS descriptor file name. The file should be in pseudopotential directory.

Expand Down
21 changes: 7 additions & 14 deletions dpgen/data/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,11 +1159,6 @@ def coll_abacus_md(jdata) :
os.chdir(cwd)

def run_abacus_relax(jdata, mdata):
relax_incar = jdata['relax_incar']
standard_incar = get_abacus_input_parameters(relax_incar) # a dictionary in which all of the values are strings
if "gamma_only" in standard_incar:
if type(standard_incar["gamma_only"])==str:
standard_incar["gamma_only"] = int(eval(standard_incar["gamma_only"]))
fp_command = mdata['fp_command']
fp_group_size = mdata['fp_group_size']
fp_resources = mdata['fp_resources']
Expand All @@ -1179,6 +1174,8 @@ def run_abacus_relax(jdata, mdata):
dpks_descriptor_name = [os.path.basename(jdata['dpks_descriptor'])]
if 'dpks_model' in jdata:
dpks_model_name = [os.path.basename(jdata['dpks_model'])]
relax_incar = jdata['relax_incar']
standard_incar = get_abacus_input_parameters(relax_incar) # a dictionary in which all of the values are strings
forward_files = ["STRU", "INPUT"]
if "kspacing" not in standard_incar:
forward_files = ["STRU", "INPUT", "KPT"]
Expand Down Expand Up @@ -1298,11 +1295,6 @@ def run_vasp_md(jdata, mdata):
submission.run_submission()

def run_abacus_md(jdata, mdata):
md_incar = jdata['md_incar']
standard_incar = get_abacus_input_parameters(md_incar) # a dictionary in which all of the values are strings
if "gamma_only" in standard_incar:
if type(standard_incar["gamma_only"])==str:
standard_incar["gamma_only"] = int(eval(standard_incar["gamma_only"]))
fp_command = mdata['fp_command']
fp_group_size = mdata['fp_group_size']
fp_resources = mdata['fp_resources']
Expand All @@ -1321,9 +1313,10 @@ def run_abacus_md(jdata, mdata):
dpks_descriptor_name = [os.path.basename(jdata['dpks_descriptor'])]
if 'dpks_model' in jdata:
dpks_model_name = [os.path.basename(jdata['dpks_model'])]
md_incar = jdata['md_incar']
standard_incar = get_abacus_input_parameters(md_incar) # a dictionary in which all of the values are strings
forward_files = ["STRU", "INPUT"]
if not (("kspacing" in standard_incar) or \
("gamma_only" in standard_incar and standard_incar["gamma_only"]==1)):
if "kspacing" not in standard_incar:
forward_files = ["STRU", "INPUT", "KPT"]
forward_files += orb_file_names + dpks_descriptor_name + dpks_model_name
for pp_file in [os.path.basename(a) for a in jdata['potcars']]:
Expand Down Expand Up @@ -1427,9 +1420,9 @@ def gen_init_bulk(args) :
elif jdata['init_fp_style'] == "ABACUS":
standard_incar = get_abacus_input_parameters(md_incar) # a dictionary in which all of the values are strings
nsw_flag = False
if "nstep" in standard_incar:
if "md_nstep" in standard_incar:
nsw_flag = True
nsw_steps = int(standard_incar['nstep'])
nsw_steps = int(standard_incar['md_nstep'])
if nsw_flag:
if (nsw_steps != md_nstep_jdata):
dlog.info("WARNING: your set-up for MD steps in PARAM and md_incar are not consistent!")
Expand Down
2 changes: 1 addition & 1 deletion dpgen/generator/lib/abacus_scf.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def make_abacus_scf_input(fp_params):
assert(fp_params["ks_solver"] in ["cg", "dav", "lapack", "genelpa", "hpseps", "scalapack_gvx"]), "'ks_sover' should in 'cgx', 'dav', 'lapack', 'genelpa', 'hpseps', 'scalapack_gvx'."
ret += "ks_solver %s\n" % fp_params["ks_solver"]
elif key == "smearing_method":
assert(fp_params["smearing_method"] in ["gaussian", "fd", "fixed", "mp", "mp2", "mv"]), "'smearing_method' should in 'gaussian', 'fd', 'fixed', 'mp', 'mp2', 'mv'. "
assert(fp_params["smearing_method"] in ["gauss","gaussian", "fd", "fixed", "mp", "mp2", "mv"]), "'smearing_method' should in 'gauss', 'gaussian', 'fd', 'fixed', 'mp', 'mp2', 'mv'. "
ret += "smearing_method %s\n" % fp_params["smearing_method"]
elif key == "smearing_sigma":
fp_params["smearing_sigma"] = float(fp_params["smearing_sigma"])
Expand Down