Skip to content

Commit

Permalink
Added the missing S.2minus atom type for selenide
Browse files Browse the repository at this point in the history
Change-Id: Ia53e8e981b471f9cb77ed022cd46581092fe01a5
Signed-off-by: John May <john.wilkinsonmay@gmail.com>
  • Loading branch information
egonw committed Oct 30, 2012
1 parent 23e26b9 commit b7d2ae6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/org/openscience/cdk/atomtype/CDKAtomTypeMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ private IAtomType perceiveSelenium(IAtomContainer atomContainer, IAtom atom) thr
&& atomContainer.getConnectedAtomsCount(atom) == 3) {
IAtomType type = getAtomType("Se.plus.3");
if (isAcceptable(atom, atomContainer, type)) return type;
} else if ((atom.getFormalCharge() != CDKConstants.UNSET && atom.getFormalCharge() == -2)
&& atomContainer.getConnectedAtomsCount(atom) == 0) {
IAtomType type = getAtomType("Se.2minus");
if (isAcceptable(atom, atomContainer, type)) return type;
}
}
return null;
Expand Down
8 changes: 8 additions & 0 deletions src/main/org/openscience/cdk/dict/data/cdk-atom-types.owl
Original file line number Diff line number Diff line change
Expand Up @@ -2158,6 +2158,14 @@
<at:lonePairCount>0</at:lonePairCount>
</at:AtomType>

<at:AtomType rdf:ID="Se.2minus">
<at:formalCharge>-2</at:formalCharge>
<at:hasElement rdf:resource="&elem;Se"/>
<at:formalNeighbourCount>0</at:formalNeighbourCount>
<at:lonePairCount>4</at:lonePairCount>
<at:piBondCount>0</at:piBondCount>
</at:AtomType>

<at:AtomType rdf:ID="Se.plus.3">
<at:formalCharge>1</at:formalCharge>
<at:hasElement rdf:resource="&elem;Se"/>
Expand Down
11 changes: 11 additions & 0 deletions src/test/org/openscience/cdk/atomtype/CDKAtomTypeMatcherTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,17 @@ public void testTetrahydropyran() throws Exception {
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
}

@Test public void testSelenide() throws Exception {
IMolecule mol = DefaultChemObjectBuilder.getInstance().newInstance(IMolecule.class);
IAtom se = DefaultChemObjectBuilder.getInstance().newInstance(IAtom.class,"Se");
se.setImplicitHydrogenCount(0);
se.setFormalCharge(-2);
mol.addAtom(se);

String[] expectedTypes = {"Se.2minus"};
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
}

@Test public void testH2S_Hybridization() throws Exception {
IAtomContainer mol = DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class);
IAtom s = DefaultChemObjectBuilder.getInstance().newInstance(IAtom.class,"S");
Expand Down

0 comments on commit b7d2ae6

Please sign in to comment.