Skip to content

ASE enhance#121

Merged
amcadmus merged 6 commits into
deepmodeling:develfrom
marian-code:ase_enhance
Dec 12, 2020
Merged

ASE enhance#121
amcadmus merged 6 commits into
deepmodeling:develfrom
marian-code:ase_enhance

Conversation

@marian-code

Copy link
Copy Markdown
Contributor

Add the ability to export energy, forces and virials to ASE atoms. It is implemented as SinglePointCalculator calculator which was designed to only remember results not to do any computations.

Now these methods can be used on exported Atoms object

Atoms.get_potential_energy()
Atoms.get_forces()
Atoms.get_stress()

The try except block in System.to_ase_structure method has been removed as it only catches the import error and the re-raises it and thus it provides no additional security.

@amcadmus amcadmus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

'energies', 'forces' and 'virials' are keys supposed to appear in LabeledSystem rather than System. Please check LabeledSystem::sub_system at

def sub_system(self, f_idx) :

I would suggest implementing a to_ase_structure method in LabeledSystem

@marian-code

Copy link
Copy Markdown
Contributor Author

'energies', 'forces' and 'virials' are keys supposed to appear in LabeledSystem rather than System. Please check LabeledSystem::sub_system at

def sub_system(self, f_idx) :

I would suggest implementing a to_ase_structure method in LabeledSystem

I did not notice that at first, but your suggestion makes sense and is in line with class hierarchy logic. I have reimplemented to_ase_structure in LabeledSystem so it overrides the implementation in System that way unlabeled structures can still be exported from System and labeled ones are exported by overriding method in LabeledSystem

@codecov-io

codecov-io commented Dec 2, 2020

Copy link
Copy Markdown

Codecov Report

Merging #121 (79bc35b) into devel (1fc5d3e) will decrease coverage by 0.26%.
The diff coverage is 25.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            devel     #121      +/-   ##
==========================================
- Coverage   84.98%   84.71%   -0.27%     
==========================================
  Files          28       28              
  Lines        3256     3272      +16     
==========================================
+ Hits         2767     2772       +5     
- Misses        489      500      +11     
Impacted Files Coverage Δ
dpdata/system.py 79.61% <25.00%> (-0.95%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1fc5d3e...79bc35b. Read the comment docs.

@marian-code marian-code requested a review from amcadmus December 2, 2020 14:50
@amcadmus amcadmus merged commit 14393ce into deepmodeling:devel Dec 12, 2020
@marian-code marian-code deleted the ase_enhance branch December 12, 2020 10:53
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.

3 participants