Polarizability { public double calculateGHEffectiveAtomPolarizability(IAtomContainer atomContainer, IAtom atom, int influenceSphereCutOff, boolean addExplicitH) { double polarizabilitiy = 0; IAtomContainer acH; if (addExplicitH) { acH = atomContainer.getBuilder().newInstance(IAtomContainer.class, atomContainer); addExplicitHydrogens(acH); } else { acH = atomContainer; } List<IAtom> startAtom = new ArrayList<>(1); startAtom.add(0, atom); double bond; polarizabilitiy += getKJPolarizabilityFactor(acH, atom); for (int i = 0; i < acH.getAtomCount(); i++) { if (!acH.getAtom(i).equals(atom)) { bond = PathTools.breadthFirstTargetSearch(acH, startAtom, acH.getAtom(i), 0, influenceSphereCutOff); if (bond == 1) { polarizabilitiy += getKJPolarizabilityFactor(acH, acH.getAtom(i)); } else { polarizabilitiy += (Math.pow(0.5, bond - 1) * getKJPolarizabilityFactor(acH, acH.getAtom(i))); } } } return polarizabilitiy; } Polarizability(); double getPolarizabilitiyFactorForAtom(IAtomContainer atomContainer, IAtom atom); double calculateKJMeanMolecularPolarizability(IAtomContainer atomContainer); double calculateGHEffectiveAtomPolarizability(IAtomContainer atomContainer, IAtom atom,
            int influenceSphereCutOff, boolean addExplicitH); double calculateGHEffectiveAtomPolarizability(IAtomContainer atomContainer, IAtom atom,
            boolean addExplicitH, int[][] distanceMatrix); double calculateBondPolarizability(IAtomContainer atomContainer, IBond bond);  }
@Test public void testCalculateGHEffectiveAtomPolarizability_IAtomContainer_IAtom_Int_Boolean() throws Exception { double[] testResult = {4.73, 6.92}; Polarizability pol = new Polarizability(); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("NCCN(C)(C)"); double result = pol.calculateGHEffectiveAtomPolarizability(mol, mol.getAtom(0), 100, true); Assert.assertEquals(testResult[0], result, 0.01); result = pol.calculateGHEffectiveAtomPolarizability(mol, mol.getAtom(3), 100, true); Assert.assertEquals(testResult[1], result, 0.01); }
@Test public void testcalculateGHEffectiveAtomPolarizability_Ethyl_chloride() throws Exception { double testResult = 4.62; Polarizability pol = new Polarizability(); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CCCl"); double result = pol.calculateGHEffectiveAtomPolarizability(mol, mol.getAtom(2), 100, true); Assert.assertEquals(testResult, result, 0.01); }
@Test public void testcalculateGHEffectiveAtomPolarizability_Allyl_bromide() throws Exception { double testResult = 6.17; Polarizability pol = new Polarizability(); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("C=CCBr"); double result = pol.calculateGHEffectiveAtomPolarizability(mol, mol.getAtom(3), 100, true); Assert.assertEquals(testResult, result, 0.01); }
@Test public void testcalculateGHEffectiveAtomPolarizability_Isopentyl_iodide() throws Exception { double testResult = 8.69; Polarizability pol = new Polarizability(); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("C(C)(C)CCI"); double result = pol.calculateGHEffectiveAtomPolarizability(mol, mol.getAtom(5), 100, true); Assert.assertEquals(testResult, result, 0.01); }
@Test public void testcalculateGHEffectiveAtomPolarizability_Ethoxy_ethane() throws Exception { double testResult = 5.21; Polarizability pol = new Polarizability(); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("CCOCC"); double result = pol.calculateGHEffectiveAtomPolarizability(mol, mol.getAtom(2), 100, true); Assert.assertEquals(testResult, result, 0.01); }
@Test public void testcalculateGHEffectiveAtomPolarizability_Ethanolamine() throws Exception { double[] testResult = {4.26, 3.60}; Polarizability pol = new Polarizability(); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("NCCO"); double result = pol.calculateGHEffectiveAtomPolarizability(mol, mol.getAtom(3), 100, true); Assert.assertEquals(testResult[1], result, 0.01); result = pol.calculateGHEffectiveAtomPolarizability(mol, mol.getAtom(0), 100, true); Assert.assertEquals(testResult[0], result, 0.01); }
@Test public void testcalculateGHEffectiveAtomPolarizability_Allyl_mercaptan() throws Exception { double testResult = 6.25; Polarizability pol = new Polarizability(); SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = sp.parseSmiles("C=CCS"); double result = pol.calculateGHEffectiveAtomPolarizability(mol, mol.getAtom(3), 100, true); Assert.assertEquals(testResult, result, 0.01); }