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(embeding): The numerical instability in construct the descriptors for high symmetry structures. #135

Merged
merged 1 commit into from
Apr 20, 2024

Conversation

floatingCatty
Copy link
Member

@floatingCatty floatingCatty commented Apr 20, 2024

In high symmtry structures, there is chance that the mirror symmetry will cancel out the product G \dot R; if R only contains (x,y,z) information. there will be numerical instability in this case for the standardization the descriptor vector xx, by seting xx=xx/xx.norm.

What we do here, is to update SE2Aggregation class in se2.py to and add radial info into env matrix. use the the R being (1/rij, x,y,z) as 4 elements as it is in deepmd. in this case, for high-symmetry strucutre, the 1/rij term can not be canceled out since it is always >=0.

Besides, we alos update _SE2Descriptor class in se2.py to set the flow parameter to "target_to_source". though previous the source_to_target is also correct. but use target_to_source is more natural by defination.

…instead of the last 3 columns. Update _SE2Descriptor class in se2.py to set the flow parameter to "target_to_source". and add radial info into env matrix
@QG-phy QG-phy changed the title Update SE2Aggregation class in se2.py to use the last 4 columns of x … fix(embeding): The numerical instability in construct the descriptors for high symmetry structures. Apr 20, 2024
@QG-phy QG-phy merged commit 8349224 into deepmodeling:main Apr 20, 2024
2 checks passed
QG-phy added a commit that referenced this pull request Apr 21, 2024
* Dev (#125)

* update workflow and install method.

* build(deps): update pyproject.toml

* build(deps): update pyproject.toml

* chore: delete release-check.md

* ci: update publish-to-pypi.yml

* Update pyproject.toml

* Update pyproject.toml

* update mix.ep50.pth, mix.iter500.pth and train_config.json (#126)

* update h-BN example, ckpt and the related doc. (#127)

* update mix.ep50.pth, mix.iter500.pth and train_config.json

* update hBN example

* docs: update hands_on.md

* update run.py:  (#128)

* update run.py: support change device and dtype when postprocess the model

* update argcheck.py

* update argcheck.py

* add E3 features (node/edge) to hamiltonian/density blocks (#129)

* stack changes

* fix test ham to feature

* update write block function in command line (#132)

* update write block

* update task naming for each mdoel

* feat(dftb): add support sk params from dftb skf files . (#133)

* add xitorch interp1d

* feat: create dptb/utils/_xitorch/__init__.py

* update C_chain example

* add sk

* read skfile and load sk para

* update sk_param.py

* update onsite.py:

add support load onsite E from the dftb skf files.

* update sk_param.py

* update sk_param.py

* add hopping dptb

* add core for dftb support.

* update sk_param.py: make the outof skparams in the same format as nnsk model parameters.

* update dftbsk.py: make the skparas from skf files  in the same style of nnsk.

* update hopping_dptb.py

* update onsite.py

* update dftbsk.py and nnsk.py

* add new mix type: dftb + nnenv

* update build.py

* update build.py and dftbsk.py

* update deeptb.py

* add build_model for dftbsk and dftbsk+nnenv two new mode.

* add hBN dftb example

* fix(SKParam):

Update SKParam class to handle missing keys in skdict and raise appropriate errors. Add unit tests for SKParam class.

* feat(train): Add skints loss function for training with nnsk model

* test(hopping_dptb): Update dftb/hopping_dptb.py and add test_dftbsk.py

* test(build_model): Update deeptb.py and test_build_model.py with dftbsk changes

* test: Refactor test_build_model.py to remove unnecessary blank lines and add validation for model_options in test_build_model_failure()

* update deeptb.py

* test(test_sktb): to add new tests for dftbsk and nnsk models

* 📃 docs(dftb): Update hBN_dftb example with new data and input files

* Update deeptb.py

* Update SE2Aggregation class in se2.py to use the last 4 columns of x instead of the last 3 columns. Update _SE2Descriptor class in se2.py to set the flow parameter to "target_to_source". and add radial info into env matrix (#135)

* feat(command): add cskf command to collect the skfiles into a pth database  (#134)

* add xitorch interp1d

* feat: create dptb/utils/_xitorch/__init__.py

* update C_chain example

* add sk

* read skfile and load sk para

* update sk_param.py

* update onsite.py:

add support load onsite E from the dftb skf files.

* update sk_param.py

* update sk_param.py

* add hopping dptb

* add core for dftb support.

* update sk_param.py: make the outof skparams in the same format as nnsk model parameters.

* update dftbsk.py: make the skparas from skf files  in the same style of nnsk.

* update hopping_dptb.py

* update onsite.py

* update dftbsk.py and nnsk.py

* add new mix type: dftb + nnenv

* update build.py

* update build.py and dftbsk.py

* update deeptb.py

* add build_model for dftbsk and dftbsk+nnenv two new mode.

* add hBN dftb example

* fix(SKParam):

Update SKParam class to handle missing keys in skdict and raise appropriate errors. Add unit tests for SKParam class.

* feat(train): Add skints loss function for training with nnsk model

* test(hopping_dptb): Update dftb/hopping_dptb.py and add test_dftbsk.py

* test(build_model): Update deeptb.py and test_build_model.py with dftbsk changes

* test: Refactor test_build_model.py to remove unnecessary blank lines and add validation for model_options in test_build_model_failure()

* update deeptb.py

* test(test_sktb): to add new tests for dftbsk and nnsk models

* 📃 docs(dftb): Update hBN_dftb example with new data and input files

* 🦄 refactor(SKParam): Update SKParam class to include HubdU and Occu in skdict

* Update deeptb.py

* ✨ feat(cskf):  Add collectskf.py to collect sktb params from sk files

* 🧪 test(csfk):  update test_skparam to add unit test for cskf command

* 📃 docs(dftb): add docs about dftb example into index.rst

* Fix bugs in SE2Aggregation and _SE2Descriptor classes

* add example mos2

* update hBN example

* fix(se2): update the smooth function in getting env descriptor (#136)

* 🐞 fix(se2): update the smooth function in getting env descriptor

* test: update test_emb_se2.py

* test: update test_emb_se2.py

* Update  version 2.0.1 in pyproject.toml

---------

Co-authored-by: Yinzhanghao Zhou <64253517+floatingCatty@users.noreply.github.com>
@floatingCatty floatingCatty deleted the checkout_se2 branch April 30, 2024 13:02
QG-phy added a commit that referenced this pull request May 6, 2024
* Dev (#125)

* update workflow and install method.

* build(deps): update pyproject.toml

* build(deps): update pyproject.toml

* chore: delete release-check.md

* ci: update publish-to-pypi.yml

* Update pyproject.toml

* Update pyproject.toml

* update mix.ep50.pth, mix.iter500.pth and train_config.json (#126)

* update h-BN example, ckpt and the related doc. (#127)

* update mix.ep50.pth, mix.iter500.pth and train_config.json

* update hBN example

* docs: update hands_on.md

* update run.py:  (#128)

* update run.py: support change device and dtype when postprocess the model

* update argcheck.py

* update argcheck.py

* add E3 features (node/edge) to hamiltonian/density blocks (#129)

* stack changes

* fix test ham to feature

* update write block function in command line (#132)

* update write block

* update task naming for each mdoel

* feat(dftb): add support sk params from dftb skf files . (#133)

* add xitorch interp1d

* feat: create dptb/utils/_xitorch/__init__.py

* update C_chain example

* add sk

* read skfile and load sk para

* update sk_param.py

* update onsite.py:

add support load onsite E from the dftb skf files.

* update sk_param.py

* update sk_param.py

* add hopping dptb

* add core for dftb support.

* update sk_param.py: make the outof skparams in the same format as nnsk model parameters.

* update dftbsk.py: make the skparas from skf files  in the same style of nnsk.

* update hopping_dptb.py

* update onsite.py

* update dftbsk.py and nnsk.py

* add new mix type: dftb + nnenv

* update build.py

* update build.py and dftbsk.py

* update deeptb.py

* add build_model for dftbsk and dftbsk+nnenv two new mode.

* add hBN dftb example

* fix(SKParam):

Update SKParam class to handle missing keys in skdict and raise appropriate errors. Add unit tests for SKParam class.

* feat(train): Add skints loss function for training with nnsk model

* test(hopping_dptb): Update dftb/hopping_dptb.py and add test_dftbsk.py

* test(build_model): Update deeptb.py and test_build_model.py with dftbsk changes

* test: Refactor test_build_model.py to remove unnecessary blank lines and add validation for model_options in test_build_model_failure()

* update deeptb.py

* test(test_sktb): to add new tests for dftbsk and nnsk models

* 📃 docs(dftb): Update hBN_dftb example with new data and input files

* Update deeptb.py

* Update SE2Aggregation class in se2.py to use the last 4 columns of x instead of the last 3 columns. Update _SE2Descriptor class in se2.py to set the flow parameter to "target_to_source". and add radial info into env matrix (#135)

* feat(command): add cskf command to collect the skfiles into a pth database  (#134)

* add xitorch interp1d

* feat: create dptb/utils/_xitorch/__init__.py

* update C_chain example

* add sk

* read skfile and load sk para

* update sk_param.py

* update onsite.py:

add support load onsite E from the dftb skf files.

* update sk_param.py

* update sk_param.py

* add hopping dptb

* add core for dftb support.

* update sk_param.py: make the outof skparams in the same format as nnsk model parameters.

* update dftbsk.py: make the skparas from skf files  in the same style of nnsk.

* update hopping_dptb.py

* update onsite.py

* update dftbsk.py and nnsk.py

* add new mix type: dftb + nnenv

* update build.py

* update build.py and dftbsk.py

* update deeptb.py

* add build_model for dftbsk and dftbsk+nnenv two new mode.

* add hBN dftb example

* fix(SKParam):

Update SKParam class to handle missing keys in skdict and raise appropriate errors. Add unit tests for SKParam class.

* feat(train): Add skints loss function for training with nnsk model

* test(hopping_dptb): Update dftb/hopping_dptb.py and add test_dftbsk.py

* test(build_model): Update deeptb.py and test_build_model.py with dftbsk changes

* test: Refactor test_build_model.py to remove unnecessary blank lines and add validation for model_options in test_build_model_failure()

* update deeptb.py

* test(test_sktb): to add new tests for dftbsk and nnsk models

* 📃 docs(dftb): Update hBN_dftb example with new data and input files

* 🦄 refactor(SKParam): Update SKParam class to include HubdU and Occu in skdict

* Update deeptb.py

* ✨ feat(cskf):  Add collectskf.py to collect sktb params from sk files

* 🧪 test(csfk):  update test_skparam to add unit test for cskf command

* 📃 docs(dftb): add docs about dftb example into index.rst

* Fix bugs in SE2Aggregation and _SE2Descriptor classes

* add example mos2

* update hBN example

* fix(se2): update the smooth function in getting env descriptor (#136)

* 🐞 fix(se2): update the smooth function in getting env descriptor

* test: update test_emb_se2.py

* test: update test_emb_se2.py

* Update  version 2.0.1 in pyproject.toml

* Fix(nnsk): NNSK class in nnsk.py to use the get() method when accessing the full orbital (#139)

* Update NNSK class in nnsk.py to use the get() method when accessing values in the full_basis_to_basis dictionary.

* fix digital error in test_emb_se2

* temp

* Update(nnsk): automatic orthogonalization (#141)

* fix(data): fix the bug in  dm parse (#142)

* Update(nnsk): automatic orthogonalization

* update DM parse

* feat:add support to pass kpoints np.array to get band eigenvalues. (#145)

* feat: create toskint.ipynb

* feat:add support to pass kpoints nparray to get band eigenvalues.

* feat(curve_fitting.py): develop a curve fitting function that converts the dftb model to nnsk (#146)

* update fitting dftb

* add(dftb2nnsk): develop fitting class for converting dftb to nnsk model

* remove(curve-fitting.ipynb): remove the notebook for development

* fix test split

* add(test_dftb2nnsk): add simple test for dftb2nnsk class

* temp

* fix test

* fix(nnsk): fix device type errpr in to json function

* rename hopping_dptb to hopping_dftb

* temp

* align inferences

* update decaying function

* remove rc from dftb2nnsk

* fix test nrl

* fix test nrl

* update argcheck

* update dftb2nnsk.py

* update argcheck

* update read_NRL_tojson.py

---------

Co-authored-by: qqgu <guqq_phy@qq.com>

* feat(data): add parse md trajectory of abacus (#144)

* update abacus parse md

* fix(default_dataset): The natom and nframe default setting

* shift the 'pos‘ position in test default dataset

* fix lattice constant transform

* update parse_abacus_md

* update abacus.py

* update abacus.py

* update parse abacus scf lattice constant

---------

Co-authored-by: qqgu <guqq_phy@qq.com>

* style: optmize the import of each submodule (#154)

* data import

* optimize imports

* fix: idp(data) in nnsk and deeptb, and refactor soc switch in hr2hk  (#152)

* refactor: plotting code in dftb2nnsk.py fix push_decay method and update push options (#156)

* Refactor plotting code in dftb2nnsk.py

* refactor(nnsk): Refactor NNSK class in nnsk.py to fix push_decay method and update push options

* update saver.py to save ckpt with name of ovlp

* fix: update nnsk from reference and change the sign of ovp_thr

* update saver.py

* update mos2 example

* Update test_sktb.py with new model weights and fix init_model path in test_md

* docs: Update dftb.md with hBN model training steps and fix formatting (#157)

* docs: Update dftb.md with hBN model training steps and fix formatting

* Bump actions/setup-python from 4 to 5 (#131)

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump actions/checkout from 3 to 4 (#130)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: add -v to get dptb version, and update the version.py  to load version number and git version  (#158)

* Refactor plotting code in dftb2nnsk.py

* refactor(nnsk): Refactor NNSK class in nnsk.py to fix push_decay method and update push options

* update saver.py to save ckpt with name of ovlp

* fix: update nnsk from reference and change the sign of ovp_thr

* update saver.py

* update mos2 example

* Update test_sktb.py with new model weights and fix init_model path in test_md

* docs: Update dftb.md with hBN model training steps and fix formatting

* Refactor main.py to add version flag and handle unknown version

* Update pyproject.toml to add toml dependency

* feat: update pyproject.toml and __init__.py to automatically get the version number. (#160)

* Refactor plotting code in dftb2nnsk.py

* refactor(nnsk): Refactor NNSK class in nnsk.py to fix push_decay method and update push options

* update saver.py to save ckpt with name of ovlp

* fix: update nnsk from reference and change the sign of ovp_thr

* update saver.py

* update mos2 example

* Update test_sktb.py with new model weights and fix init_model path in test_md

* docs: Update dftb.md with hBN model training steps and fix formatting

* Refactor main.py to add version flag and handle unknown version

* Update pyproject.toml to add toml dependency

* update pyproject.toml and add -v command

* update ut.sh

* update unit_test.yml and ut.sh

* ci: update unit_test.yml

* ci: update unit_test.yml

* ci: update unit_test.yml

* ci: update unit_test.yml

* ci: update unit_test.yml

* ci: update unit_test.yml

* build(deps): update 2 files and delete 1 file

* ci: update devcontainer.yml

* ci: update devcontainer.yml

* ci: update devcontainer.yml

* ci: update devcontainer.yml

* ci: update devcontainer.yml

* back to main

* Update devcontainer.yml and unit_test.yml workflows

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Yinzhanghao Zhou <64253517+floatingCatty@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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