Skip to content

Commit 94fe957

Browse files
wanghan-iapcmHan WangiProzd
authored
chore: change econf embed to spin representation (#4166)
<!-- 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>
1 parent ab48d90 commit 94fe957

3 files changed

Lines changed: 186 additions & 123 deletions

File tree

deepmd/dpmodel/utils/type_embed.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,9 @@ def change_type_map(
222222
def get_econf_tebd(type_map, precision: str = "default"):
223223
from deepmd.utils.econf_embd import (
224224
ECONF_DIM,
225-
electronic_configuration_embedding,
225+
)
226+
from deepmd.utils.econf_embd import (
227+
normalized_electronic_configuration_embedding as electronic_configuration_embedding,
226228
)
227229
from deepmd.utils.econf_embd import type_map as periodic_table
228230

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

0 commit comments

Comments
 (0)