def test_xvg_comments(self): data = file_io.load_xvg('files/test_file_io/data_&comments.xvg', dims=3, comments=('#', '@', '&')) self.assertEqual(data.shape[0], 6) self.assertEqual(data.shape[1], 10) self.assertEqual(data.shape[2], 3)
def test_xvg_return_time(self): data, time = file_io.load_xvg('files/test_file_io/data_3D.xvg', dims=3, return_time_data=True) self.assertEqual(time.size, 6)
def test_fakedata_3D(self): # make sure reordering is correct, values actually right data = file_io.load_xvg('files/test_file_io/fake_3D_data.xvg', dims=3) self.assertEqual(data[1, 1, 0], 10) self.assertEqual(data[1, 1, 1], 11) self.assertEqual(data[1, 1, 2], 12)
def test_xvg_3D(self): data = file_io.load_xvg('files/test_file_io/data_3D.xvg', dims=3) self.assertEqual(data.shape[0], 6) self.assertEqual(data.shape[1], 10) self.assertEqual(data.shape[2], 3)
F = -kX (kX to keep a particle at a specific distance from reference) Parameters -displacements - n_frames * n_particles * xyz -spring constant - force constant that keeps dummy particles in place. Gromacs units are k=kJ/(mol nm^2) Returns - forces - n_frames * n_particles * xyz - dimensional components of forces ''' return spring_constant * displacements if __name__ == '__main__': # testing prefix = '/home/kevin/hdd/Projects/software_validation/dummy_particles/flat_bilayer/dummy_3.6nm/' top_force = file_io.load_xvg(prefix + 'freeze/data/dummy_top_force.xvg', dims=3) dummy_ref = md.load(prefix + 'pos_res/dummy_ref.pdb') dummy_traj = md.load_xtc(prefix + 'pos_res/dummy_coords.xtc', top=prefix + 'pos_res/dummy_firstframe.pdb') dummy_ref_dims = dummy_ref.unitcell_lengths dummy_traj_dims = dummy_traj.unitcell_lengths a = calc_posres_forces(dummy_traj.xyz, dummy_ref.xyz, 1000, scaling=True, traj_dims=dummy_traj_dims, ref_dims=dummy_ref_dims)
def test_xvg_2D(self): data = file_io.load_xvg('files/testFileIO/data_2D.xvg', dims=2) self.assertEqual(data.shape[0], 6) self.assertEqual(data.shape[1], 10) self.assertEqual(data.shape[2], 2)