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

From v1json and To json and fix the support for NRL json #104

Merged
merged 44 commits into from
Apr 2, 2024

Conversation

QG-phy
Copy link
Collaborator

@QG-phy QG-phy commented Mar 27, 2024

  1. fix the nnsk from reference to load model in JSON format. and support the v1 version JSON model.
  2. add and fix the function of to_json make the model can be saved to a JSON format.
  3. update and fix the support of loading NRL json model.
  4. update read NRL par data to dptbsk json v2 model.

QG-phy and others added 30 commits March 26, 2024 19:06
1. change default of push from None  to False
2. fix bug in checking the model_options in model and input jdata.
3. fix bug in load v1 json model.
@QG-phy QG-phy requested a review from floatingCatty April 1, 2024 15:00
@QG-phy
Copy link
Collaborator Author

QG-phy commented Apr 1, 2024

@floatingCatty 你可以review 这部分代码了。

@QG-phy QG-phy changed the title From v1json From v1json and To json and fix the support for NRL json Apr 1, 2024
dptb/nn/nnsk.py Show resolved Hide resolved
dptb/nn/nnsk.py Outdated

assert 'version' in json_model, "The version of the model is not provided in the json model file."
ckpt_version = json_model.get("version")
if ckpt_version not in [1,2]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

或许version也可以放constant里?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经加入

# load hopping params
for orbpair, skparam in hopping_param.items():
skparam = torch.tensor(skparam, dtype=dtype, device=device)
skparam[0] *= 13.605662285137 * 2
if ene_unit == "Hartree" and hopping['method'] not in ['NRL', 'NRL1', 'NRL2']:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这边如果是NRL那不需要处理嘛

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nrl 的参数格式和我们其他的不一样。不能这么简单的用第0个乘一下。我对于NRL的json已经基于默认单位eV 处理完了。不需要在这里单独的处理。另外这个单位的转换现在是非常特有的情况才会用到,只有读取旧版的时候才有用。我们v2版本的json全部是单位强制为eV.

@QG-phy QG-phy merged commit 48e503c into deepmodeling:main Apr 2, 2024
2 checks passed
@QG-phy QG-phy deleted the from_v1json branch April 2, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants