Skip to content

Add unlabeled abacus STRU read/dump interface#303

Merged
wanghan-iapcm merged 10 commits into
deepmodeling:develfrom
Liu-RX:devel
Jun 13, 2022
Merged

Add unlabeled abacus STRU read/dump interface#303
wanghan-iapcm merged 10 commits into
deepmodeling:develfrom
Liu-RX:devel

Conversation

@Liu-RX

@Liu-RX Liu-RX commented Jun 11, 2022

Copy link
Copy Markdown
Contributor

No description provided.

@codecov-commenter

codecov-commenter commented Jun 11, 2022

Copy link
Copy Markdown

Codecov Report

Merging #303 (84dd284) into devel (2bbfc9b) will increase coverage by 0.39%.
The diff coverage is 97.93%.

@@            Coverage Diff             @@
##            devel     #303      +/-   ##
==========================================
+ Coverage   81.66%   82.05%   +0.39%     
==========================================
  Files          62       63       +1     
  Lines        5269     5412     +143     
==========================================
+ Hits         4303     4441     +138     
- Misses        966      971       +5     
Impacted Files Coverage Δ
dpdata/abacus/scf.py 91.10% <97.61%> (+3.43%) ⬆️
dpdata/plugins/abacus.py 100.00% <100.00%> (ø)
dpdata/driver.py 86.36% <0.00%> (-0.48%) ⬇️
dpdata/ase_calculator.py 92.59% <0.00%> (ø)
dpdata/plugins/ase.py 74.32% <0.00%> (+6.52%) ⬆️

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 2bbfc9b...84dd284. Read the comment docs.

Comment thread dpdata/plugins/abacus.py Outdated
@@ -1,7 +1,47 @@
from ast import For

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.

typo?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes! Thanks for the careful inspection!

Comment thread dpdata/plugins/abacus.py
@Format.register("stru")
class AbacusSTRUFormat(Format):
def from_system(self, file_name, **kwargs):
return dpdata.abacus.scf.get_frame_from_stru(file_name)

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.

a blank line should be after this line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Got that. I have already added the blank line.

Comment thread dpdata/plugins/abacus.py Outdated
Comment on lines +34 to +35
if 'pp_file' in kwargs:
pp_file = kwargs['pp_file']

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.

can be written as pp_file = kwargs.get('pp_file')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have changed all of the cases into kwargs.get().

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.

When you write as this case, line 34 can be removed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Liu-RX plz remove the if clauses

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have removed the if clauses and the pp_file = None lines.

Comment thread tests/test_abacus_pw_scf.py Outdated
virial = np.array(virial)
for ii in range(virial.shape[0]) :
for jj in range(virial.shape[1]) :
self.assertAlmostEqual(self.system_ch4.data['virials'][0][ii][jj], virial[ii][jj], places = 3)

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.

np.testing.assert_almost_equal can be used to compare numpy arrays.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the most helpful suggestion! I have changed all possible cases in both test_abacus_pw_scf.py and test_abacus_md.py into np.testing.assert_almost_equal.

@wanghan-iapcm wanghan-iapcm merged commit b70e3e0 into deepmodeling:devel Jun 13, 2022
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.

4 participants