Search in sources :

Example 96 with AtomContainer

use of org.openscience.cdk.AtomContainer in project cdk by cdk.

the class ChiChainDescriptorTest method testDan80.

@Test
public void testDan80() throws Exception {
    IAtomContainer mol = new AtomContainer();
    IAtom a1 = mol.getBuilder().newInstance(IAtom.class, "C");
    a1.setPoint2d(new Point2d(0.0, 1.5));
    mol.addAtom(a1);
    IAtom a2 = mol.getBuilder().newInstance(IAtom.class, "C");
    a2.setPoint2d(new Point2d(0.0, 0.0));
    mol.addAtom(a2);
    IAtom a3 = mol.getBuilder().newInstance(IAtom.class, "C");
    a3.setPoint2d(new Point2d(-1.4265847744427305, -0.46352549156242084));
    mol.addAtom(a3);
    IAtom a4 = mol.getBuilder().newInstance(IAtom.class, "C");
    a4.setPoint2d(new Point2d(-2.3082626528814396, 0.7500000000000002));
    mol.addAtom(a4);
    IAtom a5 = mol.getBuilder().newInstance(IAtom.class, "O");
    a5.setPoint2d(new Point2d(-1.42658477444273, 1.9635254915624212));
    mol.addAtom(a5);
    IBond b1 = mol.getBuilder().newInstance(IBond.class, a2, a1, IBond.Order.DOUBLE);
    mol.addBond(b1);
    IBond b2 = mol.getBuilder().newInstance(IBond.class, a3, a2, IBond.Order.SINGLE);
    mol.addBond(b2);
    IBond b3 = mol.getBuilder().newInstance(IBond.class, a4, a3, IBond.Order.DOUBLE);
    mol.addBond(b3);
    IBond b4 = mol.getBuilder().newInstance(IBond.class, a5, a4, IBond.Order.SINGLE);
    mol.addBond(b4);
    IBond b5 = mol.getBuilder().newInstance(IBond.class, a5, a1, IBond.Order.SINGLE);
    mol.addBond(b5);
    DoubleArrayResult ret = (DoubleArrayResult) descriptor.calculate(mol).getValue();
    Assert.assertEquals(0.0000, ret.get(0), 0.0001);
    Assert.assertEquals(0.0000, ret.get(1), 0.0001);
    Assert.assertEquals(0.1768, ret.get(2), 0.0001);
    Assert.assertEquals(0.0000, ret.get(3), 0.0001);
    Assert.assertEquals(0.0000, ret.get(5), 0.0001);
    Assert.assertEquals(0.0000, ret.get(6), 0.0001);
    Assert.assertEquals(0.04536, ret.get(7), 0.00001);
    Assert.assertEquals(0.0000, ret.get(8), 0.0001);
}
Also used : IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) AtomContainer(org.openscience.cdk.AtomContainer) Point2d(javax.vecmath.Point2d) IBond(org.openscience.cdk.interfaces.IBond) DoubleArrayResult(org.openscience.cdk.qsar.result.DoubleArrayResult) IAtom(org.openscience.cdk.interfaces.IAtom) Test(org.junit.Test)

Example 97 with AtomContainer

use of org.openscience.cdk.AtomContainer in project cdk by cdk.

the class ChiChainDescriptorTest method testDan82.

