Skip to content

Commit

Permalink
Merge pull request #41 from robinzyb/devel
Browse files Browse the repository at this point in the history
convert npt_i cell to angstrom when parsing from cp2k output
  • Loading branch information
robinzyb authored Feb 21, 2024
2 parents 029a46e + 9f359df commit e58f60a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cp2kdata/block_parser/cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ def parse_all_md_cells(output_file: List[str],
match["alpha"], match["beta"], match["gamma"]]
cell = np.array(cell, dtype=float)
cell[3:] = init_cell_angles
# convert bohr to angstrom
cell[:3] = cell[:3] * au2A
# make sure cell length are in angstrom and cell angles are in degree before sent to cellpar_to_cell
cell = cellpar_to_cell(cell)
all_md_cells.append(cell)

Expand Down
15 changes: 13 additions & 2 deletions tests/test_cube/test_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,19 @@ def test_mav(self, cube_and_answer):
mav_answer = np.load(os.path.join(answer_dir, "mav.npy"))
mav_x_answer = mav_answer[0]
mav_answer = mav_answer[1]
assert np.all(mav == mav_answer)
assert np.all(mav_x == mav_x_answer)

np.testing.assert_almost_equal(mav,
mav_answer,
decimal=8,
err_msg = 'mav failed'
)
np.testing.assert_almost_equal(mav_x,
mav_x_answer,
decimal=8,
err_msg = 'mav_x failed'
)
#assert np.all(mav == mav_answer)
#assert np.all(mav_x == mav_x_answer)



Expand Down
Binary file modified tests/test_dpdata/v2022.2/aimd_npt_i/deepmd/set.000/box.npy
Binary file not shown.
Binary file modified tests/test_dpdata/v2022.2/aimd_npt_i/deepmd/set.000/virial.npy
Binary file not shown.

0 comments on commit e58f60a

Please sign in to comment.