test_class.file: descriptor/qsarmolecular/src/test/java/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptorTest.java
test_class.identifier: BCUTDescriptorTest
test_class.superclass: extends MolecularDescriptorTest
test_case.body: @Test
      public void testHAddition() throws Exception {
          SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
          IAtomContainer mol = sp.parseSmiles("C=1C=CC(=CC1)CNC2=CC=C(C=C2N(=O)=O)S(=O)(=O)C(Cl)(Cl)Br");
          DoubleArrayResult result1 = (DoubleArrayResult) descriptor.calculate(mol).getValue();
          for (int i = 0; i < result1.length(); i++)
              Assert.assertTrue(result1.get(i) != Double.NaN);
      }
test_case.class_method_signature: BCUTDescriptorTest.testHAddition()
test_case.full_signature: @Test public void testHAddition()
test_case.identifier: testHAddition
test_case.invocations: getInstance parseSmiles getValue calculate length assertTrue get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testHAddition()
focal_class.declarator: logger = LoggingToolFactory.createLoggingTool(BCUTDescriptor.class)
focal_class.modifier: private static
focal_class.original_string: private static ILoggingTool logger = LoggingToolFactory.createLoggingTool(BCUTDescriptor.class);
focal_class.type: ILoggingTool
focal_class.var_name: logger
focal_class.declarator: nhigh
focal_class.modifier: private
focal_class.original_string: private int                 nhigh;
focal_class.type: int
focal_class.var_name: nhigh
focal_class.declarator: nlow
focal_class.modifier: private
focal_class.original_string: private int                 nlow;
focal_class.type: int
focal_class.var_name: nlow
focal_class.declarator: checkAromaticity
focal_class.modifier: private
focal_class.original_string: private boolean             checkAromaticity;
focal_class.type: boolean
focal_class.var_name: checkAromaticity
focal_class.file: descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java
focal_class.identifier: BCUTDescriptor
focal_class.interfaces: implements IMolecularDescriptor
focal_class.class_method_signature: BCUTDescriptor.BCUTDescriptor()
focal_class.full_signature: public  BCUTDescriptor()
focal_class.identifier: BCUTDescriptor
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  BCUTDescriptor()
focal_class.class_method_signature: BCUTDescriptor.getSpecification()
focal_class.full_signature: @Override public DescriptorSpecification getSpecification()
focal_class.identifier: getSpecification
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: DescriptorSpecification
focal_class.signature: DescriptorSpecification getSpecification()
focal_class.class_method_signature: BCUTDescriptor.setParameters(Object[] params)
focal_class.full_signature: @Override public void setParameters(Object[] params)
focal_class.identifier: setParameters
focal_class.modifiers: @Override public
focal_class.parameters: (Object[] params)
focal_class.return: void
focal_class.signature: void setParameters(Object[] params)
focal_class.class_method_signature: BCUTDescriptor.getParameters()
focal_class.full_signature: @Override public Object[] getParameters()
focal_class.identifier: getParameters
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Object[]
focal_class.signature: Object[] getParameters()
focal_class.class_method_signature: BCUTDescriptor.getDescriptorNames()
focal_class.full_signature: @Override public String[] getDescriptorNames()
focal_class.identifier: getDescriptorNames
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String[]
focal_class.signature: String[] getDescriptorNames()
focal_class.class_method_signature: BCUTDescriptor.getParameterNames()
focal_class.full_signature: @Override public String[] getParameterNames()
focal_class.identifier: getParameterNames
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String[]
focal_class.signature: String[] getParameterNames()
focal_class.class_method_signature: BCUTDescriptor.getParameterType(String name)
focal_class.full_signature: @Override public Object getParameterType(String name)
focal_class.identifier: getParameterType
focal_class.modifiers: @Override public
focal_class.parameters: (String name)
focal_class.return: Object
focal_class.signature: Object getParameterType(String name)
focal_class.class_method_signature: BCUTDescriptor.hasUndefined(double[][] m)
focal_class.full_signature: private boolean hasUndefined(double[][] m)
focal_class.identifier: hasUndefined
focal_class.modifiers: private
focal_class.parameters: (double[][] m)
focal_class.return: boolean
focal_class.signature: boolean hasUndefined(double[][] m)
focal_class.class_method_signature: BCUTDescriptor.calculate(IAtomContainer container)
focal_class.full_signature: @Override public DescriptorValue calculate(IAtomContainer container)
focal_class.identifier: calculate
focal_class.modifiers: @Override public
focal_class.parameters: (IAtomContainer container)
focal_class.return: DescriptorValue
focal_class.signature: DescriptorValue calculate(IAtomContainer container)
focal_class.class_method_signature: BCUTDescriptor.getDescriptorResultType()
focal_class.full_signature: @Override public IDescriptorResult getDescriptorResultType()
focal_class.identifier: getDescriptorResultType
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: IDescriptorResult
focal_class.signature: IDescriptorResult getDescriptorResultType()
focal_class.class_method_signature: BCUTDescriptor.getDummyDescriptorValue(Exception e)
focal_class.full_signature: private DescriptorValue getDummyDescriptorValue(Exception e)
focal_class.identifier: getDummyDescriptorValue
focal_class.modifiers: private
focal_class.parameters: (Exception e)
focal_class.return: DescriptorValue
focal_class.signature: DescriptorValue getDummyDescriptorValue(Exception e)
focal_class.superclass: extends AbstractMolecularDescriptor
focal_method.body: @Override
      public DescriptorValue calculate(IAtomContainer container) {
          int counter;
          IAtomContainer molecule;
          try {
              molecule = container.clone();
          } catch (CloneNotSupportedException e) {
              logger.debug("Error during clone");
              return getDummyDescriptorValue(new CDKException("Error occurred during clone " + e));
          }
  
          // add H's in case they're not present
          try {
              AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule);
              CDKHydrogenAdder hAdder = CDKHydrogenAdder.getInstance(molecule.getBuilder());
              hAdder.addImplicitHydrogens(molecule);
              AtomContainerManipulator.convertImplicitToExplicitHydrogens(molecule);
          } catch (Exception e) {
              return getDummyDescriptorValue(new CDKException("Could not add hydrogens: " + e.getMessage(), e));
          }
  
          // do aromaticity detecttion for calculating polarizability later on
          if (this.checkAromaticity) {
              try {
                  AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule);
              } catch (CDKException e) {
                  return getDummyDescriptorValue(new CDKException("Error in atom typing: " + e.getMessage(), e));
              }
              try {
                  Aromaticity.cdkLegacy().apply(molecule);
              } catch (CDKException e) {
                  return getDummyDescriptorValue(new CDKException("Error in aromaticity perception: " + e.getMessage()));
              }
          }
  
          // find number of heavy atoms
          int nheavy = 0;
          for (int i = 0; i < molecule.getAtomCount(); i++) {
              if (molecule.getAtom(i).getAtomicNumber() != IElement.H) nheavy++;
          }
  
          if (nheavy == 0) return getDummyDescriptorValue(new CDKException("No heavy atoms in the molecule"));
  
          double[] diagvalue = new double[nheavy];
  
          // get atomic mass weighted BCUT
          counter = 0;
          try {
              for (int i = 0; i < molecule.getAtomCount(); i++) {
                  if (molecule.getAtom(i).getAtomicNumber() == IElement.H) continue;
                  diagvalue[counter] = Isotopes.getInstance().getMajorIsotope(molecule.getAtom(i).getSymbol())
                          .getExactMass();
                  counter++;
              }
          } catch (Exception e) {
              return getDummyDescriptorValue(new CDKException("Could not calculate weight: " + e.getMessage(), e));
          }
  
          double[][] burdenMatrix = BurdenMatrix.evalMatrix(molecule, diagvalue);
          if (hasUndefined(burdenMatrix))
              return getDummyDescriptorValue(new CDKException("Burden matrix has undefined values"));
          Matrix matrix = new Matrix(burdenMatrix);
          EigenvalueDecomposition eigenDecomposition = new EigenvalueDecomposition(matrix);
          double[] eval1 = eigenDecomposition.getRealEigenvalues();
  
          // get charge weighted BCUT
          LonePairElectronChecker lpcheck = new LonePairElectronChecker();
          GasteigerMarsiliPartialCharges peoe;
          try {
              lpcheck.saturate(molecule);
              double[] charges = new double[molecule.getAtomCount()];
              //            pepe = new GasteigerPEPEPartialCharges();
              //            pepe.calculateCharges(molecule);
              //            for (int i = 0; i < molecule.getAtomCount(); i++) charges[i] = molecule.getAtom(i).getCharge();
              peoe = new GasteigerMarsiliPartialCharges();
              peoe.assignGasteigerMarsiliSigmaPartialCharges(molecule, true);
              for (int i = 0; i < molecule.getAtomCount(); i++)
                  charges[i] += molecule.getAtom(i).getCharge();
              for (int i = 0; i < molecule.getAtomCount(); i++) {
                  molecule.getAtom(i).setCharge(charges[i]);
              }
          } catch (Exception e) {
              return getDummyDescriptorValue(new CDKException("Could not calculate partial charges: " + e.getMessage(), e));
          }
          counter = 0;
          for (int i = 0; i < molecule.getAtomCount(); i++) {
              if (molecule.getAtom(i).getAtomicNumber() == IElement.H) continue;
              diagvalue[counter] = molecule.getAtom(i).getCharge();
              counter++;
          }
          burdenMatrix = BurdenMatrix.evalMatrix(molecule, diagvalue);
          if (hasUndefined(burdenMatrix))
              return getDummyDescriptorValue(new CDKException("Burden matrix has undefined values"));
          matrix = new Matrix(burdenMatrix);
          eigenDecomposition = new EigenvalueDecomposition(matrix);
          double[] eval2 = eigenDecomposition.getRealEigenvalues();
  
          int[][] topoDistance = PathTools.computeFloydAPSP(AdjacencyMatrix.getMatrix(molecule));
  
          // get polarizability weighted BCUT
          Polarizability pol = new Polarizability();
          counter = 0;
          for (int i = 0; i < molecule.getAtomCount(); i++) {
              if (molecule.getAtom(i).getAtomicNumber() == IElement.H) continue;
              diagvalue[counter] = pol.calculateGHEffectiveAtomPolarizability(molecule, molecule.getAtom(i), false,
                      topoDistance);
              counter++;
          }
          burdenMatrix = BurdenMatrix.evalMatrix(molecule, diagvalue);
          if (hasUndefined(burdenMatrix))
              return getDummyDescriptorValue(new CDKException("Burden matrix has undefined values"));
          matrix = new Matrix(burdenMatrix);
          eigenDecomposition = new EigenvalueDecomposition(matrix);
          double[] eval3 = eigenDecomposition.getRealEigenvalues();
  
          // return only the n highest & lowest eigenvalues
          int lnlow, lnhigh, enlow, enhigh;
          if (nlow > nheavy) {
              lnlow = nheavy;
              enlow = nlow - nheavy;
          } else {
              lnlow = nlow;
              enlow = 0;
          }
  
          if (nhigh > nheavy) {
              lnhigh = nheavy;
              enhigh = nhigh - nheavy;
          } else {
              lnhigh = nhigh;
              enhigh = 0;
          }
  
          DoubleArrayResult retval = new DoubleArrayResult((lnlow + enlow + lnhigh + enhigh) * 3);
  
          for (int i = 0; i < lnlow; i++)
              retval.add(eval1[i]);
          for (int i = 0; i < enlow; i++)
              retval.add(Double.NaN);
          for (int i = 0; i < lnhigh; i++)
              retval.add(eval1[eval1.length - i - 1]);
          for (int i = 0; i < enhigh; i++)
              retval.add(Double.NaN);
  
          for (int i = 0; i < lnlow; i++)
              retval.add(eval2[i]);
          for (int i = 0; i < enlow; i++)
              retval.add(Double.NaN);
          for (int i = 0; i < lnhigh; i++)
              retval.add(eval2[eval2.length - i - 1]);
          for (int i = 0; i < enhigh; i++)
              retval.add(Double.NaN);
  
          for (int i = 0; i < lnlow; i++)
              retval.add(eval3[i]);
          for (int i = 0; i < enlow; i++)
              retval.add(Double.NaN);
          for (int i = 0; i < lnhigh; i++)
              retval.add(eval3[eval3.length - i - 1]);
          for (int i = 0; i < enhigh; i++)
              retval.add(Double.NaN);
  
          return new DescriptorValue(getSpecification(), getParameterNames(),
                                     getParameters(), retval,
                                     getDescriptorNames());
      }
