def test_distance_crit_non_periodic(self): dc = pair_criteria.DistanceCriterion(cut_off=0.1) # Non-periodic system. Particles out of range self.es.periodicity = (0, 0, 0) self.assertTrue(not dc.decide(self.p1, self.p2)) self.assertTrue(not dc.decide(self.p1.id, self.p2.id))
def test_distance_crit_periodic(self): dc = pair_criteria.DistanceCriterion(cut_off=0.1) # Interface self.assertEqual(list(dc.get_params().keys()), ["cut_off", ]) self.assertTrue(abs(dc.get_params()["cut_off"] - 0.1) < self.epsilon) # Decisions # Periodic system. Particles in range via minimum image convention self.es.periodicity = (1, 1, 1) self.assertTrue(dc.decide(self.p1, self.p2)) self.assertTrue(dc.decide(self.p1.id, self.p2.id))