def test_modify_topology(self, ethane_system_topology): my_ommp = Ommperator(ethane_system_topology[0], ethane_system_topology[1]) residues = [*ethane_system_topology[1].residues()] ethane_system_topology[1].addAtom('added', None, residues[0]) my_ommp.populate_ommperator() assert len(my_ommp.atoms) == 9
def test_clear_ommperator(self, ethane_system_topology): my_ommp = Ommperator(ethane_system_topology[0], ethane_system_topology[1]) my_ommp.clear_ommperator() assert not hasattr('self', 'atoms') assert not hasattr('self', 'bonds') assert not hasattr('self', 'angles') assert not hasattr('self', 'dihedrals') assert not hasattr('self', 'nonbonds') assert not hasattr('self', 'custom_bonds') assert not hasattr('self', 'custom_nonbonds')
def test_modify_omm(self, ethane_system_topology): periodic_torsion = openmm.PeriodicTorsionForce() periodic_torsion.addTorsion(0, 1, 2, 3, 10, 20, 30) my_ommp = Ommperator(ethane_system_topology[0], ethane_system_topology[1]) my_dih_ommp = PeriodicTorsionForceOmmperator(my_ommp, periodic_torsion, 0) periodic_torsion.setTorsionParameters(0, 1, 2, 3, 4, 20, 30, 40) assert my_dih_ommp.particle1 == periodic_torsion.getTorsionParameters( 0)[0] assert my_dih_ommp.particle1 == 1 assert my_dih_ommp.particle2 == periodic_torsion.getTorsionParameters( 0)[1] assert my_dih_ommp.particle2 == 2 assert my_dih_ommp.particle3 == periodic_torsion.getTorsionParameters( 0)[2] assert my_dih_ommp.particle3 == 3 assert my_dih_ommp.particle4 == periodic_torsion.getTorsionParameters( 0)[3] assert my_dih_ommp.particle4 == 4 assert my_dih_ommp.n == periodic_torsion.getTorsionParameters(0)[4] assert my_dih_ommp.phase == periodic_torsion.getTorsionParameters(0)[5] assert my_dih_ommp.k == periodic_torsion.getTorsionParameters(0)[6]
def test_setting(self, ethane_system_topology): nb_force = openmm.NonbondedForce() nb_force.addParticle(1, 2, 3) my_ommp = Ommperator(ethane_system_topology[0], ethane_system_topology[1]) my_nb_ommp = NonbondedForceOmmperator(my_ommp, nb_force, 0) my_nb_ommp.charge = 10*unit.elementary_charge my_nb_ommp.sigma = 20*unit.nanometer my_nb_ommp.epsilon = 30*unit.kilojoule_per_mole assert my_nb_ommp.charge == nb_force.getParticleParameters(0)[0] assert my_nb_ommp.sigma == nb_force.getParticleParameters(0)[1] assert my_nb_ommp.epsilon == nb_force.getParticleParameters(0)[2] assert is_close(my_nb_ommp.charge, 10*unit.elementary_charge) assert is_close(my_nb_ommp.sigma, 20*unit.nanometer) assert is_close(my_nb_ommp.epsilon, 30*unit.kilojoule_per_mole) my_nb_ommp.set_params(charge=100*unit.elementary_charge, sigma=200*unit.nanometer, epsilon=300*unit.kilojoule_per_mole) assert my_nb_ommp.charge == nb_force.getParticleParameters(0)[0] assert my_nb_ommp.sigma == nb_force.getParticleParameters(0)[1] assert my_nb_ommp.epsilon == nb_force.getParticleParameters(0)[2] assert is_close(my_nb_ommp.charge, 100*unit.elementary_charge) assert is_close(my_nb_ommp.sigma, 200*unit.nanometer) assert is_close(my_nb_ommp.epsilon, 300*unit.kilojoule_per_mole)
def test_setting(self, ethane_system_topology): harmonic_bond = openmm.HarmonicBondForce() harmonic_bond.addBond(0, 1, 10, 20) my_ommp = Ommperator(ethane_system_topology[0], ethane_system_topology[1]) my_bond_ommp = HarmonicBondForceOmmperator(my_ommp, harmonic_bond, 0) my_bond_ommp.particle1 = 5 my_bond_ommp.particle2 = 6 my_bond_ommp.k = 100 my_bond_ommp.length = 200 assert my_bond_ommp.particle1 == harmonic_bond.getBondParameters(0)[0] assert my_bond_ommp.particle1 == 5 assert my_bond_ommp.particle2 == harmonic_bond.getBondParameters(0)[1] assert my_bond_ommp.particle2 == 6 assert my_bond_ommp.length == harmonic_bond.getBondParameters(0)[2] assert my_bond_ommp.k == harmonic_bond.getBondParameters(0)[3] my_bond_ommp.set_params(p1=100, p2=200, k=300, length=400) assert my_bond_ommp.particle1 == harmonic_bond.getBondParameters(0)[0] assert my_bond_ommp.particle1 == 100 assert my_bond_ommp.particle2 == harmonic_bond.getBondParameters(0)[1] assert my_bond_ommp.particle2 == 200 assert my_bond_ommp.length == harmonic_bond.getBondParameters(0)[2] assert my_bond_ommp.k == harmonic_bond.getBondParameters(0)[3]
def test_update_kwarg(self, geometric_ethane_system_topology): my_ommp = Ommperator(geometric_ethane_system_topology[0], geometric_ethane_system_topology[1]) my_ommp.custom_nonbond_types['opls_135'].update(sigma=5 * unit.nanometer) param_index = my_ommp.custom_nonbonds[0].parameter_index['sigma'] for nonbond in my_ommp.custom_nonbond_types['opls_135']: assert nonbond.parameters[param_index] == 5
def test_setting(self, ethane_system_topology): rb_torsion = openmm.RBTorsionForce() rb_torsion.addTorsion(0, 1, 2, 3, 10, 20, 30, 40, 50, 60) my_ommp = Ommperator(ethane_system_topology[0], ethane_system_topology[1]) my_dih_ommp = RBTorsionForceOmmperator(my_ommp, rb_torsion, 0) my_dih_ommp.particle1 = 10 my_dih_ommp.particle2 = 20 my_dih_ommp.particle3 = 30 my_dih_ommp.particle4 = 40 my_dih_ommp.c0 = 100 my_dih_ommp.c1 = 200 my_dih_ommp.c2 = 300 my_dih_ommp.c3 = 400 my_dih_ommp.c4 = 500 my_dih_ommp.c5 = 600 assert my_dih_ommp.particle1 == rb_torsion.getTorsionParameters(0)[0] assert my_dih_ommp.particle1 == 10 assert my_dih_ommp.particle2 == rb_torsion.getTorsionParameters(0)[1] assert my_dih_ommp.particle2 == 20 assert my_dih_ommp.particle3 == rb_torsion.getTorsionParameters(0)[2] assert my_dih_ommp.particle3 == 30 assert my_dih_ommp.particle4 == rb_torsion.getTorsionParameters(0)[3] assert my_dih_ommp.particle4 == 40 assert my_dih_ommp.c0 == rb_torsion.getTorsionParameters(0)[4] assert my_dih_ommp.c1 == rb_torsion.getTorsionParameters(0)[5] assert my_dih_ommp.c2 == rb_torsion.getTorsionParameters(0)[6] assert my_dih_ommp.c3 == rb_torsion.getTorsionParameters(0)[7] assert my_dih_ommp.c4 == rb_torsion.getTorsionParameters(0)[8] assert my_dih_ommp.c5 == rb_torsion.getTorsionParameters(0)[9] my_dih_ommp.set_params(p1=100, p2=200, p3=300, p4=400, c0=1000, c1=2000, c2=3000, c3=4000, c4=5000, c5=6000) assert my_dih_ommp.particle1 == rb_torsion.getTorsionParameters(0)[0] assert my_dih_ommp.particle1 == 100 assert my_dih_ommp.particle2 == rb_torsion.getTorsionParameters(0)[1] assert my_dih_ommp.particle2 == 200 assert my_dih_ommp.particle3 == rb_torsion.getTorsionParameters(0)[2] assert my_dih_ommp.particle3 == 300 assert my_dih_ommp.particle4 == rb_torsion.getTorsionParameters(0)[3] assert my_dih_ommp.particle4 == 400 assert my_dih_ommp.c0 == rb_torsion.getTorsionParameters(0)[4] assert my_dih_ommp.c1 == rb_torsion.getTorsionParameters(0)[5] assert my_dih_ommp.c2 == rb_torsion.getTorsionParameters(0)[6] assert my_dih_ommp.c3 == rb_torsion.getTorsionParameters(0)[7] assert my_dih_ommp.c4 == rb_torsion.getTorsionParameters(0)[8] assert my_dih_ommp.c5 == rb_torsion.getTorsionParameters(0)[9]
def test_update_arg(self, geometric_ethane_system_topology): my_ommp = Ommperator(geometric_ethane_system_topology[0], geometric_ethane_system_topology[1]) my_ommp.custom_nonbond_types['opls_135'].update( 10 * unit.kilojoule_per_mole, 5 * unit.nanometer) sigma_index = my_ommp.custom_nonbonds[0].parameter_index['sigma'] epsilon_index = my_ommp.custom_nonbonds[0].parameter_index['epsilon'] for nonbond in my_ommp.custom_nonbond_types['opls_135']: assert nonbond.parameters[sigma_index] == 5 assert nonbond.parameters[epsilon_index] == 10
def test_parsing(self, ethane_system_topology): harmonic_bond = openmm.HarmonicBondForce() harmonic_bond.addBond(0, 1, 10, 20) my_ommp = Ommperator(ethane_system_topology[0], ethane_system_topology[1]) my_bond_ommp = HarmonicBondForceOmmperator(my_ommp, harmonic_bond, 0) assert my_bond_ommp.particle1 == harmonic_bond.getBondParameters(0)[0] assert my_bond_ommp.particle2 == harmonic_bond.getBondParameters(0)[1] assert my_bond_ommp.length == harmonic_bond.getBondParameters(0)[2] assert my_bond_ommp.k == harmonic_bond.getBondParameters(0)[3]
def test_parsing(self, ethane_system_topology): custom_bond = openmm.CustomBondForce('a+b*r') custom_bond.addPerBondParameter('a') custom_bond.addPerBondParameter('b') custom_bond.addBond(0, 1, (10, 20)) my_ommp = Ommperator(ethane_system_topology[0], ethane_system_topology[1]) my_bond_ommp = CustomBondForceOmmperator(my_ommp, custom_bond, 0) assert my_bond_ommp.particle1 == custom_bond.getBondParameters(0)[0] assert my_bond_ommp.particle2 == custom_bond.getBondParameters(0)[1] assert my_bond_ommp.parameters == custom_bond.getBondParameters(0)[2]
def test_setting(self, ethane_system_topology): periodic_torsion = openmm.PeriodicTorsionForce() periodic_torsion.addTorsion(0, 1, 2, 3, 10, 20, 30) my_ommp = Ommperator(ethane_system_topology[0], ethane_system_topology[1]) my_dih_ommp = PeriodicTorsionForceOmmperator(my_ommp, periodic_torsion, 0) my_dih_ommp.particle1 = 10 my_dih_ommp.particle2 = 20 my_dih_ommp.particle3 = 30 my_dih_ommp.particle4 = 40 my_dih_ommp.n == 50 my_dih_ommp.phase == 60 my_dih_ommp.k == 70 assert my_dih_ommp.particle1 == periodic_torsion.getTorsionParameters( 0)[0] assert my_dih_ommp.particle1 == 10 assert my_dih_ommp.particle2 == periodic_torsion.getTorsionParameters( 0)[1] assert my_dih_ommp.particle2 == 20 assert my_dih_ommp.particle3 == periodic_torsion.getTorsionParameters( 0)[2] assert my_dih_ommp.particle3 == 30 assert my_dih_ommp.particle4 == periodic_torsion.getTorsionParameters( 0)[3] assert my_dih_ommp.particle4 == 40 assert my_dih_ommp.n == periodic_torsion.getTorsionParameters(0)[4] assert my_dih_ommp.phase == periodic_torsion.getTorsionParameters(0)[5] assert my_dih_ommp.k == periodic_torsion.getTorsionParameters(0)[6] my_dih_ommp.set_params(p1=100, p2=200, p3=300, p4=400, n=500, phase=600, k=700) assert my_dih_ommp.particle1 == periodic_torsion.getTorsionParameters( 0)[0] assert my_dih_ommp.particle1 == 100 assert my_dih_ommp.particle2 == periodic_torsion.getTorsionParameters( 0)[1] assert my_dih_ommp.particle2 == 200 assert my_dih_ommp.particle3 == periodic_torsion.getTorsionParameters( 0)[2] assert my_dih_ommp.particle3 == 300 assert my_dih_ommp.particle4 == periodic_torsion.getTorsionParameters( 0)[3] assert my_dih_ommp.particle4 == 400 assert my_dih_ommp.n == periodic_torsion.getTorsionParameters(0)[4] assert my_dih_ommp.phase == periodic_torsion.getTorsionParameters(0)[5] assert my_dih_ommp.k == periodic_torsion.getTorsionParameters(0)[6]
def test_setting(self, geometric_ethane_system_topology): nb_force = openmm.CustomNonbondedForce('epsilon1*epsilon2*(sigr6^2-sigr6); sigr6=sigr2*sigr2*sigr2; ' 'sigr2=(sigc/r)^2; sigc=sigma1*sigma2') nb_force.addPerParticleParameter('epsilon') nb_force.addPerParticleParameter('sigma') nb_force.addParticle((1*unit.kilojoule_per_mole, 2*unit.nanometer)) my_ommp = Ommperator(geometric_ethane_system_topology[0], geometric_ethane_system_topology[1]) my_nb_ommp = CustomNonbondedForceOmmperator(my_ommp, nb_force, 0) my_nb_ommp.set_params(10*unit.kilojoule_per_mole, -1) assert my_nb_ommp.parameters == nb_force.getParticleParameters(0) assert my_nb_ommp.parameters[0] == 10 assert my_nb_ommp.parameters[1] == 2 my_nb_ommp.set_params(-1, 20*unit.nanometer) assert my_nb_ommp.parameters == nb_force.getParticleParameters(0) assert my_nb_ommp.parameters[0] == 10 assert my_nb_ommp.parameters[1] == 20 my_nb_ommp.set_params(epsilon=100*unit.kilojoule_per_mole) assert my_nb_ommp.parameters == nb_force.getParticleParameters(0) assert my_nb_ommp.parameters[0] == 100 assert my_nb_ommp.parameters[1] == 20 my_nb_ommp.set_params(sigma=200*unit.nanometer) assert my_nb_ommp.parameters == nb_force.getParticleParameters(0) assert my_nb_ommp.parameters[0] == 100 assert my_nb_ommp.parameters[1] == 200 my_nb_ommp.set_params(1000*unit.kilojoule_per_mole, 2000*unit.nanometer) assert my_nb_ommp.parameters == nb_force.getParticleParameters(0) assert my_nb_ommp.parameters[0] == 1000 assert my_nb_ommp.parameters[1] == 2000 my_nb_ommp.set_params(epsilon=10000*unit.kilojoule_per_mole, sigma=20000*unit.nanometer) assert my_nb_ommp.parameters == nb_force.getParticleParameters(0) assert my_nb_ommp.parameters[0] == 10000 assert my_nb_ommp.parameters[1] == 20000 with pytest.raises(ValueError): my_nb_ommp.set_params(1,2,epsilon=3, sigma=4)
def test_parsing(self, ethane_system_topology): my_ommp = Ommperator(ethane_system_topology[0], ethane_system_topology[1]) assert len(my_ommp.atoms) == 8 assert len(my_ommp.bonds) == 7 assert len(my_ommp.angles) == 12 assert len(my_ommp.dihedrals) == 9 assert len(my_ommp.nonbonds) == 8 assert len(my_ommp.bond_types) == 2 assert len(my_ommp.angle_types) == 2 assert len(my_ommp.dihedral_types) == 1 assert len(my_ommp.nonbond_types) == 2
def test_parsing(self, geometric_ethane_system_topology): nb_force = openmm.CustomNonbondedForce('epsilon1*epsilon2*(sigr6^2-sigr6); sigr6=sigr2*sigr2*sigr2; ' 'sigr2=(sigc/r)^2; sigc=sigma1*sigma2') nb_force.addPerParticleParameter('epsilon') nb_force.addPerParticleParameter('sigma') nb_force.addParticle((1*unit.kilojoule_per_mole, 2*unit.nanometer)) my_ommp = Ommperator(geometric_ethane_system_topology[0], geometric_ethane_system_topology[1]) my_nb_ommp = CustomNonbondedForceOmmperator(my_ommp, nb_force, 0) assert my_nb_ommp.parameters == nb_force.getParticleParameters(0) assert my_nb_ommp.energy_function == nb_force.getEnergyFunction() assert my_nb_ommp.parameter_index['epsilon'] == 0 assert my_nb_ommp.parameter_index['sigma'] == 1
def test_parsing(self, ethane_system_topology): harmonic_Angle = openmm.HarmonicAngleForce() harmonic_Angle.addAngle(0, 1, 2, 10, 20) my_ommp = Ommperator(ethane_system_topology[0], ethane_system_topology[1]) my_Angle_ommp = HarmonicAngleForceOmmperator(my_ommp, harmonic_Angle, 0) assert my_Angle_ommp.particle1 == harmonic_Angle.getAngleParameters( 0)[0] assert my_Angle_ommp.particle2 == harmonic_Angle.getAngleParameters( 0)[1] assert my_Angle_ommp.particle3 == harmonic_Angle.getAngleParameters( 0)[2] assert my_Angle_ommp.angle == harmonic_Angle.getAngleParameters(0)[3] assert my_Angle_ommp.k == harmonic_Angle.getAngleParameters(0)[4]
def test_modify_omm(self, geometric_ethane_system_topology): nb_force = openmm.CustomNonbondedForce('epsilon1*epsilon2*(sigr6^2-sigr6); sigr6=sigr2*sigr2*sigr2; ' 'sigr2=(sigc/r)^2; sigc=sigma1*sigma2') nb_force.addPerParticleParameter('epsilon') nb_force.addPerParticleParameter('sigma') nb_force.addParticle((1*unit.kilojoule_per_mole, 2*unit.nanometer)) nb_force.setParticleParameters(0, (10*unit.kilojoule_per_mole, 20*unit.nanometer)) my_ommp = Ommperator(geometric_ethane_system_topology[0], geometric_ethane_system_topology[1]) my_nb_ommp = CustomNonbondedForceOmmperator(my_ommp, nb_force, 0) assert my_nb_ommp.parameters == nb_force.getParticleParameters(0) assert my_nb_ommp.parameters[0] == 10 assert my_nb_ommp.parameters[1] == 20
def test_parsing(self, ethane_system_topology): rb_torsion = openmm.RBTorsionForce() rb_torsion.addTorsion(0, 1, 2, 3, 10, 20, 30, 40, 50, 60) my_ommp = Ommperator(ethane_system_topology[0], ethane_system_topology[1]) my_dih_ommp = RBTorsionForceOmmperator(my_ommp, rb_torsion, 0) assert my_dih_ommp.particle1 == rb_torsion.getTorsionParameters(0)[0] assert my_dih_ommp.particle2 == rb_torsion.getTorsionParameters(0)[1] assert my_dih_ommp.particle3 == rb_torsion.getTorsionParameters(0)[2] assert my_dih_ommp.particle4 == rb_torsion.getTorsionParameters(0)[3] assert my_dih_ommp.c0 == rb_torsion.getTorsionParameters(0)[4] assert my_dih_ommp.c1 == rb_torsion.getTorsionParameters(0)[5] assert my_dih_ommp.c2 == rb_torsion.getTorsionParameters(0)[6] assert my_dih_ommp.c3 == rb_torsion.getTorsionParameters(0)[7] assert my_dih_ommp.c4 == rb_torsion.getTorsionParameters(0)[8] assert my_dih_ommp.c5 == rb_torsion.getTorsionParameters(0)[9]
def test_setting(self, ethane_system_topology): harmonic_Angle = openmm.HarmonicAngleForce() harmonic_Angle.addAngle(0, 1, 2, 10, 20) my_ommp = Ommperator(ethane_system_topology[0], ethane_system_topology[1]) my_Angle_ommp = HarmonicAngleForceOmmperator(my_ommp, harmonic_Angle, 0) my_Angle_ommp.particle1 = 5 my_Angle_ommp.particle2 = 6 my_Angle_ommp.particle3 = 7 my_Angle_ommp.angle = 100 my_Angle_ommp.length = 200 assert my_Angle_ommp.particle1 == harmonic_Angle.getAngleParameters( 0)[0] assert my_Angle_ommp.particle1 == 5 assert my_Angle_ommp.particle2 == harmonic_Angle.getAngleParameters( 0)[1] assert my_Angle_ommp.particle2 == 6 assert my_Angle_ommp.particle3 == harmonic_Angle.getAngleParameters( 0)[2] assert my_Angle_ommp.particle3 == 7 assert my_Angle_ommp.angle == harmonic_Angle.getAngleParameters(0)[3] assert my_Angle_ommp.k == harmonic_Angle.getAngleParameters(0)[4] my_Angle_ommp.set_params(p1=100, p2=200, p3=800, k=300, angle=400) assert my_Angle_ommp.particle1 == harmonic_Angle.getAngleParameters( 0)[0] assert my_Angle_ommp.particle1 == 100 assert my_Angle_ommp.particle2 == harmonic_Angle.getAngleParameters( 0)[1] assert my_Angle_ommp.particle2 == 200 assert my_Angle_ommp.particle3 == harmonic_Angle.getAngleParameters( 0)[2] assert my_Angle_ommp.particle3 == 800 assert my_Angle_ommp.angle == harmonic_Angle.getAngleParameters(0)[3] assert my_Angle_ommp.k == harmonic_Angle.getAngleParameters(0)[4]
def test_setting(self, ethane_system_topology): custom_bond = openmm.CustomBondForce('a+b*r') custom_bond.addPerBondParameter('a') custom_bond.addPerBondParameter('b') custom_bond.addBond(0, 1, (10, 20)) my_ommp = Ommperator(ethane_system_topology[0], ethane_system_topology[1]) my_bond_ommp = CustomBondForceOmmperator(my_ommp, custom_bond, 0) my_bond_ommp.particle1 = 2 assert my_bond_ommp.particle1 == custom_bond.getBondParameters(0)[0] assert my_bond_ommp.particle1 == 2 assert my_bond_ommp.particle2 == custom_bond.getBondParameters(0)[1] assert my_bond_ommp.particle2 == 1 assert my_bond_ommp.parameters == custom_bond.getBondParameters(0)[2] my_bond_ommp.particle2 = 3 assert my_bond_ommp.particle1 == custom_bond.getBondParameters(0)[0] assert my_bond_ommp.particle1 == 2 assert my_bond_ommp.particle2 == custom_bond.getBondParameters(0)[1] assert my_bond_ommp.particle2 == 3 assert my_bond_ommp.parameters == custom_bond.getBondParameters(0)[2] my_bond_ommp.set_params(100, -1) assert my_bond_ommp.particle1 == custom_bond.getBondParameters(0)[0] assert my_bond_ommp.particle1 == 2 assert my_bond_ommp.particle2 == custom_bond.getBondParameters(0)[1] assert my_bond_ommp.particle2 == 3 assert my_bond_ommp.parameters == custom_bond.getBondParameters(0)[2] assert my_bond_ommp.parameters[0] == 100 assert my_bond_ommp.parameters[1] == 20 my_bond_ommp.set_params(-1, 200) assert my_bond_ommp.particle1 == custom_bond.getBondParameters(0)[0] assert my_bond_ommp.particle1 == 2 assert my_bond_ommp.particle2 == custom_bond.getBondParameters(0)[1] assert my_bond_ommp.particle2 == 3 assert my_bond_ommp.parameters == custom_bond.getBondParameters(0)[2] assert my_bond_ommp.parameters[0] == 100 assert my_bond_ommp.parameters[1] == 200 my_bond_ommp.set_params(1000, 2000) assert my_bond_ommp.particle1 == custom_bond.getBondParameters(0)[0] assert my_bond_ommp.particle1 == 2 assert my_bond_ommp.particle2 == custom_bond.getBondParameters(0)[1] assert my_bond_ommp.particle2 == 3 assert my_bond_ommp.parameters == custom_bond.getBondParameters(0)[2] assert my_bond_ommp.parameters[0] == 1000 assert my_bond_ommp.parameters[1] == 2000 my_bond_ommp.set_params(a=10) assert my_bond_ommp.particle1 == custom_bond.getBondParameters(0)[0] assert my_bond_ommp.particle1 == 2 assert my_bond_ommp.particle2 == custom_bond.getBondParameters(0)[1] assert my_bond_ommp.particle2 == 3 assert my_bond_ommp.parameters == custom_bond.getBondParameters(0)[2] assert my_bond_ommp.parameters[0] == 10 assert my_bond_ommp.parameters[1] == 2000 my_bond_ommp.set_params(b=20) assert my_bond_ommp.particle1 == custom_bond.getBondParameters(0)[0] assert my_bond_ommp.particle1 == 2 assert my_bond_ommp.particle2 == custom_bond.getBondParameters(0)[1] assert my_bond_ommp.particle2 == 3 assert my_bond_ommp.parameters == custom_bond.getBondParameters(0)[2] assert my_bond_ommp.parameters[0] == 10 assert my_bond_ommp.parameters[1] == 20 my_bond_ommp.set_params(a=100, b=200) assert my_bond_ommp.particle1 == custom_bond.getBondParameters(0)[0] assert my_bond_ommp.particle1 == 2 assert my_bond_ommp.particle2 == custom_bond.getBondParameters(0)[1] assert my_bond_ommp.particle2 == 3 assert my_bond_ommp.parameters == custom_bond.getBondParameters(0)[2] assert my_bond_ommp.parameters[0] == 100 assert my_bond_ommp.parameters[1] == 200 with pytest.raises(ValueError): my_bond_ommp.set_params(100, 200, a=100, b=200)
def test_update_kwarg(self, ethane_system_topology): my_ommp = Ommperator(ethane_system_topology[0], ethane_system_topology[1]) my_ommp.nonbond_types['opls_135'].update(sigma=5 * unit.nanometer) for nonbond in my_ommp.nonbond_types['opls_135']: assert nonbond.sigma == 5 * unit.nanometer