Skip to content

Commit

Permalink
Atom typing not longer automatically applied.
Browse files Browse the repository at this point in the history
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
johnmay authored and egonw committed Oct 2, 2013
1 parent c7459c1 commit 9cd2740
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/test/org/openscience/cdk/smiles/SmilesParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
*/
package org.openscience.cdk.smiles;

import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import org.junit.Assert;
import org.junit.Assume;
Expand Down Expand Up @@ -1430,6 +1432,7 @@ public void testBug1783546() throws Exception {
@org.junit.Test public void bug1872969() throws Exception {
String smiles = "CS(=O)(=O)[O-].[Na+]";
IAtomContainer mol = sp.parseSmiles(smiles);
atomtype(mol);
for (int i=0; i<6; i++) {
Assert.assertNotNull(mol.getAtom(i).getAtomTypeName());
}
Expand Down Expand Up @@ -2380,6 +2383,18 @@ private int countAromaticBonds(IAtomContainer mol) {
return aromCount;
}

static void atomtype(IAtomContainer container) throws Exception {
Set<IAtom> aromatic = new HashSet<IAtom>();
for (IAtom atom : container.atoms()) {
if (atom.getFlag(CDKConstants.ISAROMATIC))
aromatic.add(atom);
}
// helpfully clears aromatic flags...
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(container);
for (IAtom atom : aromatic)
atom.setFlag(CDKConstants.ISAROMATIC, true);
}

static IAtomContainer load(String smi) throws InvalidSmilesException {
return new SmilesParser(SilentChemObjectBuilder.getInstance()).parseSmiles(smi);
}
Expand Down

0 comments on commit 9cd2740

Please sign in to comment.