Skip to content

Commit

Permalink
Fallback to placing across a bond with only one atom in the end point…
Browse files Browse the repository at this point in the history
…s. Also only increment begIter when we have a bond to place it on.
  • Loading branch information
johnmay committed Nov 30, 2015
1 parent cc52feb commit bf8ae70
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -1788,11 +1788,18 @@ private void placePositionalVariation(IAtomContainer mol) {
shared.addAtom(atom);
Point2d center = GeometryUtil.get2DCenter(shared);

// first priority bonds between selected atoms
for (IBond bond : mol.bonds()) {
if (e.getKey().contains(bond.getAtom(0)) && e.getKey().contains(bond.getAtom(1))) {
bonds.add(bond);
}
}
// second priority bonds adjacent to one of the atoms
for (IBond bond : mol.bonds()) {
if (e.getKey().contains(bond.getAtom(0)) || e.getKey().contains(bond.getAtom(1))) {
bonds.add(bond);
}
}

if (bonds.size() >= e.getValue().size()) {

Expand All @@ -1802,11 +1809,12 @@ private void placePositionalVariation(IAtomContainer mol) {
while (begIter.hasNext() && bndIter.hasNext()) {

final IBond bond = bndIter.next();
final IAtom atom = begIter.next();

if (numRingBonds(mol, bond.getAtom(0)) > 2 && numRingBonds(mol, bond.getAtom(1)) > 2)
continue;

final IAtom atom = begIter.next();

final Point2d newBegP = new Point2d(bond.getAtom(0).getPoint2d());
final Point2d newEndP = new Point2d(bond.getAtom(1).getPoint2d());

Expand Down

0 comments on commit bf8ae70

Please sign in to comment.