Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Pu final
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
gilleain authored and egonw committed Aug 7, 2011
1 parent c684298 commit 0eebd74
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/org/openscience/cdk/atomtype/CDKAtomTypeMatcher.java
Expand Up @@ -135,6 +135,8 @@ public IAtomType findMatchingAtomType(IAtomContainer atomContainer, IAtom atom)
type = perceiveGallium(atomContainer, atom);
} else if ("Ge".equals(atom.getSymbol())) {
type = perceiveGermanium(atomContainer, atom);
} else if ("Pu".equals(atom.getSymbol())) {
type = perceivePlutonium(atomContainer, atom);
} else if ("Th".equals(atom.getSymbol())) {
type = perceiveThorium(atomContainer, atom);
} else if ("K".equals(atom.getSymbol())) {
Expand Down Expand Up @@ -1667,6 +1669,14 @@ private IAtomType perceivePotassium(IAtomContainer atomContainer, IAtom atom) th
}
return null;
}

private IAtomType perceivePlutonium(IAtomContainer atomContainer, IAtom atom) throws CDKException {
if (atom.getFormalCharge() == 0 && atomContainer.getConnectedBondsCount(atom) == 0) {
IAtomType type = getAtomType("Pu");
if (isAcceptable(atom, atomContainer, type)) return type;
}
return null;
}

private int countAttachedDoubleBonds(IAtomContainer container, IAtom atom) {
return countAttachedDoubleBonds(container, atom, null);
Expand Down
7 changes: 7 additions & 0 deletions src/main/org/openscience/cdk/dict/data/cdk-atom-types.owl
Expand Up @@ -1663,4 +1663,11 @@
<at:hybridization rdf:resource="&at;sp2"/>
</at:AtomType>

<at:AtomType rdf:ID="Pu">
<at:formalCharge>0</at:formalCharge>
<at:hasElement rdf:resource="&elem;Pu"/>
<at:formalNeighbourCount>0</at:formalNeighbourCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

</rdf:RDF>
13 changes: 13 additions & 0 deletions src/test/org/openscience/cdk/atomtype/CDKAtomTypeMatcherTest.java
Expand Up @@ -3689,6 +3689,19 @@ public void testMethylphosphinicAcid() throws Exception {
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
}

@Test
public void test_Pu() throws Exception {
IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
IMolecule mol = builder.newInstance(IMolecule.class);
IAtom a1 = builder.newInstance(IAtom.class,"Pu");
a1.setFormalCharge(0);
mol.addAtom(a1);


String[] expectedTypes = {"Pu"};
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
}

@Test
public void test_Th() throws Exception {
IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
Expand Down

0 comments on commit 0eebd74

Please sign in to comment.