test_class.file: descriptor/qsarmolecular/src/test/java/org/openscience/cdk/qsar/descriptors/molecular/AutocorrelationDescriptorMassTest.java
test_class.identifier: AutocorrelationDescriptorMassTest
test_class.superclass: extends MolecularDescriptorTest
test_case.body: @Test
      public void test1() throws Exception {
          String filename = "data/mdl/clorobenzene.mol";
          InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
          MDLV2000Reader reader = new MDLV2000Reader(ins);
          IAtomContainer container = reader.read(new AtomContainer());
          DescriptorValue count = new AutocorrelationDescriptorMass().calculate(container);
          Assert.assertEquals(5, count.getValue().length());
          Assert.assertTrue(count.getValue() instanceof DoubleArrayResult);
          DoubleArrayResult result = (DoubleArrayResult) count.getValue();
          for (int i = 0; i < 5; i++) {
              Assert.assertFalse(Double.isNaN(result.get(i)));
              Assert.assertTrue(0.0 != result.get(i));
          }
      }
test_case.class_method_signature: AutocorrelationDescriptorMassTest.test1()
test_case.full_signature: @Test public void test1()
test_case.identifier: test1
test_case.invocations: getResourceAsStream getClassLoader getClass read calculate assertEquals length getValue assertTrue getValue getValue assertFalse isNaN get assertTrue get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test1()
focal_class.declarator: NAMES       = {"ATSm1", "ATSm2", "ATSm3", "ATSm4", "ATSm5"}
focal_class.modifier: private final static
focal_class.original_string: private final static String[] NAMES       = {"ATSm1", "ATSm2", "ATSm3", "ATSm4", "ATSm5"};
focal_class.type: String[]
focal_class.var_name: NAMES
focal_class.declarator: CARBON_MASS = 12.010735896788
focal_class.modifier: private final static
focal_class.original_string: private final static double   CARBON_MASS = 12.010735896788;
focal_class.type: double
focal_class.var_name: CARBON_MASS
focal_class.file: descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/AutocorrelationDescriptorMass.java
focal_class.identifier: AutocorrelationDescriptorMass
focal_class.interfaces: implements IMolecularDescriptor
focal_class.class_method_signature: AutocorrelationDescriptorMass.scaledAtomicMasses(IElement element)
focal_class.full_signature: private static double scaledAtomicMasses(IElement element)
focal_class.identifier: scaledAtomicMasses
focal_class.modifiers: private static
focal_class.parameters: (IElement element)
focal_class.return: double
focal_class.signature: double scaledAtomicMasses(IElement element)
focal_class.class_method_signature: AutocorrelationDescriptorMass.listConvertion(IAtomContainer container)
focal_class.full_signature: private static double[] listConvertion(IAtomContainer container)
focal_class.identifier: listConvertion
focal_class.modifiers: private static
focal_class.parameters: (IAtomContainer container)
focal_class.return: double[]
focal_class.signature: double[] listConvertion(IAtomContainer container)
focal_class.class_method_signature: AutocorrelationDescriptorMass.calculate(IAtomContainer atomContainer)
focal_class.full_signature: @Override public DescriptorValue calculate(IAtomContainer atomContainer)
focal_class.identifier: calculate
focal_class.modifiers: @Override public
focal_class.parameters: (IAtomContainer atomContainer)
focal_class.return: DescriptorValue
focal_class.signature: DescriptorValue calculate(IAtomContainer atomContainer)
focal_class.class_method_signature: AutocorrelationDescriptorMass.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: AutocorrelationDescriptorMass.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: AutocorrelationDescriptorMass.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: AutocorrelationDescriptorMass.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: AutocorrelationDescriptorMass.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: AutocorrelationDescriptorMass.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: AutocorrelationDescriptorMass.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.superclass: extends AbstractMolecularDescriptor
focal_method.body: @Override
      public DescriptorValue calculate(IAtomContainer atomContainer) {
          IAtomContainer container;
          try {
              container = (IAtomContainer) atomContainer.clone();
              container = AtomContainerManipulator.removeHydrogens(container);
          } catch (CloneNotSupportedException e) {
              DoubleArrayResult result = new DoubleArrayResult(5);
              for (int i = 0; i < 5; i++)
                  result.add(Double.NaN);
              return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), result,
                      getDescriptorNames(), new CDKException("Error during cloner: " + e.getMessage(), e));
          }
  
          try {
              double[] w = listConvertion(container);
              int natom = container.getAtomCount();
              int[][] distancematrix = TopologicalMatrix.getMatrix(container);
              double[] masSum = new double[5];
  
              for (int k = 0; k < 5; k++) {
                  for (int i = 0; i < natom; i++) {
                      for (int j = 0; j < natom; j++) {
  
                          if (distancematrix[i][j] == k) {
                              masSum[k] += w[i] * w[j];
                          } else
                              masSum[k] += 0.0;
                      }
                  }
                  if (k > 0) masSum[k] = masSum[k] / 2;
  
              }
              DoubleArrayResult result = new DoubleArrayResult(5);
              for (double aMasSum : masSum) {
                  result.add(aMasSum);
              }
  
              return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), result,
                      getDescriptorNames());
  
          } catch (IOException | ClassNotFoundException ex) {
              DoubleArrayResult result = new DoubleArrayResult(5);
              for (int i = 0; i < 5; i++)
                  result.add(Double.NaN);
              return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), result,
                      getDescriptorNames(), new CDKException("Error while calculating the ATS_mass descriptor: "
                              + ex.getMessage(), ex));
          }
      }
focal_method.class_method_signature: AutocorrelationDescriptorMass.calculate(IAtomContainer atomContainer)
focal_method.full_signature: @Override public DescriptorValue calculate(IAtomContainer atomContainer)
focal_method.identifier: calculate
focal_method.invocations: clone removeHydrogens add getSpecification getParameterNames getParameters getDescriptorNames getMessage listConvertion getAtomCount getMatrix add getSpecification getParameterNames getParameters getDescriptorNames add getSpecification getParameterNames getParameters getDescriptorNames getMessage
focal_method.modifiers: @Override public
focal_method.parameters: (IAtomContainer atomContainer)
focal_method.return: DescriptorValue
focal_method.signature: DescriptorValue calculate(IAtomContainer atomContainer)