@Test
public void testDan82() throws Exception {
    IAtomContainer mol = new AtomContainer();
    IAtom a1 = mol.getBuilder().newInstance(IAtom.class, "C");
    a1.setPoint2d(new Point2d(0.0, 1.5));
    mol.addAtom(a1);
    IAtom a2 = mol.getBuilder().newInstance(IAtom.class, "C");
    a2.setPoint2d(new Point2d(0.0, 0.0));
    mol.addAtom(a2);
    IAtom a3 = mol.getBuilder().newInstance(IAtom.class, "C");
    a3.setPoint2d(new Point2d(-1.4265847744427305, -0.46352549156242084));
    mol.addAtom(a3);
    IAtom a4 = mol.getBuilder().newInstance(IAtom.class, "C");
    a4.setPoint2d(new Point2d(-2.3082626528814396, 0.7500000000000002));
    mol.addAtom(a4);
    IAtom a5 = mol.getBuilder().newInstance(IAtom.class, "O");
    a5.setPoint2d(new Point2d(-1.42658477444273, 1.9635254915624212));
    mol.addAtom(a5);
    IBond b1 = mol.getBuilder().newInstance(IBond.class, a2, a1, IBond.Order.SINGLE);
    mol.addBond(b1);
    IBond b2 = mol.getBuilder().newInstance(IBond.class, a3, a2, IBond.Order.DOUBLE);
    mol.addBond(b2);
    IBond b3 = mol.getBuilder().newInstance(IBond.class, a4, a3, IBond.Order.SINGLE);
    mol.addBond(b3);
    IBond b4 = mol.getBuilder().newInstance(IBond.class, a5, a4, IBond.Order.SINGLE);
    mol.addBond(b4);
    IBond b5 = mol.getBuilder().newInstance(IBond.class, a5, a1, IBond.Order.SINGLE);
    mol.addBond(b5);
    DoubleArrayResult ret = (DoubleArrayResult) descriptor.calculate(mol).getValue();
    Assert.assertEquals(0.0000, ret.get(0), 0.0001);
    Assert.assertEquals(0.0000, ret.get(1), 0.0001);
    Assert.assertEquals(0.1768, ret.get(2), 0.0001);
    Assert.assertEquals(0.0000, ret.get(3), 0.0001);
    Assert.assertEquals(0.0000, ret.get(5), 0.0001);
    Assert.assertEquals(0.0000, ret.get(6), 0.0001);
    Assert.assertEquals(0.06804, ret.get(7), 0.00001);
    Assert.assertEquals(0.0000, ret.get(8), 0.0001);
}
Also used : IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) AtomContainer(org.openscience.cdk.AtomContainer) Point2d(javax.vecmath.Point2d) IBond(org.openscience.cdk.interfaces.IBond) DoubleArrayResult(org.openscience.cdk.qsar.result.DoubleArrayResult) IAtom(org.openscience.cdk.interfaces.IAtom) Test(org.junit.Test)

Example 98 with AtomContainer

use of org.openscience.cdk.AtomContainer in project cdk by cdk.

the class ChiClusterDescriptorTest method testDan64.

@Test
public void testDan64() throws Exception {
    IAtomContainer mol = new AtomContainer();
    IAtom a1 = mol.getBuilder().newInstance(IAtom.class, "C");
    a1.setPoint2d(new Point2d(0.7500000000000004, 2.799038105676658));
    mol.addAtom(a1);
    IAtom a2 = mol.getBuilder().newInstance(IAtom.class, "C");
    a2.setPoint2d(new Point2d(0.0, 1.5));
    mol.addAtom(a2);
    IAtom a3 = mol.getBuilder().newInstance(IAtom.class, "C");
    a3.setPoint2d(new Point2d(0.0, 0.0));
    mol.addAtom(a3);
    IAtom a4 = mol.getBuilder().newInstance(IAtom.class, "O");
    a4.setPoint2d(new Point2d(-1.2990381056766582, 0.7500000000000001));
    mol.addAtom(a4);
    IBond b1 = mol.getBuilder().newInstance(IBond.class, a2, a1, IBond.Order.SINGLE);
    mol.addBond(b1);
    IBond b2 = mol.getBuilder().newInstance(IBond.class, a3, a2, IBond.Order.SINGLE);
    mol.addBond(b2);
    IBond b3 = mol.getBuilder().newInstance(IBond.class, a4, a3, IBond.Order.SINGLE);
    mol.addBond(b3);
    IBond b4 = mol.getBuilder().newInstance(IBond.class, a4, a2, IBond.Order.SINGLE);
    mol.addBond(b4);
    DoubleArrayResult ret = (DoubleArrayResult) descriptor.calculate(mol).getValue();
    Assert.assertEquals(0.2887, ret.get(0), 0.0001);
    Assert.assertEquals(0.0000, ret.get(1), 0.0001);
    Assert.assertEquals(0.0000, ret.get(2), 0.0001);
    Assert.assertEquals(0.0000, ret.get(3), 0.0001);
    Assert.assertEquals(0.1667, ret.get(4), 0.0001);
    Assert.assertEquals(0.0000, ret.get(5), 0.0001);
    Assert.assertEquals(0.0000, ret.get(6), 0.0001);
    Assert.assertEquals(0.0000, ret.get(7), 0.0001);
}
Also used : IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) AtomContainer(org.openscience.cdk.AtomContainer) Point2d(javax.vecmath.Point2d) IBond(org.openscience.cdk.interfaces.IBond) DoubleArrayResult(org.openscience.cdk.qsar.result.DoubleArrayResult) IAtom(org.openscience.cdk.interfaces.IAtom) Test(org.junit.Test)

