test_class.file: descriptor/qsarmolecular/src/test/java/org/openscience/cdk/qsar/descriptors/molecular/HBondAcceptorCountDescriptorTest.java
test_class.identifier: HBondAcceptorCountDescriptorTest
test_class.superclass: extends MolecularDescriptorTest
test_case.body: @Test
      public void exocyclicOxygenInAromaticRing() throws InvalidSmilesException {
          SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
          IAtomContainer m = sp.parseSmiles("Cn1c2nc([nH]c2c(=O)n(c1=O)C)C1CCCC1");
  
          HBondAcceptorCountDescriptor hbond_acceptor_desc = new HBondAcceptorCountDescriptor();
          int actual = ((IntegerResult)hbond_acceptor_desc.calculate(m).getValue()).intValue();
          org.hamcrest.MatcherAssert.assertThat(actual, CoreMatchers.is(3));
      }
test_case.class_method_signature: HBondAcceptorCountDescriptorTest.exocyclicOxygenInAromaticRing()
test_case.full_signature: @Test public void exocyclicOxygenInAromaticRing()
test_case.identifier: exocyclicOxygenInAromaticRing
test_case.invocations: getInstance parseSmiles intValue getValue calculate assertThat is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void exocyclicOxygenInAromaticRing()
focal_class.declarator: checkAromaticity = false
focal_class.modifier: private
focal_class.original_string: private boolean               checkAromaticity = false;
focal_class.type: boolean
focal_class.var_name: checkAromaticity
focal_class.declarator: NAMES            = {"nHBAcc"}
focal_class.modifier: private static final
focal_class.original_string: private static final String[] NAMES            = {"nHBAcc"};
focal_class.type: String[]
focal_class.var_name: NAMES
focal_class.file: descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/HBondAcceptorCountDescriptor.java
focal_class.identifier: HBondAcceptorCountDescriptor
focal_class.interfaces: implements IMolecularDescriptor
focal_class.class_method_signature: HBondAcceptorCountDescriptor.HBondAcceptorCountDescriptor()
focal_class.full_signature: public  HBondAcceptorCountDescriptor()
focal_class.identifier: HBondAcceptorCountDescriptor
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  HBondAcceptorCountDescriptor()
focal_class.class_method_signature: HBondAcceptorCountDescriptor.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: HBondAcceptorCountDescriptor.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: HBondAcceptorCountDescriptor.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: HBondAcceptorCountDescriptor.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: HBondAcceptorCountDescriptor.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: HBondAcceptorCountDescriptor.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: HBondAcceptorCountDescriptor.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: HBondAcceptorCountDescriptor.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: HBondAcceptorCountDescriptor.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) {
          int hBondAcceptors = 0;
  
          IAtomContainer ac;
          try {
              ac = (IAtomContainer) atomContainer.clone();
          } catch (CloneNotSupportedException e) {
              return getDummyDescriptorValue(e);
          }
  
          // aromaticity is detected prior to descriptor calculation if the respective parameter is set to true
  
          if (checkAromaticity) {
              try {
                  AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(ac);
                  Aromaticity.cdkLegacy().apply(ac);
              } catch (CDKException e) {
                  return getDummyDescriptorValue(e);
              }
          }
  
          //org.openscience.cdk.interfaces.IAtom[] atoms = ac.getAtoms();
          // labelled for loop to allow for labelled continue statements within the loop
          atomloop: for (IAtom atom : ac.atoms()) {
              // looking for suitable nitrogen atoms
              if (atom.getAtomicNumber() == IElement.N && atom.getFormalCharge() <= 0) {
  
                  // excluding nitrogens that are adjacent to an oxygen
                  List<IBond> bonds = ac.getConnectedBondsList(atom);
                  int nPiBonds = 0;
                  for (IBond bond : bonds) {
                      if (bond.getOther(atom).getAtomicNumber() == IElement.O) continue atomloop;
                      if (IBond.Order.DOUBLE.equals(bond.getOrder())) nPiBonds++;
                  }
  
                  // if the nitrogen is aromatic and there are no pi bonds then it's
                  // lone pair cannot accept any hydrogen bonds
                  if (atom.getFlag(CDKConstants.ISAROMATIC) && nPiBonds == 0) continue;
  
                  hBondAcceptors++;
              }
              // looking for suitable oxygen atoms
              else if (atom.getAtomicNumber() == IElement.O && atom.getFormalCharge() <= 0) {
                  //excluding oxygens that are adjacent to a nitrogen or to an aromatic carbon
                  List<IBond> neighbours = ac.getConnectedBondsList(atom);
                  for (IBond bond : neighbours) {
                      IAtom neighbor = bond.getOther(atom);
                      if (neighbor.getAtomicNumber() == IElement.N ||
                          (neighbor.getAtomicNumber() == IElement.C &&
                           neighbor.isAromatic() &&
                           bond.getOrder() != IBond.Order.DOUBLE))
                          continue atomloop;;
                  }
                  hBondAcceptors++;
              }
          }
  
          return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
                  hBondAcceptors), getDescriptorNames());
      }
focal_method.class_method_signature: HBondAcceptorCountDescriptor.calculate(IAtomContainer atomContainer)
focal_method.full_signature: @Override public DescriptorValue calculate(IAtomContainer atomContainer)
focal_method.identifier: calculate
focal_method.invocations: clone getDummyDescriptorValue percieveAtomTypesAndConfigureAtoms apply cdkLegacy getDummyDescriptorValue atoms getAtomicNumber getFormalCharge getConnectedBondsList getAtomicNumber getOther equals getOrder getFlag getAtomicNumber getFormalCharge getConnectedBondsList getOther getAtomicNumber getAtomicNumber isAromatic getOrder 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)