returnf'The residue matches {bestMatches[0]}, but the set of externally bonded atoms {formatDiffMessage(templatesExtBondDiffs[bestMatches[0]],formatAtomDiff)}.'
# If we have matches at this point, atoms and bonds match perfectly, so the
# connectivity must be different. If bestMatches is empty, something else
# went wrong, so return a generic error message.
# Accept this as our new best match.
ifbestMatches:
returnf'The atoms and bonds in the residue match {bestMatches[0]}, but the connectivity is different.'
return'The set of atoms is similar to %s, but it is missing %d extra particles. You can add them with Modeller.addExtraParticles().'%(bestMatchName,numBestMatchAtoms-numResidueAtoms)
return'The set of atoms is similar to %s, but it is missing %d atoms.'%(bestMatchName,numBestMatchAtoms-numResidueAtoms)
return'This might mean your input topology is missing some atoms or bonds, or possibly that you are using the wrong force field.'
return'This might mean your input topology is missing some atoms or bonds, or possibly that you are using the wrong force field.'
withself.assertRaisesRegex(ValueError,"No template found for residue.*GLY.*The set of atoms is similar to GLY, but is missing 1 C atom"):
makeSystem(pdbLines[:8]+pdbLines[9:])
# Add an He atom to GLY.
withself.assertRaisesRegex(ValueError,"No template found for residue.*GLY.*The set of atoms is similar to GLY, but has 1 He atom extra"):
makeSystem(pdbLines[:9]+[
"ATOM 19 X1 GLY A 2 0 0 0 He",
]+pdbLines[9:])
# Delete CA atom from GLY and add an He atom.
withself.assertRaisesRegex(ValueError,"No template found for residue.*GLY.*The set of atoms is similar to GLY, but is missing 1 C atom and has 1 He atom extra"):
makeSystem(pdbLines[:8]+[
"ATOM 19 X1 GLY A 2 0 0 0 He",
]+pdbLines[9:])
# Add 1 He atom, 2 Li atoms, and 1 Be atom to GLY.
withself.assertRaisesRegex(ValueError,"No template found for residue.*GLY.*The set of atoms is similar to GLY, but has 1 He atom, 2 Li atoms, and 1 Be atom extra"):
makeSystem(pdbLines[:9]+[
"ATOM 19 X1 GLY A 2 0 0 0 He",
"ATOM 20 X2 GLY A 2 0 0 0 Li",
"ATOM 21 X3 GLY A 2 0 0 0 Li",
"ATOM 22 X4 GLY A 2 0 0 0 Be",
]+pdbLines[9:])
# Add a virtual site to GLY.
withself.assertRaisesRegex(ValueError,"No template found for residue.*GLY.*The set of heavy atoms matches GLY, but the residue has 1 site extra"):
makeSystem(pdbLines[:9]+[
"ATOM 19 X1 GLY A 2 0 0 0 EP",
]+pdbLines[9:])
# Delete HA3 atom from GLY.
withself.assertRaisesRegex(ValueError,"No template found for residue.*GLY.*The set of heavy atoms matches GLY, but the residue is missing 1 H atom"):
makeSystem(pdbLines[:10]+pdbLines[11:])
# Delete HA3 atom from GLY and add a virtual site.
withself.assertRaisesRegex(ValueError,"No template found for residue.*GLY.*The set of heavy atoms matches GLY, but the residue is missing 1 H atom and has 1 site extra"):
makeSystem(pdbLines[:10]+[
"ATOM 19 X1 GLY A 2 0 0 0 EP",
]+pdbLines[11:])
# Rename HA3 atom to remove the CA-HA3 bond.
withself.assertRaisesRegex(ValueError,"No template found for residue.*GLY.*The set of atoms matches GLY, but the residue is missing 1 H-C bond"):
makeSystem(pdbLines[:10]+[
"ATOM 10 X1 GLY A 2 0 0 0 H",
]+pdbLines[11:])
# Add an extra N-O bond.
withself.assertRaisesRegex(ValueError,"No template found for residue.*GLY.*The set of atoms matches GLY, but the residue has 1 N-O bond extra"):
makeSystem(pdbLines+[
"CONECT 6 12"
])
# Remove an external bond to NME by renaming its N atom.
withself.assertRaisesRegex(ValueError,"No template found for residue.*GLY.*The residue matches GLY, but the set of externally bonded atoms is missing 1 C atom"):
makeSystem(pdbLines[:13]+[
"ATOM 13 X1 NME A 3 0 0 0 N",
]+pdbLines[14:])
# Add an extra external bond to NME.
withself.assertRaisesRegex(ValueError,"No template found for residue.*GLY.*The residue matches GLY, but the set of externally bonded atoms has 1 O atom extra"):
makeSystem(pdbLines+[
"CONECT 12 15"
])
deftest_Wildcard(self):
deftest_Wildcard(self):
"""Test that PeriodicTorsionForces using wildcard ('') for atom types / classes in the ffxml are correctly registered"""
"""Test that PeriodicTorsionForces using wildcard ('') for atom types / classes in the ffxml are correctly registered"""