Example 99 with AtomContainer

use of org.openscience.cdk.AtomContainer in project cdk by cdk.

the class ChiPathClusterDescriptorTest method testDan64.

@Test
public void testDan64() throws Exception {
    IAtomContainer mol = new AtomContainer();
    IAtom a1 = mol.getBuilder().newInstance(IAtom.class, "C");
    a1.setPoint2d(new Point2d(0.7500000000000004, 2.799038105676658));
    mol.addAtom(a1);
    IAtom a2 = mol.getBuilder().newInstance(IAtom.class, "C");
    a2.setPoint2d(new Point2d(0.0, 1.5));
    mol.addAtom(a2);
    IAtom a3 = mol.getBuilder().newInstance(IAtom.class, "C");
    a3.setPoint2d(new Point2d(0.0, 0.0));
    mol.addAtom(a3);
    IAtom a4 = mol.getBuilder().newInstance(IAtom.class, "O");
    a4.setPoint2d(new Point2d(-1.2990381056766582, 0.7500000000000001));
    mol.addAtom(a4);
    IBond b1 = mol.getBuilder().newInstance(IBond.class, a2, a1, IBond.Order.SINGLE);
    mol.addBond(b1);
    IBond b2 = mol.getBuilder().newInstance(IBond.class, a3, a2, IBond.Order.SINGLE);
    mol.addBond(b2);
    IBond b3 = mol.getBuilder().newInstance(IBond.class, a4, a3, IBond.Order.SINGLE);
    mol.addBond(b3);
    IBond b4 = mol.getBuilder().newInstance(IBond.class, a4, a2, IBond.Order.SINGLE);
    mol.addBond(b4);
    DoubleArrayResult ret = (DoubleArrayResult) descriptor.calculate(mol).getValue();
    Assert.assertEquals(0.0000, ret.get(0), 0.0001);
    Assert.assertEquals(0.0000, ret.get(1), 0.0001);
    Assert.assertEquals(0.0000, ret.get(2), 0.0001);
    Assert.assertEquals(0.0000, ret.get(3), 0.0001);
    Assert.assertEquals(0.0000, ret.get(4), 0.0001);
    Assert.assertEquals(0.0000, ret.get(5), 0.0001);
}
Also used : IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) AtomContainer(org.openscience.cdk.AtomContainer) Point2d(javax.vecmath.Point2d) IBond(org.openscience.cdk.interfaces.IBond) DoubleArrayResult(org.openscience.cdk.qsar.result.DoubleArrayResult) IAtom(org.openscience.cdk.interfaces.IAtom) Test(org.junit.Test)

Example 100 with AtomContainer

use of org.openscience.cdk.AtomContainer in project cdk by cdk.

the class ChiPathDescriptorTest method testDan82.

