test_class.declarator: standAlone = false
test_class.original_string: boolean standAlone = false;
test_class.type: boolean
test_class.var_name: standAlone
test_class.file: descriptor/fingerprint/src/test/java/org/openscience/cdk/similarity/DistanceMomentTest.java
test_class.identifier: DistanceMomentTest
test_class.superclass: extends CDKTestCase
test_case.body: @Test
      public void testGenerateMoments() throws Exception {
          String filename = "data/mdl/sim3d1.sdf";
          IAtomContainer ac = loadMolecule(filename);
          float[] expected = new float[]{3.710034f, 1.780116f, 0.26535583f, 3.7945938f, 2.2801101f, 0.20164771f, 7.1209f,
                  9.234152f, -0.49032924f, 6.6067924f, 8.89391f, -0.048539735f};
          float[] actual = DistanceMoment.generateMoments(ac);
  
          // no assertArrayEquals for junit 4.5
          for (int i = 0; i < expected.length; i++) {
              Assert.assertEquals(expected[i], actual[i], 0.000001);
          }
  
      }
test_case.class_method_signature: DistanceMomentTest.testGenerateMoments()
test_case.full_signature: @Test public void testGenerateMoments()
test_case.identifier: testGenerateMoments
test_case.invocations: loadMolecule generateMoments assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGenerateMoments()
focal_class.file: descriptor/fingerprint/src/main/java/org/openscience/cdk/similarity/DistanceMoment.java
focal_class.identifier: DistanceMoment
focal_class.class_method_signature: DistanceMoment.getGeometricCenter(IAtomContainer atomContainer)
focal_class.full_signature: private static Point3d getGeometricCenter(IAtomContainer atomContainer)
focal_class.identifier: getGeometricCenter
focal_class.modifiers: private static
focal_class.parameters: (IAtomContainer atomContainer)
focal_class.return: Point3d
focal_class.signature: Point3d getGeometricCenter(IAtomContainer atomContainer)
focal_class.class_method_signature: DistanceMoment.mu1(double[] x)
focal_class.full_signature: private static float mu1(double[] x)
focal_class.identifier: mu1
focal_class.modifiers: private static
focal_class.parameters: (double[] x)
focal_class.return: float
focal_class.signature: float mu1(double[] x)
focal_class.class_method_signature: DistanceMoment.mu2(double[] x, double mean)
focal_class.full_signature: private static float mu2(double[] x, double mean)
focal_class.identifier: mu2
focal_class.modifiers: private static
focal_class.parameters: (double[] x, double mean)
focal_class.return: float
focal_class.signature: float mu2(double[] x, double mean)
focal_class.class_method_signature: DistanceMoment.mu3(double[] x, double mean, double sigma)
focal_class.full_signature: private static float mu3(double[] x, double mean, double sigma)
focal_class.identifier: mu3
focal_class.modifiers: private static
focal_class.parameters: (double[] x, double mean, double sigma)
focal_class.return: float
focal_class.signature: float mu3(double[] x, double mean, double sigma)
focal_class.class_method_signature: DistanceMoment.generateMoments(IAtomContainer atomContainer)
focal_class.full_signature: public static float[] generateMoments(IAtomContainer atomContainer)
focal_class.identifier: generateMoments
focal_class.modifiers: public static
focal_class.parameters: (IAtomContainer atomContainer)
focal_class.return: float[]
focal_class.signature: float[] generateMoments(IAtomContainer atomContainer)
focal_class.class_method_signature: DistanceMoment.calculate(IAtomContainer query, IAtomContainer target)
focal_class.full_signature: public static float calculate(IAtomContainer query, IAtomContainer target)
focal_class.identifier: calculate
focal_class.modifiers: public static
focal_class.parameters: (IAtomContainer query, IAtomContainer target)
focal_class.return: float
focal_class.signature: float calculate(IAtomContainer query, IAtomContainer target)
focal_method.body: public static float[] generateMoments(IAtomContainer atomContainer) throws CDKException {
          // lets check if we have 3D coordinates
          Iterator<IAtom> atoms;
  
          int natom = atomContainer.getAtomCount();
  
          Point3d ctd = getGeometricCenter(atomContainer);
          Point3d cst = new Point3d();
          Point3d fct = new Point3d();
          Point3d ftf = new Point3d();
  
          double[] distCtd = new double[natom];
          double[] distCst = new double[natom];
          double[] distFct = new double[natom];
          double[] distFtf = new double[natom];
  
          atoms = atomContainer.atoms().iterator();
          int counter = 0;
          double min = Double.MAX_VALUE;
          double max = Double.MIN_VALUE;
  
          // eval dist to centroid
          while (atoms.hasNext()) {
              IAtom atom = atoms.next();
              Point3d p = atom.getPoint3d();
              double d = p.distance(ctd);
              distCtd[counter++] = d;
  
              if (d < min) {
                  cst.x = p.x;
                  cst.y = p.y;
                  cst.z = p.z;
                  min = d;
              }
              if (d > max) {
                  fct.x = p.x;
                  fct.y = p.y;
                  fct.z = p.z;
                  max = d;
              }
          }
  
          // eval dist to cst
          atoms = atomContainer.atoms().iterator();
          counter = 0;
          while (atoms.hasNext()) {
              IAtom atom = atoms.next();
              Point3d p = atom.getPoint3d();
              double d = p.distance(cst);
              distCst[counter++] = d;
          }
  
          // eval dist to fct
          atoms = atomContainer.atoms().iterator();
          counter = 0;
          max = Double.MIN_VALUE;
          while (atoms.hasNext()) {
              IAtom atom = atoms.next();
              Point3d p = atom.getPoint3d();
              double d = p.distance(fct);
              distFct[counter++] = d;
  
              if (d > max) {
                  ftf.x = p.x;
                  ftf.y = p.y;
                  ftf.z = p.z;
                  max = d;
              }
          }
  
          // eval dist to ftf
          atoms = atomContainer.atoms().iterator();
          counter = 0;
          while (atoms.hasNext()) {
              IAtom atom = atoms.next();
              Point3d p = atom.getPoint3d();
              double d = p.distance(ftf);
              distFtf[counter++] = d;
          }
  
          float[] moments = new float[12];
  
          float mean = mu1(distCtd);
          float sigma2 = mu2(distCtd, mean);
          float skewness = mu3(distCtd, mean, Math.sqrt(sigma2));
          moments[0] = mean;
          moments[1] = sigma2;
          moments[2] = skewness;
  
          mean = mu1(distCst);
          sigma2 = mu2(distCst, mean);
          skewness = mu3(distCst, mean, Math.sqrt(sigma2));
          moments[3] = mean;
          moments[4] = sigma2;
          moments[5] = skewness;
  
          mean = mu1(distFct);
          sigma2 = mu2(distFct, mean);
          skewness = mu3(distFct, mean, Math.sqrt(sigma2));
          moments[6] = mean;
          moments[7] = sigma2;
          moments[8] = skewness;
  
          mean = mu1(distFtf);
          sigma2 = mu2(distFtf, mean);
          skewness = mu3(distFtf, mean, Math.sqrt(sigma2));
          moments[9] = mean;
          moments[10] = sigma2;
          moments[11] = skewness;
  
          return moments;
      }
focal_method.class_method_signature: DistanceMoment.generateMoments(IAtomContainer atomContainer)
focal_method.full_signature: public static float[] generateMoments(IAtomContainer atomContainer)
focal_method.identifier: generateMoments
focal_method.invocations: getAtomCount getGeometricCenter iterator atoms hasNext next getPoint3d distance iterator atoms hasNext next getPoint3d distance iterator atoms hasNext next getPoint3d distance iterator atoms hasNext next getPoint3d distance mu1 mu2 mu3 sqrt mu1 mu2 mu3 sqrt mu1 mu2 mu3 sqrt mu1 mu2 mu3 sqrt
focal_method.modifiers: public static
focal_method.parameters: (IAtomContainer atomContainer)
focal_method.return: float[]
focal_method.signature: float[] generateMoments(IAtomContainer atomContainer)