Skip to content

Commit

Permalink
Put the smallest rings in a field so we can reuse from the bond gener…
Browse files Browse the repository at this point in the history
…ator.
  • Loading branch information
johnmay committed Jul 28, 2019
1 parent 8c6dd38 commit 3005b1c
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemObject;
import org.openscience.cdk.interfaces.IRingSet;
import org.openscience.cdk.renderer.RendererModel;
import org.openscience.cdk.renderer.elements.ElementGroup;
Expand All @@ -53,6 +52,9 @@ final class StandardDonutGenerator {
private final Set<IBond> bonds = new HashSet<>();
// atoms with delocalised charge
private final Set<IAtom> atoms = new HashSet<>();
// smallest rings through each edge
IRingSet smallest;

private final boolean forceDelocalised;
private final boolean delocalisedDonuts;
private final double dbSpacing;
Expand Down Expand Up @@ -91,8 +93,8 @@ IRenderingElement generate() {
if (!delocalisedDonuts)
return null;
ElementGroup group = new ElementGroup();
IRingSet rset = Cycles.edgeShort(mol).toRingSet();
for (IAtomContainer ring : rset.atomContainers()) {
smallest = Cycles.edgeShort(mol).toRingSet();
for (IAtomContainer ring : smallest.atomContainers()) {
if (!canDelocalise(ring))
continue;
for (IBond bond : ring.bonds()) {
Expand Down

0 comments on commit 3005b1c

Please sign in to comment.