Skip to content

Commit

Permalink
chore: change econf embed to spin representation (#4166)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced a function to transform electronic configuration data into
a spin representation, enhancing how electronic states are represented.
- Updated the electronic configuration embedding to include negative
values, reflecting a new encoding scheme.
- Added a normalization function for electronic configuration vectors to
improve data consistency.

- **Tests**
- Added a new test for the spin representation functionality to ensure
accuracy of the transformation for iron (Fe).
	- Updated existing tests to align with the new expected output format.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Han Wang <wang_han@iapcm.ac.cn>
Co-authored-by: Duo <50307526+iProzd@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 27, 2024
1 parent ab48d90 commit 94fe957
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 123 deletions.
5 changes: 3 additions & 2 deletions deepmd/dpmodel/utils/type_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ def change_type_map(
def get_econf_tebd(type_map, precision: str = "default"):
from deepmd.utils.econf_embd import (
ECONF_DIM,
electronic_configuration_embedding,
)
from deepmd.utils.econf_embd import (
normalized_electronic_configuration_embedding as electronic_configuration_embedding,
)
from deepmd.utils.econf_embd import type_map as periodic_table

Expand All @@ -240,6 +242,5 @@ def get_econf_tebd(type_map, precision: str = "default"):
[electronic_configuration_embedding[kk] for kk in type_map],
dtype=PRECISION_DICT[precision],
)
econf_tebd /= econf_tebd.sum(-1, keepdims=True) # do normalization
embed_input_dim = ECONF_DIM
return econf_tebd, embed_input_dim
Loading

0 comments on commit 94fe957

Please sign in to comment.