def test_single_term_proper_torsion(self): """ Test creation and serialization of a single-term proper torsion """ from simtk import unit p1 = ProperTorsionHandler.ProperTorsionType( smirks='[*:1]-[*:2]-[*:3]-[*:4]', phase1=30 * unit.degree, periodicity1=2, k1=5 * unit.kilocalorie_per_mole) param_dict = p1.to_dict() assert ('k1', 5 * unit.kilocalorie_per_mole) in param_dict.items() assert ('phase1', 30 * unit.degree) in param_dict.items() assert ('periodicity1', 2) in param_dict.items() assert 'idivf' not in param_dict
def test_multi_term_proper_torsion_skip_index(self): """ Test creation and serialization of a multi-term proper torsion where the indices are not consecutive and a SMIRNOFFSpecError is raised """ from simtk import unit with pytest.raises(SMIRNOFFSpecError, match="Unexpected kwarg (phase3: 31 deg)*") as context: p1 = ProperTorsionHandler.ProperTorsionType(smirks='[*:1]-[*:2]-[*:3]-[*:4]', phase1=30 * unit.degree, periodicity1=2, k1=5 * unit.kilocalorie_per_mole, phase3=31 * unit.degree, periodicity3=3, k3=6 * unit.kilocalorie_per_mole, )
def test_multi_term_proper_torsion_bad_units(self): """ Test creation and serialization of a multi-term proper torsion where one of the terms has incorrect units """ from simtk import unit with pytest.raises(IncompatibleUnitError, match="should have units of")\ as context: p1 = ProperTorsionHandler.ProperTorsionType(smirks='[*:1]-[*:2]-[*:3]-[*:4]', phase1=30 * unit.degree, periodicity1=2, k1=5 * unit.kilocalorie_per_mole, phase2=31 * unit.angstrom, # This should be caught periodicity2=3, k2=6 * unit.kilocalorie_per_mole, )
def test_multi_term_proper_torsion(self): """ Test creation and serialization of a multi-term proper torsion """ from simtk import unit p1 = ProperTorsionHandler.ProperTorsionType(smirks='[*:1]-[*:2]-[*:3]-[*:4]', phase1=30 * unit.degree, periodicity1=2, k1=5 * unit.kilocalorie_per_mole, phase2=31 * unit.degree, periodicity2=3, k2=6 * unit.kilocalorie_per_mole, ) param_dict = p1.to_dict() assert param_dict['k1'] == 5 * unit.kilocalorie_per_mole assert param_dict['phase1'] == 30 * unit.degree assert param_dict['periodicity1'] == 2 assert param_dict['k2'] == 6 * unit.kilocalorie_per_mole assert param_dict['phase2'] == 31 * unit.degree assert param_dict['periodicity2'] == 3