@Test
public void testDan82() throws Exception {
    IAtomContainer mol = new AtomContainer();
    IAtom a1 = mol.getBuilder().newInstance(IAtom.class, "C");
    a1.setPoint2d(new Point2d(0.0, 1.5));
    mol.addAtom(a1);
    IAtom a2 = mol.getBuilder().newInstance(IAtom.class, "C");
    a2.setPoint2d(new Point2d(0.0, 0.0));
    mol.addAtom(a2);
    IAtom a3 = mol.getBuilder().newInstance(IAtom.class, "C");
    a3.setPoint2d(new Point2d(-1.4265847744427305, -0.46352549156242084));
    mol.addAtom(a3);
    IAtom a4 = mol.getBuilder().newInstance(IAtom.class, "C");
    a4.setPoint2d(new Point2d(-2.3082626528814396, 0.7500000000000002));
    mol.addAtom(a4);
    IAtom a5 = mol.getBuilder().newInstance(IAtom.class, "O");
    a5.setPoint2d(new Point2d(-1.42658477444273, 1.9635254915624212));
    mol.addAtom(a5);
    IBond b1 = mol.getBuilder().newInstance(IBond.class, a2, a1, IBond.Order.SINGLE);
    mol.addBond(b1);
    IBond b2 = mol.getBuilder().newInstance(IBond.class, a3, a2, IBond.Order.DOUBLE);
    mol.addBond(b2);
    IBond b3 = mol.getBuilder().newInstance(IBond.class, a4, a3, IBond.Order.SINGLE);
    mol.addBond(b3);
    IBond b4 = mol.getBuilder().newInstance(IBond.class, a5, a4, IBond.Order.SINGLE);
    mol.addBond(b4);
    IBond b5 = mol.getBuilder().newInstance(IBond.class, a5, a1, IBond.Order.SINGLE);
    mol.addBond(b5);
    DoubleArrayResult ret = (DoubleArrayResult) descriptor.calculate(mol).getValue();
    Assert.assertEquals(3.5355, ret.get(0), 0.0001);
    Assert.assertEquals(2.5000, ret.get(1), 0.0001);
    Assert.assertEquals(1.7678, ret.get(2), 0.0001);
    Assert.assertEquals(1.2500, ret.get(3), 0.0001);
    Assert.assertEquals(2.9772, ret.get(8), 0.0001);
    Assert.assertEquals(1.7272, ret.get(9), 0.0001);
    Assert.assertEquals(1.0089, ret.get(10), 0.0001);
    Assert.assertEquals(0.5948, ret.get(11), 0.0001);
}
Also used : IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) AtomContainer(org.openscience.cdk.AtomContainer) Point2d(javax.vecmath.Point2d) IBond(org.openscience.cdk.interfaces.IBond) DoubleArrayResult(org.openscience.cdk.qsar.result.DoubleArrayResult) IAtom(org.openscience.cdk.interfaces.IAtom) Test(org.junit.Test)

Aggregations

AtomContainer (org.openscience.cdk.AtomContainer)743 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)730 Test (org.junit.Test)641 IAtom (org.openscience.cdk.interfaces.IAtom)556 Atom (org.openscience.cdk.Atom)523 PseudoAtom (org.openscience.cdk.PseudoAtom)206 IBond (org.openscience.cdk.interfaces.IBond)136 Bond (org.openscience.cdk.Bond)90 Point2d (javax.vecmath.Point2d)86 InputStream (java.io.InputStream)80 IQueryAtomContainer (org.openscience.cdk.isomorphism.matchers.IQueryAtomContainer)61 QueryAtomContainer (org.openscience.cdk.isomorphism.matchers.QueryAtomContainer)57 MDLV2000Reader (org.openscience.cdk.io.MDLV2000Reader)44 SimpleChemObjectReaderTest (org.openscience.cdk.test.io.SimpleChemObjectReaderTest)43 ByteArrayInputStream (java.io.ByteArrayInputStream)41 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)32 SlowTest (org.openscience.cdk.test.SlowTest)32 Point3d (javax.vecmath.Point3d)30 IPseudoAtom (org.openscience.cdk.interfaces.IPseudoAtom)29 DoubleArrayResult (org.openscience.cdk.qsar.result.DoubleArrayResult)23