Permalink
Browse files

Added the Co(3+) atom type (fixes #3093644)

Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
  • Loading branch information...
egonw authored and rajarshi committed Mar 5, 2011
1 parent 851c1a6 commit c368c3d66e7af96c67197a93bde0ae59923ed11d
@@ -1223,6 +1223,10 @@ private IAtomType perceiveCommonSalts(IAtomContainer atomContainer, IAtom atom)
atom.getFormalCharge() == +2)) {
IAtomType type = getAtomType("Co.2plus");
if (isAcceptable(atom, atomContainer, type)) return type;
+ } else if ((atom.getFormalCharge() != CDKConstants.UNSET &&
+ atom.getFormalCharge() == +3)) {
+ IAtomType type = getAtomType("Co.3plus");
+ if (isAcceptable(atom, atomContainer, type)) return type;
} else if ((atom.getFormalCharge() == CDKConstants.UNSET ||
atom.getFormalCharge() == 0)) {
IAtomType type = getAtomType("Co.metallic");
@@ -1209,6 +1209,13 @@
<at:piBondCount>0</at:piBondCount>
</at:AtomType>
+ <at:AtomType rdf:ID="Co.3plus">
+ <at:formalCharge>3</at:formalCharge>
+ <at:hasElement rdf:resource="&elem;Co"/>
+ <at:formalNeighbourCount>0</at:formalNeighbourCount>
+ <at:piBondCount>0</at:piBondCount>
+ </at:AtomType>
+
<at:AtomType rdf:ID="Co.metallic">
<at:formalCharge>0</at:formalCharge>
<at:hasElement rdf:resource="&elem;Co"/>
@@ -108,7 +108,24 @@
Assert.assertNotNull(type.getAtomTypeName());
}
}
-
+
+ /**
+ * @cdk.bug 3093644
+ */
+ @Test public void testBug3093644() throws Exception {
+ String smiles1 =
+ "[H]C5(CCC(N)=O)(C=1N=C(C=C4N=C(C(C)=C3[N-]C(C)(C2N=C(C=1(C))C(C)" +
+ "(CCC(=O)NCC(C)O)C2([H])(CC(N)=O))C(C)(CC(N)=O)C3([H])(CCC(N)=O))" +
+ "C(C)(CC(N)=O)C4([H])(CCC(N)=O))C5(C)(C)).[H][C-]([H])C3([H])(OC([H])" +
+ "(N2C=NC=1C(N)=NC=NC=12)C([H])(O)C3([H])(O)).[Co+3]";
+
+ IMolecule mol1 = smilesParser.parseSmiles(smiles1);
+ IAtomType[] types1 = atomTypeMatcher.findMatchingAtomType(mol1);
+ for (IAtomType type : types1) {
+ Assert.assertNotNull(type.getAtomTypeName());
+ }
+ }
+
@Test public void testPlatinum4() throws Exception {
String smiles1 = "Cl[Pt]1(Cl)(Cl)(Cl)NC2CCCCC2N1";
@@ -1,7 +1,5 @@
-/* $Revision$ $Author$ $Date$
- *
- * Copyright (C) 2007 Egon Willighagen <egonw@users.sf.net>
- * 2007 Rajarshi Guha
+/* Copyright (C) 2007-2011 Egon Willighagen <egonw@users.sf.net>
+ * 2007 Rajarshi Guha
*
* Contact: cdk-devel@lists.sourceforge.net
*
@@ -1553,6 +1551,13 @@ public void testTetrahydropyran() throws Exception {
expectedTypes = new String[]{"Co.2plus"};
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
+ mol = new Molecule();
+ atom = new Atom("Co");
+ atom.setFormalCharge(+3);
+ mol.addAtom(atom);
+ expectedTypes = new String[]{"Co.3plus"};
+ assertAtomTypes(testedAtomTypes, expectedTypes, mol);
+
mol = new Molecule();
atom = new Atom("Cu");
atom.setFormalCharge(+2);

0 comments on commit c368c3d

Please sign in to comment.