Skip to content

Commit

Permalink
B final
Browse files Browse the repository at this point in the history
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
gilleain authored and egonw committed Aug 28, 2011
1 parent 517dd0c commit e159e5b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/org/openscience/cdk/atomtype/CDKAtomTypeMatcher.java
Expand Up @@ -238,6 +238,10 @@ private IAtomType perceiveBorons(IAtomContainer atomContainer, IAtom atom)
atomContainer.getConnectedAtomsCount(atom) <= 4) {
IAtomType type = getAtomType("B.minus");
if (isAcceptable(atom, atomContainer, type)) return type;
} else if (atom.getFormalCharge() == +3
&& atomContainer.getConnectedAtomsCount(atom) == 4) {
IAtomType type = getAtomType("B.3plus");
if (isAcceptable(atom, atomContainer, type)) return type;
} else if (atomContainer.getConnectedAtomsCount(atom) <= 3) {
IAtomType type = getAtomType("B");
if (isAcceptable(atom, atomContainer, type)) return type;
Expand Down
9 changes: 9 additions & 0 deletions src/main/org/openscience/cdk/dict/data/cdk-atom-types.owl
Expand Up @@ -1792,6 +1792,15 @@
<at:piBondCount>0</at:piBondCount>
<at:hybridization rdf:resource="&at;sp3"/>
</at:AtomType>

<at:AtomType rdf:ID="B.3plus">
<at:formalCharge>3</at:formalCharge>
<at:hasElement rdf:resource="&elem;B"/>
<at:formalNeighbourCount>4</at:formalNeighbourCount>
<at:lonePairCount>0</at:lonePairCount>
<at:piBondCount>0</at:piBondCount>
<at:hybridization rdf:resource="&at;sp3"/>
</at:AtomType>

<at:AtomType rdf:ID="Rb.plus">
<at:formalCharge>1</at:formalCharge>
Expand Down
34 changes: 34 additions & 0 deletions src/test/org/openscience/cdk/atomtype/CDKAtomTypeMatcherTest.java
Expand Up @@ -3646,6 +3646,40 @@ public void testPentaMethylPhosphane() throws Exception {
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
}


@Test
public void test_B_3plus() throws Exception {
IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
IMolecule mol = builder.newInstance(IMolecule.class);
IAtom a1 = builder.newInstance(IAtom.class,"B");
a1.setFormalCharge(3);
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);
IAtom a5 = builder.newInstance(IAtom.class,"C");
a5.setFormalCharge(0);
mol.addAtom(a5);
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);
IBond b4 = builder.newInstance(IBond.class,a1, a5, IBond.Order.SINGLE);
mol.addBond(b4);


String[] expectedTypes = {"B.3plus", "C.sp3", "C.sp3", "C.sp3", "C.sp3"};
assertAtomTypes(testedAtomTypes, expectedTypes, mol);
}

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

0 comments on commit e159e5b

Please sign in to comment.