Skip to content

fix(abacus): fix bug in read LATTICE_CONSTANT in md#450

Merged
wanghan-iapcm merged 6 commits intodeepmodeling:develfrom
pxlxingliang:md
Apr 23, 2023
Merged

fix(abacus): fix bug in read LATTICE_CONSTANT in md#450
wanghan-iapcm merged 6 commits intodeepmodeling:develfrom
pxlxingliang:md

Conversation

@pxlxingliang
Copy link
Contributor

@pxlxingliang pxlxingliang commented Apr 12, 2023

In ABACUS version >= v3.1.4, the format of file "MD_dump" is different. The lattice constant line is added by the unit "Angstrom" at the end, and the position is the real cartesian coordinate.
MD_dump is changed from

MDSTEP:  0
LATTICE_CONSTANT: 23.453780000000
LATTICE_VECTORS
  1.000000000000  0.000000000000  0.000000000000
  0.000000000000  1.000000000000  0.000000000000
  0.000000000000  0.000000000000  1.000000000000
VIRIAL (KBAR)
  36.689617311102  0.000000000001  -0.000000000000
  0.000000000001  36.689617311104  -0.000000000001
  -0.000000000000  -0.000000000001  36.689617311147
INDEX    LABEL    POSITIONS    FORCE (eV/Angstrom)
  0  Sn  0.000000000000  0.000000000000  0.000000000000  -0.000000000000  0.000000000000  -0.000000000000
  1  Sn  0.000000000000  0.250000000000  0.250000000000  -0.000186795145  -0.000453823732  -0.000453823732

to

MDSTEP:  0
LATTICE_CONSTANT: 12.411200939060 Angstrom
LATTICE_VECTORS
  1.000000000000  0.000000000000  0.000000000000
  0.000000000000  1.000000000000  0.000000000000
  0.000000000000  0.000000000000  1.000000000000
VIRIAL (kbar)
  36.689617311101  0.000000000003  -0.000000000000
  0.000000000003  36.689617311089  -0.000000000001
  -0.000000000000  -0.000000000001  36.689617311135
INDEX    LABEL    POSITION (Angstrom)    FORCE (eV/Angstrom)    VELOCITY (Angstrom/fs)
  0  Sn  0.000000000000  0.000000000000  0.000000000000  -0.000000000000  -0.000000000001  -0.000000000001  0.001244557166  -0.000346684288  0.000768457739
  1  Sn  0.000000000000  3.102800034079  3.102800034079  -0.000186795145  -0.000453823768  -0.000453823768  0.000550996187  -0.000886442775  0.001579501983

@njzjz njzjz linked an issue Apr 12, 2023 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Apr 12, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.05 🎉

Comparison is base (6232559) 82.49% compared to head (f3fc1fc) 82.55%.

Additional details and impacted files
@@            Coverage Diff             @@
##            devel     #450      +/-   ##
==========================================
+ Coverage   82.49%   82.55%   +0.05%     
==========================================
  Files          68       68              
  Lines        6193     6196       +3     
==========================================
+ Hits         5109     5115       +6     
+ Misses       1084     1081       -3     
Impacted Files Coverage Δ
dpdata/abacus/md.py 99.17% <100.00%> (+0.02%) ⬆️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@pxlxingliang pxlxingliang requested a review from njzjz April 12, 2023 06:09
@pxlxingliang
Copy link
Contributor Author

@njzjz fix the bug in reading lattice constant and coordinate, and add unittest for new version.

Comment on lines +44 to +73
"""abacus version >=3.1.4:
MDSTEP: 0
LATTICE_CONSTANT: 12.411200939060 Angstrom
LATTICE_VECTORS
1.000000000000 0.000000000000 0.000000000000
0.000000000000 1.000000000000 0.000000000000
0.000000000000 0.000000000000 1.000000000000
VIRIAL (kbar)
36.689617311101 0.000000000003 -0.000000000000
0.000000000003 36.689617311089 -0.000000000001
-0.000000000000 -0.000000000001 36.689617311135
INDEX LABEL POSITION (Angstrom) FORCE (eV/Angstrom) VELOCITY (Angstrom/fs)
0 Sn 0.000000000000 0.000000000000 0.000000000000 -0.000000000000 -0.000000000001 -0.000000000001 0.001244557166 -0.000346684288 0.000768457739
1 Sn 0.000000000000 3.102800034079 3.102800034079 -0.000186795145 -0.000453823768 -0.000453823768 0.000550996187 -0.000886442775 0.001579501983.

abacus version < 3.1.4:
MDSTEP: 0
LATTICE_CONSTANT: 23.453780000000
LATTICE_VECTORS
1.000000000000 0.000000000000 0.000000000000
0.000000000000 1.000000000000 0.000000000000
0.000000000000 0.000000000000 1.000000000000
VIRIAL (KBAR)
36.689617311101 0.000000000003 -0.000000000000
0.000000000003 36.689617311089 -0.000000000001
-0.000000000000 -0.000000000001 36.689617311135
INDEX LABEL POSITIONS FORCE (eV/Angstrom)
0 Sn 0.000000000000 0.000000000000 0.000000000000 -0.000000000000 -0.000000000001 -0.000000000001
1 Sn 0.000000000000 0.250000000000 0.250000000000 -0.000186795145 -0.000453823768 -0.000453823768
"""
Copy link
Member

Choose a reason for hiding this comment

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

We follow numpydoc to use docstring as documentation. Please do not leave raw data in the docstring.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, it is removed.

Signed-off-by: pxlxingliang <91927439+pxlxingliang@users.noreply.github.com>
@pxlxingliang pxlxingliang requested a review from njzjz April 13, 2023 08:25
@AnguseZhang
Copy link
Collaborator

@pxlxingliang Is this patch compatible with the version older than 3.1.4?

@pxlxingliang
Copy link
Contributor Author

pxlxingliang commented Apr 22, 2023 via email

@pxlxingliang
Copy link
Contributor Author

@njzjz @wanghan-iapcm,please help check this PR. If there is no problem, please help merge it as soon as possible. This bug has a significant effect on the using of dpdata+ABACUS. Besides, I hope a new version to be relased after this PR is merged.

@wanghan-iapcm wanghan-iapcm merged commit 3c09356 into deepmodeling:devel Apr 23, 2023
@pxlxingliang pxlxingliang deleted the md branch October 9, 2024 06:10
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.

[BUG] Reading data error for ABACUS 3.2

4 participants