test_class.file: descriptor/qsarmolecular/src/test/java/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptorTest.java
test_class.identifier: PetitjeanShapeIndexDescriptorTest
test_class.superclass: extends MolecularDescriptorTest
test_case.body: @Test
      public void testPetiteJeanShapeNo3D() throws Exception {
          SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
          IAtomContainer atomContainer = sp.parseSmiles("CCCOCCC(O)=O");
          DescriptorValue result = descriptor.calculate(atomContainer);
          DoubleArrayResult dar = (DoubleArrayResult) result.getValue();
          Assert.assertTrue(Double.isNaN(dar.get(1)));
  
      }
test_case.class_method_signature: PetitjeanShapeIndexDescriptorTest.testPetiteJeanShapeNo3D()
test_case.full_signature: @Test public void testPetiteJeanShapeNo3D()
test_case.identifier: testPetiteJeanShapeNo3D
test_case.invocations: getInstance parseSmiles calculate getValue assertTrue isNaN get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPetiteJeanShapeNo3D()
focal_class.declarator: NAMES = {"topoShape", "geomShape"}
focal_class.modifier: private static final
focal_class.original_string: private static final String[] NAMES = {"topoShape", "geomShape"};
focal_class.type: String[]
focal_class.var_name: NAMES
focal_class.file: descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/PetitjeanShapeIndexDescriptor.java
focal_class.identifier: PetitjeanShapeIndexDescriptor
focal_class.interfaces: implements IMolecularDescriptor
focal_class.class_method_signature: PetitjeanShapeIndexDescriptor.PetitjeanShapeIndexDescriptor()
focal_class.full_signature: public  PetitjeanShapeIndexDescriptor()
focal_class.identifier: PetitjeanShapeIndexDescriptor
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  PetitjeanShapeIndexDescriptor()
focal_class.class_method_signature: PetitjeanShapeIndexDescriptor.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: PetitjeanShapeIndexDescriptor.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: PetitjeanShapeIndexDescriptor.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: PetitjeanShapeIndexDescriptor.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: PetitjeanShapeIndexDescriptor.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: PetitjeanShapeIndexDescriptor.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: PetitjeanShapeIndexDescriptor.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: PetitjeanShapeIndexDescriptor.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.superclass: extends AbstractMolecularDescriptor
focal_method.body: @Override
      public DescriptorValue calculate(IAtomContainer container) {
          IAtomContainer local = AtomContainerManipulator.removeHydrogens(container);
  
          int tradius = PathTools.getMolecularGraphRadius(local);
          int tdiameter = PathTools.getMolecularGraphDiameter(local);
  
          DoubleArrayResult retval = new DoubleArrayResult();
          retval.add((double) (tdiameter - tradius) / (double) tradius);
  
          // get the 3D distance matrix
          if (GeometryUtil.has3DCoordinates(container)) {
              int natom = container.getAtomCount();
              double[][] distanceMatrix = new double[natom][natom];
              for (int i = 0; i < natom; i++) {
                  for (int j = 0; j < natom; j++) {
                      if (i == j) {
                          distanceMatrix[i][j] = 0.0;
                          continue;
                      }
  
                      Point3d a = container.getAtom(i).getPoint3d();
                      Point3d b = container.getAtom(j).getPoint3d();
                      distanceMatrix[i][j] = Math.sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)
                              + (a.z - b.z) * (a.z - b.z));
                  }
              }
              double gradius = 999999;
              double gdiameter = -999999;
              double[] geta = new double[natom];
              for (int i = 0; i < natom; i++) {
                  double max = -99999;
                  for (int j = 0; j < natom; j++) {
                      if (distanceMatrix[i][j] > max) max = distanceMatrix[i][j];
                  }
                  geta[i] = max;
              }
              for (int i = 0; i < natom; i++) {
                  if (geta[i] < gradius) gradius = geta[i];
                  if (geta[i] > gdiameter) gdiameter = geta[i];
              }
              retval.add((gdiameter - gradius) / gradius);
          } else {
              retval.add(Double.NaN);
          }
  
          return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval,
                  getDescriptorNames());
      }
focal_method.class_method_signature: PetitjeanShapeIndexDescriptor.calculate(IAtomContainer container)
focal_method.full_signature: @Override public DescriptorValue calculate(IAtomContainer container)
focal_method.identifier: calculate
focal_method.invocations: removeHydrogens getMolecularGraphRadius getMolecularGraphDiameter add has3DCoordinates getAtomCount getPoint3d getAtom getPoint3d getAtom sqrt 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)