Skip to content

Commit

Permalink
addExtraParticles() handles LocalCoordinatesSites with more than thre…
Browse files Browse the repository at this point in the history
…e particles (openmm#4293)
  • Loading branch information
peastman authored Nov 2, 2023
1 parent 726544f commit 8c87b26
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wrappers/python/openmm/app/modeller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,9 +1183,9 @@ def addExtraParticles(self, forcefield, ignoreExternalBonds=False, residueTempla
cross = Vec3(v1[1]*v2[2]-v1[2]*v2[1], v1[2]*v2[0]-v1[0]*v2[2], v1[0]*v2[1]-v1[1]*v2[0])
position = templateAtomPositions[site.atoms[0]] + site.weights[0]*v1 + site.weights[1]*v2 + site.weights[2]*cross
elif site.type == 'localCoords':
origin = templateAtomPositions[site.atoms[0]]*site.originWeights[0] + templateAtomPositions[site.atoms[1]]*site.originWeights[1] + templateAtomPositions[site.atoms[2]]*site.originWeights[2];
xdir = templateAtomPositions[site.atoms[0]]*site.xWeights[0] + templateAtomPositions[site.atoms[1]]*site.xWeights[1] + templateAtomPositions[site.atoms[2]]*site.xWeights[2];
ydir = templateAtomPositions[site.atoms[0]]*site.yWeights[0] + templateAtomPositions[site.atoms[1]]*site.yWeights[1] + templateAtomPositions[site.atoms[2]]*site.yWeights[2];
origin = unit.sum([templateAtomPositions[atom]*weight for atom, weight in zip(site.atoms, site.originWeights)])
xdir = unit.sum([templateAtomPositions[atom]*weight for atom, weight in zip(site.atoms, site.xWeights)])
ydir = unit.sum([templateAtomPositions[atom]*weight for atom, weight in zip(site.atoms, site.yWeights)])
zdir = Vec3(xdir[1]*ydir[2]-xdir[2]*ydir[1], xdir[2]*ydir[0]-xdir[0]*ydir[2], xdir[0]*ydir[1]-xdir[1]*ydir[0])
xdir /= norm(xdir);
zdir /= norm(zdir);
Expand Down

0 comments on commit 8c87b26

Please sign in to comment.