Search in sources :

Example 1 with IAtomicDescriptor

use of org.openscience.cdk.qsar.IAtomicDescriptor in project cdk by cdk.

the class AtomDegreeDescriptorTest method testAtomDegreeDescriptor.

@Test
public void testAtomDegreeDescriptor() throws java.lang.Exception {
    IAtomicDescriptor descriptor = new AtomDegreeDescriptor();
    SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
    // 
    IAtomContainer mol = sp.parseSmiles("CC(C)CCCC");
    Assert.assertEquals(3, ((IntegerResult) descriptor.calculate(mol.getAtom(1), mol).getValue()).intValue());
}
Also used : SmilesParser(org.openscience.cdk.smiles.SmilesParser) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IAtomicDescriptor(org.openscience.cdk.qsar.IAtomicDescriptor) Test(org.junit.Test)

Example 2 with IAtomicDescriptor

use of org.openscience.cdk.qsar.IAtomicDescriptor in project cdk by cdk.

the class AtomValenceDescriptorTest method testAtomValenceDescriptor.

@Test
public void testAtomValenceDescriptor() throws java.lang.Exception {
    IAtomicDescriptor descriptor = new AtomValenceDescriptor();
    SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
    // 
    IAtomContainer mol = sp.parseSmiles("CCCl");
    Assert.assertEquals(7, ((IntegerResult) descriptor.calculate(mol.getAtom(2), mol).getValue()).intValue());
}
Also used : SmilesParser(org.openscience.cdk.smiles.SmilesParser) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IAtomicDescriptor(org.openscience.cdk.qsar.IAtomicDescriptor) Test(org.junit.Test)

Example 3 with IAtomicDescriptor

use of org.openscience.cdk.qsar.IAtomicDescriptor in project cdk by cdk.

the class SigmaElectronegativityDescriptorTest method testSigmaElectronegativityDescriptor_Isopentyl_iodide.

/**
 *  A unit test for JUnit with Isopentyl iodide
 */
@Test
public void testSigmaElectronegativityDescriptor_Isopentyl_iodide() throws java.lang.Exception {
    double testResult = 9.2264;
    /*
                                     * from Petra online:
                                     * http://www2.chemie.uni-
                                     * erlangen.de/services/petra/smiles.phtml
                                     */
    IAtomicDescriptor descriptor = new SigmaElectronegativityDescriptor();
    SmilesParser sp = new SmilesParser(builder);
    IAtomContainer mol = sp.parseSmiles("C(C)(C)CCI");
    addExplicitHydrogens(mol);
    double result = ((DoubleResult) descriptor.calculate(mol.getAtom(5), mol).getValue()).doubleValue();
    Assert.assertEquals(testResult, result, 0.08);
}
Also used : SmilesParser(org.openscience.cdk.smiles.SmilesParser) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IAtomicDescriptor(org.openscience.cdk.qsar.IAtomicDescriptor) DoubleResult(org.openscience.cdk.qsar.result.DoubleResult) Test(org.junit.Test)

Example 4 with IAtomicDescriptor

use of org.openscience.cdk.qsar.IAtomicDescriptor in project cdk by cdk.

the class SigmaElectronegativityDescriptorTest method testSigmaElectronegativityDescriptor_Allyl_mercaptan.

/**
 *  A unit test for JUnit with Allyl mercaptan
 */
@Test
public void testSigmaElectronegativityDescriptor_Allyl_mercaptan() throws java.lang.Exception {
    double[] testResult = { 7.8634, 8.0467, 8.061, 8.5917 };
    /*
                                                                * from Petra
                                                                * online:
                                                                * http://
                                                                * www2.chemie
                                                                * .uni
                                                                * -erlangen.de
                                                                * /services
                                                                * /petra
                                                                * /smiles.phtml
                                                                */
    IAtomicDescriptor descriptor = new SigmaElectronegativityDescriptor();
    SmilesParser sp = new SmilesParser(builder);
    IAtomContainer mol = sp.parseSmiles("C=CCS");
    addExplicitHydrogens(mol);
    for (int i = 0; i < 4; i++) {
        double result = ((DoubleResult) descriptor.calculate(mol.getAtom(i), mol).getValue()).doubleValue();
        Assert.assertEquals(testResult[i], result, 0.01);
    }
}
Also used : SmilesParser(org.openscience.cdk.smiles.SmilesParser) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IAtomicDescriptor(org.openscience.cdk.qsar.IAtomicDescriptor) DoubleResult(org.openscience.cdk.qsar.result.DoubleResult) Test(org.junit.Test)

Example 5 with IAtomicDescriptor

use of org.openscience.cdk.qsar.IAtomicDescriptor in project cdk by cdk.

the class SigmaElectronegativityDescriptorTest method testSigmaElectronegativityDescriptor_Ethoxy_ethane.

/**
 *  A unit test for JUnit with Ethoxy ethane
 */
@Test
public void testSigmaElectronegativityDescriptor_Ethoxy_ethane() throws java.lang.Exception {
    double[] testResult = { 7.6009, 8.3948, 9.4663, 8.3948, 7.6009 };
    /*
                                                                         * from
                                                                         * Petra
                                                                         * online
                                                                         * :
                                                                         * http
                                                                         * :/
                                                                         * /www2
                                                                         * .
                                                                         * chemie
                                                                         * .uni-
                                                                         * erlangen
                                                                         * .de/
                                                                         * services
                                                                         * /
                                                                         * petra
                                                                         * /
                                                                         * smiles
                                                                         * .
                                                                         * phtml
                                                                         */
    IAtomicDescriptor descriptor = new SigmaElectronegativityDescriptor();
    Integer[] params = new Integer[1];
    SmilesParser sp = new SmilesParser(builder);
    IAtomContainer mol = sp.parseSmiles("CCOCC");
    addExplicitHydrogens(mol);
    for (int i = 0; i < 5; i++) {
        params[0] = 6;
        descriptor.setParameters(params);
        double result = ((DoubleResult) descriptor.calculate(mol.getAtom(i), mol).getValue()).doubleValue();
        Assert.assertEquals(testResult[i], result, 0.002);
    }
}
Also used : SmilesParser(org.openscience.cdk.smiles.SmilesParser) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) IAtomicDescriptor(org.openscience.cdk.qsar.IAtomicDescriptor) DoubleResult(org.openscience.cdk.qsar.result.DoubleResult) Test(org.junit.Test)

Aggregations

IAtomicDescriptor (org.openscience.cdk.qsar.IAtomicDescriptor)59 Test (org.junit.Test)58 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)56 DoubleResult (org.openscience.cdk.qsar.result.DoubleResult)48 SmilesParser (org.openscience.cdk.smiles.SmilesParser)39 SlowTest (org.openscience.cdk.test.SlowTest)23 Category (org.junit.experimental.categories.Category)22 IAtom (org.openscience.cdk.interfaces.IAtom)14 LonePairElectronChecker (org.openscience.cdk.tools.LonePairElectronChecker)12 Atom (org.openscience.cdk.Atom)4 Point3d (javax.vecmath.Point3d)3 AtomContainer (org.openscience.cdk.AtomContainer)3 DoubleArrayResult (org.openscience.cdk.qsar.result.DoubleArrayResult)2 Ignore (org.junit.Ignore)1