PartialSigmaChargeDescriptor extends AbstractAtomicDescriptor { @Override public DescriptorValue calculate(IAtom atom, IAtomContainer ac) { if (!isCachedAtomContainer(ac)) { Double[] org = new Double[ac.getAtomCount()]; for (int i = 0; i < org.length; i++) org[i] = ac.getAtom(i).getCharge(); IAtomContainer mol = atom.getBuilder().newInstance(IAtomContainer.class, ac); if (maxIterations != 0) peoe.setMaxGasteigerIters(maxIterations); try { peoe.assignGasteigerMarsiliSigmaPartialCharges(mol, true); for (int i = 0; i < ac.getAtomCount(); i++) { cacheDescriptorValue(ac.getAtom(i), ac, new DoubleResult(mol.getAtom(i).getCharge())); } } catch (Exception e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Double.NaN), NAMES, e); } for (int i = 0; i < org.length; i++) mol.getAtom(i).setCharge(org[i]); } return getCachedDescriptorValue(atom) != null ? new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), getCachedDescriptorValue(atom), NAMES) : null; } PartialSigmaChargeDescriptor(); @Override DescriptorSpecification getSpecification(); @Override void setParameters(Object[] params); @Override Object[] getParameters(); @Override String[] getDescriptorNames(); @Override DescriptorValue calculate(IAtom atom, IAtomContainer ac); @Override String[] getParameterNames(); @Override Object getParameterType(String name);  }
@Test public void testPartialSigmaChargeDescriptor_Fluoroethylene() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {-0.2138, 0.079, 0.0942, -0.072, 0.0563, 0.0563}; IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "F")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(1, 3, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(3, 4, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(3, 5, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); addExplicitHydrogens(molecule); lpcheck.saturate(molecule); for (int i = 0; i < molecule.getAtomCount(); i++) { double result = ((DoubleResult) descriptor.calculate(molecule.getAtom(i), molecule).getValue()) .doubleValue(); Assert.assertEquals(testResult[i], result, 0.003); } }
@Test public void testPartialSigmaChargeDescriptor_Methyl_Floride() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {0.07915, -0.25264, 0.05783, 0.05783, 0.05783}; IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(new Atom("C")); molecule.addAtom(new Atom("F")); molecule.addBond(0, 1, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); addExplicitHydrogens(molecule); lpcheck.saturate(molecule); addExplicitHydrogens(molecule); for (int i = 0; i < molecule.getAtomCount(); i++) { double result = ((DoubleResult) descriptor.calculate(molecule.getAtom(i), molecule).getValue()) .doubleValue(); Assert.assertEquals(testResult[i], result, 0.001); } }
@Test public void testPartialSigmaChargeDescriptor_Methyl_chloride() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {0.0382, -0.1755, 0.0457, 0.0457, 0.0457}; IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(new Atom("C")); molecule.addAtom(new Atom("Cl")); molecule.addBond(0, 1, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); addExplicitHydrogens(molecule); lpcheck.saturate(molecule); for (int i = 0; i < molecule.getAtomCount(); i++) { double result = ((DoubleResult) descriptor.calculate(molecule.getAtom(i), molecule).getValue()) .doubleValue(); Assert.assertEquals(testResult[i], result, 0.001); } }
@Test public void testPartialSigmaChargeDescriptor_Methyl_bromide() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {0.021, -0.1448, 0.0413, 0.0413, 0.0413}; IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(new Atom("C")); molecule.addAtom(new Atom("Br")); molecule.addBond(0, 1, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); addExplicitHydrogens(molecule); lpcheck.saturate(molecule); for (int i = 0; i < molecule.getAtomCount(); i++) { double result = ((DoubleResult) descriptor.calculate(molecule.getAtom(i), molecule).getValue()) .doubleValue(); Assert.assertEquals(testResult[i], result, 0.01); } }
@Test public void testPartialSigmaChargeDescriptor_Methyl_iodide() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {-0.0116, -0.0892, 0.0336, 0.0336, 0.0336}; IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(new Atom("C")); molecule.addAtom(new Atom("I")); molecule.addBond(0, 1, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); addExplicitHydrogens(molecule); lpcheck.saturate(molecule); for (int i = 0; i < molecule.getAtomCount(); i++) { double result = ((DoubleResult) descriptor.calculate(molecule.getAtom(i), molecule).getValue()) .doubleValue(); Assert.assertEquals(testResult[i], result, 0.001); } }
@Test public void testPartialSigmaChargeDescriptor_Allyl_bromide() throws ClassNotFoundException, CDKException, java.lang.Exception { double testResult = -0.1366; IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "Br")); molecule.addBond(2, 3, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); addExplicitHydrogens(molecule); lpcheck.saturate(molecule); double result = ((DoubleResult) descriptor.calculate(molecule.getAtom(3), molecule).getValue()).doubleValue(); Assert.assertEquals(testResult, result, 0.01); }
@Test public void testPartialSigmaChargeDescriptor_Isopentyl_iodide() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {-0.0458, -0.0623, -0.0623, -0.0415, 0.0003, -0.0855}; SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("C(C)(C)CCI"); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); addExplicitHydrogens(mol); for (int i = 0; i < 6; i++) { double result = ((DoubleResult) descriptor.calculate(mol.getAtom(i), mol).getValue()).doubleValue(); Assert.assertEquals(testResult[i], result, 0.001); } }
@Test public void testPartialSigmaChargeDescriptor_Ethoxy_ethane() throws ClassNotFoundException, CDKException, java.lang.Exception { double testResult = -0.3809; IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "O")); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(2, 3, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(3, 4, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); addExplicitHydrogens(molecule); lpcheck.saturate(molecule); double result = ((DoubleResult) descriptor.calculate(molecule.getAtom(2), molecule).getValue()).doubleValue(); Assert.assertEquals(testResult, result, 0.01); }
@Test public void testPartialSigmaChargeDescriptor_Ethanolamine() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {-0.3293, 0.017, 0.057, -0.3943}; IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "N")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "O")); molecule.addBond(2, 3, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); addExplicitHydrogens(molecule); lpcheck.saturate(molecule); for (int i = 0; i < 4; i++) { double result = ((DoubleResult) descriptor.calculate(molecule.getAtom(i), molecule).getValue()) .doubleValue(); Assert.assertEquals(testResult[i], result, 0.01); } }
@Test public void testPartialSigmaChargeDescriptor_Allyl_mercaptan() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {-0.1031, -0.0828, 0.0093, -0.1742}; IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "S")); molecule.addBond(2, 3, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); addExplicitHydrogens(molecule); lpcheck.saturate(molecule); for (int i = 0; i < 4; i++) { double result = ((DoubleResult) descriptor.calculate(molecule.getAtom(i), molecule).getValue()) .doubleValue(); Assert.assertEquals(testResult[i], result, 0.01); } }
@Test public void testPartialSigmaChargeDescriptor1() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {-0.2138, 0.079, 0.0942, -0.072, 0.0563, 0.0563}; SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("[F+]=C([H])[C-]([H])[H]"); for (int i = 0; i < mol.getAtomCount(); i++) { double result = ((DoubleResult) descriptor.calculate(mol.getAtom(i), mol).getValue()).doubleValue(); Assert.assertEquals(testResult[i], result, 0.003); } }
@Test public void testPartialSigmaChargeDescriptor3() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {-0.3855, -0.0454, 0.0634, -0.0544, -0.0391, -0.0391}; SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("[O-]C([H])=C([H])[H]"); for (int i = 0; i < mol.getAtomCount(); i++) { double result = ((DoubleResult) descriptor.calculate(mol.getAtom(i), mol).getValue()).doubleValue(); Assert.assertEquals(testResult[i], result, 0.2); } }
@Test public void testPartialSigmaChargeDescriptor4() throws ClassNotFoundException, CDKException, java.lang.Exception { double[] testResult = {-0.3041, 0.1055, 0.0993, 0.0993}; IAtomContainer molecule = builder.newInstance(IAtomContainer.class); molecule.addAtom(builder.newInstance(IAtom.class, "O")); molecule.addAtom(builder.newInstance(IAtom.class, "C")); molecule.addBond(0, 1, IBond.Order.DOUBLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(1, 2, IBond.Order.SINGLE); molecule.addAtom(builder.newInstance(IAtom.class, "H")); molecule.addBond(1, 3, IBond.Order.SINGLE); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule); addExplicitHydrogens(molecule); lpcheck.saturate(molecule); for (int i = 0; i < molecule.getAtomCount(); i++) { double result = ((DoubleResult) descriptor.calculate(molecule.getAtom(i), molecule).getValue()) .doubleValue(); Assert.assertEquals(testResult[i], result, 0.003); } }