Skip to content

Commit

Permalink
Pass through afix/bfix when laying out sub fragments/salts.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay committed Jun 7, 2016
1 parent b77a127 commit 1e430a1
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -825,13 +825,21 @@ private void generateFragmentCoordinates(IAtomContainer mol, List<IAtomContainer
List<double[]> limits = new ArrayList<>();
final int numFragments = frags.size();

// avoid overwriting our state
Set<IAtom> afixbackup = new HashSet<>(afix);
Set<IBond> bfixbackup = new HashSet<>(bfix);

// generate the sub-layouts
for (IAtomContainer fragment : frags) {
setMolecule(fragment, false);
setMolecule(fragment, false, afix, bfix);
generateCoordinates(DEFAULT_BOND_VECTOR, true, true);
limits.add(GeometryUtil.getMinMax(fragment));
}

// restore
afix = afixbackup;
bfix = bfixbackup;

final int nRow = (int) Math.floor(Math.sqrt(numFragments));
final int nCol = (int) Math.ceil(numFragments / (double) nRow);

Expand Down

0 comments on commit 1e430a1

Please sign in to comment.