ALOGPDescriptor extends AbstractMolecularDescriptor implements IMolecularDescriptor { private double[] calculate(IAtomContainer atomContainer, String[] fragment, IRingSet rs) throws CDKException { this.atomContainer = atomContainer; this.fragment = fragment; this.rs = rs; alogp = 0.0; amr = 0.0; alogp2 = 0.0; alogpfrag = new int[atomContainer.getAtomCount()]; for (int i = 1; i <= 120; i++) { frags[i] = 0; } for (int i = 0; i < atomContainer.getAtomCount(); i++) { try { if (fragment[i] != null) { calcGroup001_005(i); calcGroup002_006_007(i); calcGroup003_008_009_010(i); calcGroup004_011_to_014(i); calcGroup015(i); calcGroup016_018_036_037(i); calcGroup017_019_020_038_to_041(i); calcGroup021_to_023_040(i); calcGroup024_027_030_033_042(i); calcGroup025_026_028_029_031_032_034_035_043_044(i); calcGroup056_57(i); calcGroup058_61(i); calcGroup059_060_063(i); calcGroup066_to_079(i); calcGroup081_to_085(i); calcGroup086_to_090(i); calcGroup091_to_095(i); calcGroup096_to_100(i); calcGroup101_to_104(i); calcGroup106(i); calcGroup107(i); calcGroup108(i); calcGroup109(i); calcGroup110(i); calcGroup111(i); calcGroup112(i); calcGroup115(i); calcGroup116_117_120(i); calcGroup118_119(i); } } catch (Exception e) { throw new CDKException(e.toString(), e); } } logger.debug("\nFound fragments and frequencies "); for (int i = 1; i <= 120; i++) { alogp += FRAGVAL[i] * frags[i]; amr += REFRACVAL[i] * frags[i]; if (frags[i] > 0) { logger.debug("frag " + i + " --> " + frags[i]); } } alogp2 = alogp * alogp; this.findUnassignedAtoms(); return new double[]{alogp, alogp2, amr}; } ALOGPDescriptor(); @Override DescriptorValue calculate(IAtomContainer container); @Override IDescriptorResult getDescriptorResultType(); @Override DescriptorSpecification getSpecification(); @Override String[] getParameterNames(); @Override Object getParameterType(String name); @Override void setParameters(Object[] params); @Override Object[] getParameters(); @Override String[] getDescriptorNames(); public int[] frags; public int[] alogpfrag; }
@Test public void testChloroButane() throws Exception { IAtomContainer mol = DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class); IAtom c1 = DefaultChemObjectBuilder.getInstance().newInstance(IAtom.class, "C"); IAtom c2 = DefaultChemObjectBuilder.getInstance().newInstance(IAtom.class, "C"); IAtom c3 = DefaultChemObjectBuilder.getInstance().newInstance(IAtom.class, "C"); IAtom cl = DefaultChemObjectBuilder.getInstance().newInstance(IAtom.class, "Cl"); mol.addAtom(c1); mol.addAtom(c2); mol.addAtom(c3); mol.addAtom(cl); mol.addBond(new Bond(c1, c2)); mol.addBond(new Bond(c2, c3)); mol.addBond(new Bond(c3, cl)); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); CDKHydrogenAdder.getInstance(SilentChemObjectBuilder.getInstance()) .addImplicitHydrogens(mol); DescriptorValue v = descriptor.calculate(mol); Assert.assertEquals(1.719, ((DoubleArrayResult) v.getValue()).get(0), 0.01); Assert.assertEquals(20.585, ((DoubleArrayResult) v.getValue()).get(2), 0.01); }