test_class.file: descriptor/qsarmolecular/src/test/java/org/openscience/cdk/qsar/descriptors/molecular/LengthOverBreadthDescriptorTest.java
test_class.identifier: LengthOverBreadthDescriptorTest
test_class.superclass: extends MolecularDescriptorTest
test_case.body: @Test
      public void testLOBDescriptorCholesterol() throws Exception {
          String filename = "data/mdl/lobtest.sdf";
          InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename);
          ISimpleChemObjectReader reader = new MDLV2000Reader(ins);
          ChemFile content = (ChemFile) reader.read(new ChemFile());
          List cList = ChemFileManipulator.getAllAtomContainers(content);
          IAtomContainer ac = (IAtomContainer) cList.get(0);
          Isotopes.getInstance().configureAtoms(ac);
  
          DoubleArrayResult result = (DoubleArrayResult) descriptor.calculate(ac).getValue();
  
          Assert.assertEquals(3.5029, result.get(0), 0.001);
          Assert.assertEquals(3.5029, result.get(1), 0.001);
      }
test_case.class_method_signature: LengthOverBreadthDescriptorTest.testLOBDescriptorCholesterol()
test_case.full_signature: @Test public void testLOBDescriptorCholesterol()
test_case.identifier: testLOBDescriptorCholesterol
test_case.invocations: getResourceAsStream getClassLoader getClass read getAllAtomContainers get configureAtoms getInstance getValue calculate assertEquals get assertEquals get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testLOBDescriptorCholesterol()
focal_class.declarator: logger = LoggingToolFactory.createLoggingTool(LengthOverBreadthDescriptor.class)
focal_class.modifier: private static
focal_class.original_string: private static ILoggingTool   logger = LoggingToolFactory.createLoggingTool(LengthOverBreadthDescriptor.class);
focal_class.type: ILoggingTool
focal_class.var_name: logger
focal_class.declarator: NAMES  = {"LOBMAX", "LOBMIN"}
focal_class.modifier: private static final
focal_class.original_string: private static final String[] NAMES  = {"LOBMAX", "LOBMIN"};
focal_class.type: String[]
focal_class.var_name: NAMES
focal_class.file: descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/LengthOverBreadthDescriptor.java
focal_class.identifier: LengthOverBreadthDescriptor
focal_class.interfaces: implements IMolecularDescriptor
focal_class.class_method_signature: LengthOverBreadthDescriptor.LengthOverBreadthDescriptor()
focal_class.full_signature: public  LengthOverBreadthDescriptor()
focal_class.identifier: LengthOverBreadthDescriptor
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  LengthOverBreadthDescriptor()
focal_class.class_method_signature: LengthOverBreadthDescriptor.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: LengthOverBreadthDescriptor.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: LengthOverBreadthDescriptor.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: LengthOverBreadthDescriptor.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: LengthOverBreadthDescriptor.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.class_method_signature: LengthOverBreadthDescriptor.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: LengthOverBreadthDescriptor.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: LengthOverBreadthDescriptor.rotateZ(double[][] coords, double theta)
focal_class.full_signature: private void rotateZ(double[][] coords, double theta)
focal_class.identifier: rotateZ
focal_class.modifiers: private
focal_class.parameters: (double[][] coords, double theta)
focal_class.return: void
focal_class.signature: void rotateZ(double[][] coords, double theta)
focal_class.class_method_signature: LengthOverBreadthDescriptor.extents(IAtomContainer atomContainer, double[][] coords, boolean withRadii)
focal_class.full_signature: private double[] extents(IAtomContainer atomContainer, double[][] coords, boolean withRadii)
focal_class.identifier: extents
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer atomContainer, double[][] coords, boolean withRadii)
focal_class.return: double[]
focal_class.signature: double[] extents(IAtomContainer atomContainer, double[][] coords, boolean withRadii)
focal_class.class_method_signature: LengthOverBreadthDescriptor.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: LengthOverBreadthDescriptor.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.superclass: extends AbstractMolecularDescriptor
focal_method.body: @Override
      public DescriptorValue calculate(IAtomContainer atomContainer) {
          if (!GeometryUtil.has3DCoordinates(atomContainer))
              return getDummyDescriptorValue(new CDKException("Molecule must have 3D coordinates"));
  
          double angle = 10.0;
          double maxLOB = 0;
          double minArea = 1e6;
          double mmLOB = 0;
  
          double lob, bol, area;
          double[] xyzRanges;
  
          double[][] coords = new double[atomContainer.getAtomCount()][3];
          for (int i = 0; i < atomContainer.getAtomCount(); i++) {
              coords[i][0] = atomContainer.getAtom(i).getPoint3d().x;
              coords[i][1] = atomContainer.getAtom(i).getPoint3d().y;
              coords[i][2] = atomContainer.getAtom(i).getPoint3d().z;
          }
  
          // get the com
          Point3d com = GeometryUtil.get3DCentreOfMass(atomContainer);
          if (com == null) 
              return getDummyDescriptorValue(new CDKException("Error in center of mass calculation, has exact mass been set on all atoms?"));
  
          // translate everything to COM
          for (int i = 0; i < coords.length; i++) {
              coords[i][0] -= com.x;
              coords[i][1] -= com.y;
              coords[i][2] -= com.z;
          }
  
          int nangle = (int) (90 / angle);
          for (int i = 0; i < nangle; i++) {
              rotateZ(coords, Math.PI / 180.0 * angle);
              try {
                  xyzRanges = extents(atomContainer, coords, true);
              } catch (CDKException e) {
                  return getDummyDescriptorValue(e);
              }
              lob = xyzRanges[0] / xyzRanges[1];
              bol = 1.0 / lob;
              if (lob < bol) {
                  double tmp = lob;
                  lob = bol;
                  bol = tmp;
              }
              area = xyzRanges[0] * xyzRanges[1];
              if (lob > maxLOB) maxLOB = lob;
              if (area < minArea) {
                  minArea = area;
                  mmLOB = lob;
              }
          }
  
          DoubleArrayResult result = new DoubleArrayResult(2);
          result.add(maxLOB);
          result.add(mmLOB);
  
          return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), result,
                  getDescriptorNames());
      }
focal_method.class_method_signature: LengthOverBreadthDescriptor.calculate(IAtomContainer atomContainer)
focal_method.full_signature: @Override public DescriptorValue calculate(IAtomContainer atomContainer)
focal_method.identifier: calculate
focal_method.invocations: has3DCoordinates getDummyDescriptorValue getAtomCount getAtomCount getPoint3d getAtom getPoint3d getAtom getPoint3d getAtom get3DCentreOfMass getDummyDescriptorValue rotateZ extents getDummyDescriptorValue add add getSpecification getParameterNames getParameters getDescriptorNames
focal_method.modifiers: @Override public
focal_method.parameters: (IAtomContainer atomContainer)
focal_method.return: DescriptorValue
focal_method.signature: DescriptorValue calculate(IAtomContainer atomContainer)