Add unlabeled abacus STRU read/dump interface#303
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
| @@ -1,7 +1,47 @@ | |||
| from ast import For | |||
There was a problem hiding this comment.
Yes! Thanks for the careful inspection!
| @Format.register("stru") | ||
| class AbacusSTRUFormat(Format): | ||
| def from_system(self, file_name, **kwargs): | ||
| return dpdata.abacus.scf.get_frame_from_stru(file_name) |
There was a problem hiding this comment.
a blank line should be after this line
There was a problem hiding this comment.
Got that. I have already added the blank line.
| if 'pp_file' in kwargs: | ||
| pp_file = kwargs['pp_file'] |
There was a problem hiding this comment.
can be written as pp_file = kwargs.get('pp_file')
There was a problem hiding this comment.
I have changed all of the cases into kwargs.get().
There was a problem hiding this comment.
When you write as this case, line 34 can be removed.
There was a problem hiding this comment.
I have removed the if clauses and the pp_file = None lines.
| 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) |
There was a problem hiding this comment.
np.testing.assert_almost_equal can be used to compare numpy arrays.
There was a problem hiding this comment.
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.
No description provided.