focal_method.class_method_signature: BCUTDescriptor.calculate(IAtomContainer container)
focal_method.full_signature: @Override public DescriptorValue calculate(IAtomContainer container)
focal_method.identifier: calculate
focal_method.invocations: clone debug getDummyDescriptorValue percieveAtomTypesAndConfigureAtoms getInstance getBuilder addImplicitHydrogens convertImplicitToExplicitHydrogens getDummyDescriptorValue getMessage percieveAtomTypesAndConfigureAtoms getDummyDescriptorValue getMessage apply cdkLegacy getDummyDescriptorValue getMessage getAtomCount getAtomicNumber getAtom getDummyDescriptorValue getAtomCount getAtomicNumber getAtom getExactMass getMajorIsotope getInstance getSymbol getAtom getDummyDescriptorValue getMessage evalMatrix hasUndefined getDummyDescriptorValue getRealEigenvalues saturate getAtomCount assignGasteigerMarsiliSigmaPartialCharges getAtomCount getCharge getAtom getAtomCount setCharge getAtom getDummyDescriptorValue getMessage getAtomCount getAtomicNumber getAtom getCharge getAtom evalMatrix hasUndefined getDummyDescriptorValue getRealEigenvalues computeFloydAPSP getMatrix getAtomCount getAtomicNumber getAtom calculateGHEffectiveAtomPolarizability getAtom evalMatrix hasUndefined getDummyDescriptorValue getRealEigenvalues add add add add add add add add add add add add getSpecification getParameterNames getParameters getDescriptorNames
focal_method.modifiers: @Override public
focal_method.parameters: (IAtomContainer container)
focal_method.return: DescriptorValue
focal_method.signature: DescriptorValue calculate(IAtomContainer container)