Skip to content

Commit

Permalink
Update test_parser.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jd15489 committed Nov 21, 2023
1 parent 2ef00e9 commit 6840272
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions kinisi/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,27 @@ def test_mda_init_with_COM(self):
assert_equal(data.indices, [0])
assert_almost_equal(data.coords_check, [[[0.382421597, 0.2087361, 0.2]]])

def test_mda_inti_with_empty_framwork_indices(self):
def test_mda_inti_with_framwork_indices(self):
xd = mda.Universe(os.path.join(os.path.dirname(kinisi.__file__), 'tests/inputs/example_LAMMPS_drift.data'),
os.path.join(os.path.dirname(kinisi.__file__), 'tests/inputs/example_LAMMPS_drift.traj'),
topology_format='DATA',
format='LAMMPSDUMP')
da_params = {'specie': '1', 'time_step': 1, 'step_skip': 1, 'framework_indices': []}
data = parser.MDAnalysisParser(xd, **da_params)
assert_almost_equal(data.time_step, 1)
assert_almost_equal(data.step_skip, 1)
assert_equal(data.indices, [0])
assert_equal(data.drift_indices, [])
da_1_params = {'specie': '1', 'time_step': 1, 'step_skip': 1, 'framework_indices': []}
data_1 = parser.MDAnalysisParser(xd, **da_1_params)
assert_almost_equal(data_1.time_step, 1)
assert_almost_equal(data_1.step_skip, 1)
assert_equal(data_1.indices, [0])
assert_equal(data_1.drift_indices, [])
assert_equal(data_1.dc[0], np.zeros((4, 3)))
da_2_params = {'specie': '1', 'time_step': 1, 'step_skip': 1}
data_2 = parser.MDAnalysisParser(xd, **da_2_params)
assert_almost_equal(data_2.time_step, 1)
assert_almost_equal(data_2.step_skip, 1)
assert_equal(data_2.indices, [0])
assert_equal(data_2.drift_indices, list(range(1, 9)))
print(data_2.dc[0])
disp_array = [[0.0, 0.0, 0.0], [0.2, 0.2, 0.2], [0.4, 0.4, 0.4], [1, 1, 1]]
assert_almost_equal(data_2.dc[0], disp_array)

def test_get_matrix(self):
matrix = parser._get_matrix([10, 10, 10, 90, 90, 90])
Expand Down

0 comments on commit 6840272

Please sign in to comment.