def test_calcbox_all(self): cb = CalcBox(name="testbox", pos=(0., 0., 0.), dim=(self._edge + 5, self._edge + 5, self._edge + 5)) sa, srmap, sw = cb.select_atoms(self._atoms) ra = self._atoms self.assertEqual(ra, sa)
def test_calcbox_subset(self): cb = CalcBox(name="testbox", pos=(0., 0., 0.), cutoff=0.0, dim=(50.0, 50.0, 50.0)) sa, srmap, sw = cb.select_atoms(self._atoms) correct_ids = set([307, 215, 405, 280, 281, 410, 155, 156, 285, 286, 415, 160, 289, 290, 419, 165, 294, 455, 430, 432, 305, 306, 435, 180, 414, 310, 439, 312, 185, 186, 315, 188, 190, 181, 193, 343, 161, 457, 330, 311, 332, 205, 462, 335, 337, 210, 340, 213, 313, 218, 314, 465, 444, 338, 437, 440, 318, 319, 460]) self.assertEqual(set(Mixer.get_atom_ids(sa)), correct_ids)
def test_calcbox_subset(self): cb = CalcBox(name="testbox", pos=(0., 0., 0.), cutoff=0.0, dim=(50.0, 50.0, 50.0)) sa, srmap, sw = cb.select_atoms(self._atoms) correct_ids = set([ 307, 215, 405, 280, 281, 410, 155, 156, 285, 286, 415, 160, 289, 290, 419, 165, 294, 455, 430, 432, 305, 306, 435, 180, 414, 310, 439, 312, 185, 186, 315, 188, 190, 181, 193, 343, 161, 457, 330, 311, 332, 205, 462, 335, 337, 210, 340, 213, 313, 218, 314, 465, 444, 338, 437, 440, 318, 319, 460 ]) self.assertEqual(set(Mixer.get_atom_ids(sa)), correct_ids)
def test_calcbox_moving_ch4(self): cb = CalcBox(name="testbox", pos=(0., 0., 0.), cutoff=2.0, dim=(55.0, 55.0, 55.0), debug=0) ch4 = [0, 1, 2, 3] # these are atoms indexes and ids z = np.linspace(-self._edge / 2.0 - 25, self._edge / 2.0 + 25, 100) x = np.zeros_like(z) y = np.zeros_like(z) pos = np.column_stack((x, y, z)) for i in range(len(pos)): self._set_molecule_pos(self._atoms, ch4, pos[i]) sa, srmap, sw = cb.select_atoms(self._atoms) s_ids = set(Mixer.get_atom_ids(sa)) all_ids = set(Mixer.get_atom_ids(self._atoms)) inside_ids = s_ids.intersection(set(ch4)) if not (len(inside_ids) == 0 or len(inside_ids) == 4): print("CH4 pos: %s" % pos[i]) print("CH4 in selection: %s" % inside_ids)
def test_calcbox_moving_ch4(self): cb = CalcBox(name="testbox", pos=(0., 0., 0.), cutoff=2.0, dim=(55.0, 55.0, 55.0), debug=0) ch4 = [0, 1, 2, 3] # these are atoms indexes and ids z = np.linspace(-self._edge/2.0 - 25, self._edge/2.0 + 25, 100) x = np.zeros_like(z) y = np.zeros_like(z) pos = np.column_stack((x, y, z)) for i in range(len(pos)): self._set_molecule_pos(self._atoms, ch4, pos[i]) sa, srmap, sw = cb.select_atoms(self._atoms) s_ids = set(Mixer.get_atom_ids(sa)) all_ids = set(Mixer.get_atom_ids(self._atoms)) inside_ids = s_ids.intersection(set(ch4)) if not (len(inside_ids) == 0 or len(inside_ids) == 4): print("CH4 pos: %s" % pos[i]) print("CH4 in selection: %s" % inside_ids)