Skip to content

Commit

Permalink
Fixes #265
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay committed Aug 22, 2017
1 parent 5851070 commit 9f5ec19
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Expand Up @@ -387,6 +387,11 @@ private void label(final ITetrahedralChirality element) {
p *= indexParity(i); // implicit H, adjust parity
} else {
bonds[n] = container.getBond(focus, atoms[i]);
if (bonds[n] == null)
throw new IllegalArgumentException("Inconsistent stereo,"
+ " tetrahedral centre"
+ " contained atom not"
+ " stored in molecule");
atoms[n] = atoms[i];
n++;
}
Expand Down
Expand Up @@ -668,6 +668,17 @@ public void atropisomerWedgeBonds() throws CDKException {

}

@Test(expected = IllegalArgumentException.class)
public void inconsistentStereoState() throws CDKException {
final String smi = "O[C@]([H])(C)CCC";
SmilesParser smipar = new SmilesParser(SilentChemObjectBuilder.getInstance());
IAtomContainer mol = smipar.parseSmiles(smi);
mol.removeBond(1);
mol.removeAtomOnly(2); // unsafe-removes
StructureDiagramGenerator sdg = new StructureDiagramGenerator();
sdg.generateCoordinates(mol);
}

static IAtom atom(String symbol, int hCount, double x, double y) {
IAtom a = new Atom(symbol);
a.setImplicitHydrogenCount(hCount);
Expand Down

0 comments on commit 9f5ec19

Please sign in to comment.