Unverified Commit a6545a1b authored by Evan Pretti's avatar Evan Pretti Committed by GitHub
Browse files

Fix two issues with virtual site handling: (#4812)

* In CharmmPsfFile, add lonepair exceptions even when no Drude particles
  are present

* In ForceField, correctly update the indices of virtual site exclusion
  reference particles in a residue when applying a patch to it
parent 452506eb
...@@ -1410,12 +1410,12 @@ class CharmmPsfFile(object): ...@@ -1410,12 +1410,12 @@ class CharmmPsfFile(object):
idxa = pair[1] idxa = pair[1]
parent_exclude_list[idx].append(idxa) parent_exclude_list[idx].append(idxa)
force.addException(idx, idxa, 0.0, 0.1, 0.0) force.addException(idx, idxa, 0.0, 0.1, 0.0)
# If lonepairs and Drude particles are bonded to the same parent atom, add exception # If lonepairs and Drude particles are bonded to the same parent atom, add exception
for excludeterm in parent_exclude_list: for excludeterm in parent_exclude_list:
if(len(excludeterm) >= 2): if(len(excludeterm) >= 2):
for i in range(len(excludeterm)): for i in range(len(excludeterm)):
for j in range(i): for j in range(i):
force.addException(excludeterm[j], excludeterm[i], 0.0, 0.1, 0.0) force.addException(excludeterm[j], excludeterm[i], 0.0, 0.1, 0.0)
# Exclude 1-2 and 1-3 pairs as well as the lonepair/Drude attached onto them # Exclude 1-2 and 1-3 pairs as well as the lonepair/Drude attached onto them
if nbxmod > 1: if nbxmod > 1:
for ia1, ia2 in self.pair_12_list: for ia1, ia2 in self.pair_12_list:
......
...@@ -871,6 +871,7 @@ class ForceField(object): ...@@ -871,6 +871,7 @@ class ForceField(object):
newSite = deepcopy(site) newSite = deepcopy(site)
newSite.index = indexMap[site.index] newSite.index = indexMap[site.index]
newSite.atoms = [indexMap[i] for i in site.atoms] newSite.atoms = [indexMap[i] for i in site.atoms]
newSite.excludeWith = indexMap[site.excludeWith]
newTemplate.virtualSites.append(newSite) newTemplate.virtualSites.append(newSite)
# Build the lists of bonds and external bonds. # Build the lists of bonds and external bonds.
......
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