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

[BUG] avoid AssertionError when using qe pwscf #683

Closed
pee8379 opened this issue Mar 26, 2022 · 1 comment
Closed

[BUG] avoid AssertionError when using qe pwscf #683

pee8379 opened this issue Mar 26, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@pee8379
Copy link
Contributor

pee8379 commented Mar 26, 2022

As discussed in deepmodeling/deepmd-kit#1518 , deepmd-kit accept initial systems (DFT results) with less elements type.

However, when try to input similarly to "sys_configs" in param.json when using qe pwscf, it is stuck at step 02.fp, because file dpgen/generator/lib/pwscf.py
allow only POSCAR file with same number of element with "type_map" in param.json, and produce AssertionError if not.

(line 83-86)
ntypes = len(atom_names)
assert(ntypes == len(atom_names))
assert(ntypes == len(atom_masses))
assert(ntypes == len(pps))

This can be solved by modify line 2096 - 2097 of dpgen/generator/run.py

sys_data['atom_masses'] = jdata['mass_map']
ret = make_pwscf_input(sys_data, fp_pp_files, fp_params, user_input = user_input)

to

sys_data['atom_masses'] = []
pps = []
for iii in sys_data['atom_names']:
sys_data['atom_masses'].append(jdata['mass_map'][jdata['type_map'].index(iii)])
pps.append(fp_pp_files[jdata['type_map'].index(iii)])
ret = make_pwscf_input(sys_data, pps, fp_params, user_input = user_input)

I wish this help others.
Please tell me if I did something dumb.

@pee8379 pee8379 added the bug Something isn't working label Mar 26, 2022
@wanghan-iapcm
Copy link
Contributor

Thanks for reporting the issue.

The fix should be valid. Could you please submit your revision by a pull request?

pee8379 added a commit to pee8379/dpgen that referenced this issue Mar 27, 2022
wanghan-iapcm pushed a commit that referenced this issue Apr 20, 2022
* fix typo in github actions release to conda

* Get from_poscar_path only when from_poscar is true (#537)

Change-Id: I17774bee345634e4e72bd783e8112eefaaf9f0d3

Co-authored-by: Zhengju Sha <[email protected]>

* Fix QE pwscf AssertionError

details in #683

Co-authored-by: Han Wang <[email protected]>
Co-authored-by: felix5572 <[email protected]>
Co-authored-by: shazj99 <[email protected]>
Co-authored-by: Zhengju Sha <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants