Skip to content

Commit

Permalink
Removed spurious constraints not part of a ring
Browse files Browse the repository at this point in the history
  • Loading branch information
tbereau committed May 13, 2015
1 parent a1b6bdb commit 1d8a9b9
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion auto_martini
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,15 @@ def findBeadPos(mol, feats, ringAtoms):
if partneri == partnerj:
acceptableTrial = False
break
if acceptableTrial:
# Don't accept single atom off a ring
for bi in xrange(len(trialComb)):
for r in ringAtomsFlat:
bond = mol.GetBondBetweenAtoms(trialComb[bi], r)
if bond is not None and \
len(mol.GetAtomWithIdx(trialComb[bi]).GetBonds()) == 1:
acceptableTrial = False
break
if acceptableTrial:
# Do the energy evaluation
trialEne = evalGaussianInterac(mol, trialComb, ringAtomsFlat)
Expand Down Expand Up @@ -973,14 +982,20 @@ def printBonds(cgBeads, mol, cgBeadCoords,ringAtoms, trial=False):
if not constExists:
dist = np.linalg.norm(cgBeadCoords[i]-cgBeadCoords[j])*0.1
if dist < 0.35:
# Are atoms part of the same ring
inRing = False
for ring in ringAtoms:
if cgBeads[i] in ring and cgBeads[j] in ring:
inRing = True
break
# Check that it's not in the bond list
inBondList = False
for b in bondList:
if (b[0] == i and b[1] == j) or \
(b[0] == j and b[0] == i):
inBondList = True
break
if not inBondList:
if not inBondList and inRing:
constList.append([i,j,dist])

if trial == False:
Expand Down

0 comments on commit 1d8a9b9

Please sign in to comment.