Skip to content

Commit

Permalink
Added reading of the single electron counts for the CDK atom types
Browse files Browse the repository at this point in the history
Change-Id: Id2c434e7ff61a54040e1f76d3df879be251efef5
Signed-off-by: ngn <jeliazkova.nina@gmail.com>
  • Loading branch information
egonw committed May 19, 2012
1 parent 403ac57 commit cf897ab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/org/openscience/cdk/CDKConstants.java
Expand Up @@ -314,6 +314,9 @@ public class CDKConstants {
/** Used as property key for indicating the HOSE code for a certain atom type. */
public static final String LONE_PAIR_COUNT = "cdk:Lone Pair Count";

/** Used as property key for indicating the number of single electrons on the atom type. */
public static final String SINGLE_ELECTRON_COUNT = "cdk:Lone Pair Count";

}


Expand Up @@ -101,6 +101,8 @@ private void endAtomTypeElement(String local) {
currentAtomType.setFormalNeighbourCount(Integer.parseInt(currentChars));
} else if ("lonePairCount".equals(local)) {
currentAtomType.setProperty(CDKConstants.LONE_PAIR_COUNT, Integer.parseInt(currentChars));
} else if ("singleElectronCount".equals(local)) {
currentAtomType.setProperty(CDKConstants.SINGLE_ELECTRON_COUNT, Integer.parseInt(currentChars));
} else if ("piBondCount".equals(local)) {
currentAtomType.setProperty(CDKConstants.PI_BOND_COUNT, Integer.parseInt(currentChars));
}
Expand Down
Expand Up @@ -59,6 +59,7 @@ public class OWLAtomTypeReaderTest extends CDKTestCase {
" <at:lonePairCount>0</at:lonePairCount>" +
" <at:formalNeighbourCount>4</at:formalNeighbourCount>" +
" <at:piBondCount>0</at:piBondCount>" +
" <at:singleElectronCount>0</at:singleElectronCount>" +
" </at:AtomType>" +
"</rdf:RDF>";

Expand Down Expand Up @@ -103,6 +104,7 @@ public void testReadAtomTypes_CDK() {
Assert.assertEquals(4, atomType.getFormalNeighbourCount().intValue());
Assert.assertEquals(0, atomType.getProperty(CDKConstants.LONE_PAIR_COUNT));
Assert.assertEquals(0, atomType.getProperty(CDKConstants.PI_BOND_COUNT));
Assert.assertEquals(0, atomType.getProperty(CDKConstants.SINGLE_ELECTRON_COUNT));
}

}

0 comments on commit cf897ab

Please sign in to comment.