Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed typing, so that we work with IAtomContainer rather than IMolecule

  • Loading branch information...
commit b74143cc5ac96b772422f4d534b017454975775a 1 parent d7a229a
@rajarshi rajarshi authored
Showing with 13 additions and 14 deletions.
  1. +13 −14 src/main/org/openscience/cdk/charges/Polarizability.java
View
27 src/main/org/openscience/cdk/charges/Polarizability.java
@@ -20,12 +20,7 @@
*/
package org.openscience.cdk.charges;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
import org.openscience.cdk.CDKConstants;
-import org.openscience.cdk.Molecule;
import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;
import org.openscience.cdk.atomtype.CDKAtomTypeMatcher;
@@ -40,6 +35,10 @@
import org.openscience.cdk.tools.manipulator.AtomContainerManipulator;
import org.openscience.cdk.tools.manipulator.AtomTypeManipulator;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
/**
* Calculation of the polarizability of a molecule by the method of Kang and
* Jhon and Gasteiger based on {@cdk.cite KJ81} and {@cdk.cite GH82}
@@ -105,7 +104,7 @@ public double getPolarizabilitiyFactorForAtom(IAtomContainer atomContainer, IAto
@TestMethod("testCalculateKJMeanMolecularPolarizability")
public double calculateKJMeanMolecularPolarizability(IAtomContainer atomContainer) {
double polarizabilitiy = 0;
- Molecule acH = new Molecule(atomContainer);
+ IAtomContainer acH = atomContainer.getBuilder().newInstance(IAtomContainer.class,atomContainer);
addExplicitHydrogens(acH);
for (int i = 0; i < acH.getAtomCount(); i++) {
polarizabilitiy += getKJPolarizabilityFactor(acH, acH.getAtom(i));
@@ -128,14 +127,14 @@ public double calculateKJMeanMolecularPolarizability(IAtomContainer atomContaine
public double calculateGHEffectiveAtomPolarizability(IAtomContainer atomContainer,IAtom atom,
int influenceSphereCutOff,
boolean addExplicitH) {
- double polarizabilitiy = 0;
+ double polarizabilitiy = 0;
- Molecule acH;
+ IAtomContainer acH;
if (addExplicitH) {
- acH = new Molecule(atomContainer);
+ acH = atomContainer.getBuilder().newInstance(IAtomContainer.class, atomContainer);
addExplicitHydrogens(acH);
} else {
- acH = (Molecule) atomContainer;
+ acH = atomContainer;
}
List<IAtom> startAtom = new ArrayList<IAtom>(1);
@@ -175,12 +174,12 @@ public double calculateGHEffectiveAtomPolarizability(IAtomContainer atomContaine
int[][] distanceMatrix) {
double polarizabilitiy = 0;
- Molecule acH;
+ IAtomContainer acH;
if (addExplicitH) {
- acH = new Molecule(atomContainer);
+ acH = atomContainer.getBuilder().newInstance(IAtomContainer.class,atomContainer);
addExplicitHydrogens(acH);
} else {
- acH = (Molecule) atomContainer;
+ acH = atomContainer;
}
List<IAtom> startAtom = new ArrayList<IAtom>(1);
@@ -213,7 +212,7 @@ public double calculateGHEffectiveAtomPolarizability(IAtomContainer atomContaine
@TestMethod("testCalculateBondPolarizability_IAtomContainer_IBond")
public double calculateBondPolarizability(IAtomContainer atomContainer, IBond bond) {
double polarizabilitiy = 0;
- Molecule acH = new Molecule(atomContainer);
+ IAtomContainer acH = atomContainer.getBuilder().newInstance(IAtomContainer.class,atomContainer);
addExplicitHydrogens(acH);
if (bond.getAtomCount() == 2) {
polarizabilitiy += getKJPolarizabilityFactor(acH, bond.getAtom(0));
Please sign in to comment.
Something went wrong with that request. Please try again.