def test_inside(self): m = IMP.Model() atom = IMP.Particle(m) d = IMP.core.XYZ.setup_particle(atom) p = IMP.Particle(m) z_center = IMP.isd.Nuisance.setup_particle(p) z_center.set_nuisance(0.0) r = MembraneRestraintPrototype(m, z_center) r.add_particles_inside([atom]) r2 = IMP.pmi.MembraneRestraint( m, z_center.get_particle_index(), 30.0, 3.0, 0.0000000001, 0.02) r2.set_was_used(True) r2.add_particles_inside([atom.get_index()]) for z_c in range(-500, 500, 100): z_center.set_nuisance(z_c) for z in range(-500, 500, 10): IMP.core.XYZ(atom).set_z(z) self.assertAlmostEqual( r.unprotected_evaluate(None), r2.unprotected_evaluate(None), delta=1e-4)
def test_inside(self): m = IMP.Model() atom = IMP.Particle(m) d = IMP.core.XYZ.setup_particle(atom) p = IMP.Particle(m) z_center = IMP.isd.Nuisance.setup_particle(p) z_center.set_nuisance(0.0) r = MembraneRestraintPrototype(m, z_center) r.add_particles_inside([atom]) r2 = IMP.pmi.MembraneRestraint(m, z_center.get_particle_index(), 30.0, 3.0, 0.0000000001, 0.02) r2.set_was_used(True) r2.add_particles_inside([atom.get_index()]) for z_c in range(-500, 500, 100): z_center.set_nuisance(z_c) for z in range(-500, 500, 10): IMP.core.XYZ(atom).set_z(z) self.assertAlmostEqual(r.unprotected_evaluate(None), r2.unprotected_evaluate(None), delta=1e-4) self.assertEqual(r2.get_inputs(), [atom, z_center.get_particle()])