"platforms/brook/vscode:/vscode.git/clone" did not exist on "9936ec4659e9e91e7874992de4f2103bcd95a23b"
Commit 95711b88 authored by huangj's avatar huangj
Browse files

Add a test case for the colinear lonepair facility in CHARMM psf parser.

parent cbbc7911
......@@ -714,6 +714,7 @@ class CharmmPsfFile(object):
if atom.type is not None:
# This is the most reliable way of determining the element
atomic_num = atom.type.atomic_number
if atomic_num != 0:
elem = element.Element.getByAtomicNumber(atomic_num)
else:
# Figure it out from the mass
......@@ -911,6 +912,7 @@ class CharmmPsfFile(object):
bond.bond_type.req*length_conv)
# Add virtual sites
if hasattr(self, 'lonepair_list'):
if verbose: print('Adding lonepairs...')
for lpsite in self.lonepair_list:
index=lpsite[0]
......
......@@ -141,17 +141,20 @@ class TestCharmmFiles(unittest.TestCase):
warnings.filterwarnings('ignore', category=CharmmPSFWarning)
psf = CharmmPsfFile('systems/chlb_cgenff.psf')
crd = CharmmCrdFile('systems/chlb_cgenff.crd')
# move the position of the lonepair on Cholride
params = CharmmParameterSet('systems/par_all36_cgenff.prm',
'systems/top_all36_cgenff.rtf')
# Box dimensions (found from bounding box)
params = CharmmParameterSet('systems/top_all36_cgenff.rtf',
'systems/par_all36_cgenff.prm')
plat = Platform.getPlatformByName('Reference')
system = psf.createSystem(params, nonbondedMethod=PME,
nonbondedCutoff=8*angstroms)
system = psf.createSystem(params)
con = Context(system, VerletIntegrator(2*femtoseconds), plat)
con.setPositions(crd.positions)
init_coor = con.getState(getPositions=True).getPositions()
# move the position of the lonepair and recompute its coordinates
crd.positions[12] = Vec3(0.5, 1.0, 1.5) * angstrom
con.setPositions(crd.positions)
con.computeVirtualSites()
new_coor = con.getState(getPositions=True).getPositions()
self.assertEqual(init_coor, new_coor)
def test_InsCode(self):
""" Test the parsing of PSF files that contain insertion codes in their residue numbers """
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment