Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Han Wang committed Dec 4, 2024
1 parent f0f8c27 commit e6a66c6
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# -- Project information -----------------------------------------------------

project = "dpdata"
copyright = "2019-%d, DeepModeling " % date.today().year
copyright = "2019-%d, DeepModeling " % date.today().year # noqa: UP031
author = "Han Wang"

# The short X.Y version
Expand Down
4 changes: 2 additions & 2 deletions tests/poscars/poscar_ref_oh.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_cell(self):
self.system.data["cells"][0][ii][jj],
ovito_cell[ii][jj],
places=6,
msg="cell[%d][%d] failed" % (ii, jj),
msg="cell[%d][%d] failed" % (ii, jj), # noqa: UP031
)

def test_frame(self):
Expand All @@ -48,5 +48,5 @@ def test_frame(self):
self.system.data["coords"][0][ii][jj],
ovito_posis[ii][jj],
places=6,
msg="posis[%d][%d] failed" % (ii, jj),
msg="posis[%d][%d] failed" % (ii, jj), # noqa: UP031
)
4 changes: 2 additions & 2 deletions tests/pwmat/config_ref_ch4.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_cell(self):
self.system.data["cells"][0][ii][jj],
ovito_cell[ii][jj],
places=6,
msg="cell[%d][%d] failed" % (ii, jj),
msg="cell[%d][%d] failed" % (ii, jj), # noqa: UP031
)

def test_frame(self):
Expand All @@ -57,5 +57,5 @@ def test_frame(self):
self.system.data["coords"][0][ii][jj],
ovito_posis[ii][jj],
places=6,
msg="posis[%d][%d] failed" % (ii, jj),
msg="posis[%d][%d] failed" % (ii, jj), # noqa: UP031
)
4 changes: 2 additions & 2 deletions tests/pwmat/config_ref_oh.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_cell(self):
self.system.data["cells"][0][ii][jj],
ovito_cell[ii][jj],
places=6,
msg="cell[%d][%d] failed" % (ii, jj),
msg="cell[%d][%d] failed" % (ii, jj), # noqa: UP031
)

def test_frame(self):
Expand All @@ -43,5 +43,5 @@ def test_frame(self):
self.system.data["coords"][0][ii][jj],
ovito_posis[ii][jj],
places=6,
msg="posis[%d][%d] failed" % (ii, jj),
msg="posis[%d][%d] failed" % (ii, jj), # noqa: UP031
)
2 changes: 2 additions & 0 deletions tests/test_custom_data_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,6 @@ def test_to_deepmd_hdf5(self):
def test_from_deepmd_hdf5(self):
self.system.to_deepmd_hdf5("data_bar.h5")
x = dpdata.LabeledSystem("data_bar.h5", fmt="deepmd/hdf5")
print(self.system.data.keys())
print(x.data.keys())
np.testing.assert_allclose(x.data["bar"], self.bar)
6 changes: 3 additions & 3 deletions tests/test_msd.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ def test_msd(self):
# print(msd)
ncomp = msd.shape[0]
for ii in range(ncomp):
self.assertAlmostEqual(msd0[ii], ii * ii, msg="msd0[%d]" % ii)
self.assertAlmostEqual(msd1[ii], ii * ii * 4, msg="msd1[%d]" % ii)
self.assertAlmostEqual(msd[ii], (msd0[ii] + msd1[ii]) * 0.5, "msd[%d]" % ii)
self.assertAlmostEqual(msd0[ii], ii * ii, msg="msd0[%d]" % ii) # noqa: UP031
self.assertAlmostEqual(msd1[ii], ii * ii * 4, msg="msd1[%d]" % ii) # noqa: UP031
self.assertAlmostEqual(msd[ii], (msd0[ii] + msd1[ii]) * 0.5, "msd[%d]" % ii) # noqa: UP031
2 changes: 1 addition & 1 deletion tests/test_remove_pbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_remove(self):
self.assertAlmostEqual(
sys["cells"][ff][ii][jj],
ref[ii][jj],
msg="%d %d %d" % (ff, ii, jj),
msg="%d %d %d" % (ff, ii, jj), # noqa: UP031
)
dists = []
for ii in range(sys.get_natoms()):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_system_apply_pbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_pbc(self):
self.assertAlmostEqual(
sys["coords"][ii][jj][dd],
bk_coord[ii][jj][dd],
msg="coord[%d][%d][%d] failed" % (ii, jj, dd),
msg="coord[%d][%d][%d] failed" % (ii, jj, dd), # noqa: UP031
)


Expand Down

0 comments on commit e6a66c6

Please sign in to comment.