Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

I final

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information...
commit 82a60f0e99791cb629a71bc87b09fa234d8920e7 1 parent c2554bb
@gilleain gilleain authored egonw committed
View
122 src/main/org/openscience/cdk/atomtype/CDKAtomTypeMatcher.java
@@ -1172,64 +1172,8 @@ private IAtomType perceiveHalogens(IAtomContainer atomContainer, IAtom atom)
IAtomType type = getAtomType("F");
if (isAcceptable(atom, atomContainer, type)) return type;
}
- } else if ("I".equals(atom.getSymbol())) {
- if (hasOneSingleElectron(atomContainer, atom)) {
- if (atomContainer.getConnectedBondsCount(atom) == 0) {
- if (atom.getFormalCharge() != CDKConstants.UNSET &&
- atom.getFormalCharge() == +1) {
- IAtomType type = getAtomType("I.plus.radical");
- if (isAcceptable(atom, atomContainer, type)) return type;
- } else if (atom.getFormalCharge() == CDKConstants.UNSET ||
- atom.getFormalCharge() == 0) {
- IAtomType type = getAtomType("I.radical");
- if (isAcceptable(atom, atomContainer, type)) return type;
- }
- } else if (atomContainer.getConnectedBondsCount(atom) <= 1) {
- IBond.Order maxBondOrder = atomContainer.getMaximumBondOrder(atom);
- if (maxBondOrder == IBond.Order.SINGLE) {
- IAtomType type = getAtomType("I.plus.radical");
- if (isAcceptable(atom, atomContainer, type)) return type;
- }
- }
- return null;
- } else if (atom.getFormalCharge() != CDKConstants.UNSET &&
- atom.getFormalCharge() != 0) {
- if (atom.getFormalCharge() == -1) {
- if (atomContainer.getConnectedAtomsCount(atom) == 0) {
- IAtomType type = getAtomType("I.minus");
- if (isAcceptable(atom, atomContainer, type)) return type;
- } else {
- IAtomType type = getAtomType("I.minus.5");
- if (isAcceptable(atom, atomContainer, type)) return type;
- }
- } else if (atom.getFormalCharge() == 1) {
- IBond.Order maxBondOrder = atomContainer.getMaximumBondOrder(atom);
- if (maxBondOrder == IBond.Order.DOUBLE) {
- IAtomType type = getAtomType("I.plus.sp2");
- if (isAcceptable(atom, atomContainer, type)) return type;
- }else if (maxBondOrder == IBond.Order.SINGLE){
- IAtomType type = getAtomType("I.plus.sp3");
- if (isAcceptable(atom, atomContainer, type)) return type;
- }
- }
- } else if (atomContainer.getConnectedBondsCount(atom) == 3) {
- int doubleBondCount = countAttachedDoubleBonds(atomContainer, atom);
- if (doubleBondCount == 2) {
- IAtomType type = getAtomType("I.5");
- if (isAcceptable(atom, atomContainer, type)) return type;
- }
- } else if (atomContainer.getConnectedBondsCount(atom) == 2) {
- IBond.Order maxBondOrder = atomContainer.getMaximumBondOrder(atom);
- if (maxBondOrder == IBond.Order.DOUBLE) {
- IAtomType type = getAtomType("I.3");
- if (isAcceptable(atom, atomContainer, type)) return type;
- }
- } else if (atomContainer.getConnectedBondsCount(atom) == 1 ||
- atomContainer.getConnectedBondsCount(atom) == 0) {
- IAtomType type = getAtomType("I");
- if (isAcceptable(atom, atomContainer, type)) return type;
- }
}
+
return null;
}
private IAtomType perceiveArsenic(IAtomContainer atomContainer, IAtom atom) throws CDKException {
@@ -1616,6 +1560,70 @@ private IAtomType perceiveSodium(IAtomContainer atomContainer, IAtom atom) throw
}
return null;
}
+
+ private IAtomType perceiveIodine(IAtomContainer atomContainer, IAtom atom) throws CDKException {
+ if (hasOneSingleElectron(atomContainer, atom)) {
+ if (atomContainer.getConnectedBondsCount(atom) == 0) {
+ if (atom.getFormalCharge() != CDKConstants.UNSET &&
+ atom.getFormalCharge() == +1) {
+ IAtomType type = getAtomType("I.plus.radical");
+ if (isAcceptable(atom, atomContainer, type)) return type;
+ } else if (atom.getFormalCharge() == CDKConstants.UNSET ||
+ atom.getFormalCharge() == 0) {
+ IAtomType type = getAtomType("I.radical");
+ if (isAcceptable(atom, atomContainer, type)) return type;
+ }
+ } else if (atomContainer.getConnectedBondsCount(atom) <= 1) {
+ IBond.Order maxBondOrder = atomContainer.getMaximumBondOrder(atom);
+ if (maxBondOrder == IBond.Order.SINGLE) {
+ IAtomType type = getAtomType("I.plus.radical");
+ if (isAcceptable(atom, atomContainer, type)) return type;
+ }
+ }
+ return null;
+ } else if (atom.getFormalCharge() != CDKConstants.UNSET &&
+ atom.getFormalCharge() != 0) {
+ if (atom.getFormalCharge() == -1) {
+ if (atomContainer.getConnectedAtomsCount(atom) == 0) {
+ IAtomType type = getAtomType("I.minus");
+ if (isAcceptable(atom, atomContainer, type)) return type;
+ } else {
+ IAtomType type = getAtomType("I.minus.5");
+ if (isAcceptable(atom, atomContainer, type)) return type;
+ }
+ } else if (atom.getFormalCharge() == 1) {
+ IBond.Order maxBondOrder = atomContainer.getMaximumBondOrder(atom);
+ if (maxBondOrder == IBond.Order.DOUBLE) {
+ IAtomType type = getAtomType("I.plus.sp2");
+ if (isAcceptable(atom, atomContainer, type)) return type;
+ } else if (maxBondOrder == IBond.Order.SINGLE){
+ IAtomType type = getAtomType("I.plus.sp3");
+ if (isAcceptable(atom, atomContainer, type)) return type;
+ }
+ }
+ } else if (atomContainer.getConnectedBondsCount(atom) == 3) {
+ int doubleBondCount = countAttachedDoubleBonds(atomContainer, atom);
+ if (doubleBondCount == 2) {
+ IAtomType type = getAtomType("I.5");
+ if (isAcceptable(atom, atomContainer, type)) return type;
+ } else if (atom.getFormalCharge() != CDKConstants.UNSET
+ && atom.getFormalCharge() == 0) {
+ IAtomType type = getAtomType("I.sp3d2.3");
+ if (isAcceptable(atom, atomContainer, type)) return type;
+ }
+ } else if (atomContainer.getConnectedBondsCount(atom) == 2) {
+ IBond.Order maxBondOrder = atomContainer.getMaximumBondOrder(atom);
+ if (maxBondOrder == IBond.Order.DOUBLE) {
+ IAtomType type = getAtomType("I.3");
+ if (isAcceptable(atom, atomContainer, type)) return type;
+ }
+ } else if (atomContainer.getConnectedBondsCount(atom) == 1 ||
+ atomContainer.getConnectedBondsCount(atom) == 0) {
+ IAtomType type = getAtomType("I");
+ if (isAcceptable(atom, atomContainer, type)) return type;
+ }
+ return null;
+ }
private int countAttachedDoubleBonds(IAtomContainer container, IAtom atom) {
return countAttachedDoubleBonds(container, atom, null);
View
9 src/main/org/openscience/cdk/dict/data/cdk-atom-types.owl
@@ -1000,6 +1000,15 @@
<at:hybridization rdf:resource="&at;sp3"/>
</at:AtomType>
+ <at:AtomType rdf:ID="I.sp3d2.3">
+ <at:formalCharge>0</at:formalCharge>
+ <at:hasElement rdf:resource="&elem;I"/>
+ <at:formalNeighbourCount>3</at:formalNeighbourCount>
+ <at:lonePairCount>2</at:lonePairCount>
+ <at:piBondCount>0</at:piBondCount>
+ <at:hybridization rdf:resource="&at;sp3d2"/>
+ </at:AtomType>
+
<at:AtomType rdf:ID="Br">
<at:formalCharge>0</at:formalCharge>
<at:hasElement rdf:resource="&elem;Br"/>
View
29 src/test/org/openscience/cdk/atomtype/CDKAtomTypeMatcherTest.java
@@ -3517,6 +3517,35 @@ public void testPentaMethylPhosphane() throws Exception {
};
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
}
+
+
+ @Test
+ public void test_I_sp3d2_3() throws Exception {
+ IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
+ IMolecule mol = builder.newInstance(IMolecule.class);
+ IAtom a1 = builder.newInstance(IAtom.class,"I");
+ a1.setFormalCharge(0);
+ mol.addAtom(a1);
+ IAtom a2 = builder.newInstance(IAtom.class,"C");
+ a2.setFormalCharge(0);
+ mol.addAtom(a2);
+ IAtom a3 = builder.newInstance(IAtom.class,"C");
+ a3.setFormalCharge(0);
+ mol.addAtom(a3);
+ IAtom a4 = builder.newInstance(IAtom.class,"C");
+ a4.setFormalCharge(0);
+ mol.addAtom(a4);
+ IBond b1 = builder.newInstance(IBond.class,a1, a2, IBond.Order.SINGLE);
+ mol.addBond(b1);
+ IBond b2 = builder.newInstance(IBond.class,a1, a3, IBond.Order.SINGLE);
+ mol.addBond(b2);
+ IBond b3 = builder.newInstance(IBond.class,a1, a4, IBond.Order.SINGLE);
+ mol.addBond(b3);
+
+
+ String[] expectedTypes = {"I.sp3d2.3", "C.sp3", "C.sp3", "C.sp3"};
+ assertAtomTypes(testedAtomTypes, expectedTypes, mol);
+ }
@Test public void testForDuplicateDefinitions() {
super.testForDuplicateDefinitions();
Please sign in to comment.
Something went wrong with that request. Please try again.