test_class.declarator: builder = SilentChemObjectBuilder.getInstance()
test_class.modifier: private
test_class.original_string: private IChemObjectBuilder      builder = SilentChemObjectBuilder.getInstance();
test_class.type: IChemObjectBuilder
test_class.var_name: builder
test_class.declarator: lpcheck = new LonePairElectronChecker()
test_class.modifier: private
test_class.original_string: private LonePairElectronChecker lpcheck = new LonePairElectronChecker();
test_class.type: LonePairElectronChecker
test_class.var_name: lpcheck
test_class.file: tool/charges/src/test/java/org/openscience/cdk/charges/StabilizationChargesTest.java
test_class.identifier: StabilizationChargesTest
test_class.superclass: extends CDKTestCase
test_case.body: @Test
      @Category(SlowTest.class)
      public void testCalculatePositive_IAtomContainer_IAtom() throws Exception {
  
          StabilizationCharges sc = new StabilizationCharges();
  
          IAtomContainer molecule = builder.newInstance(IAtomContainer.class);
          molecule.addAtom(new Atom("C"));
          molecule.addAtom(new Atom("C"));
          molecule.addBond(0, 1, IBond.Order.SINGLE);
          molecule.getAtom(1).setFormalCharge(+1);
          molecule.addAtom(new Atom("C"));
          molecule.addBond(1, 2, IBond.Order.SINGLE);
          molecule.addAtom(new Atom("C"));
          molecule.addBond(2, 3, IBond.Order.DOUBLE);
  
          addExplicitHydrogens(molecule);
          AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule);
          lpcheck.saturate(molecule);
  
          for (int i = 0; i < molecule.getAtomCount(); i++) {
              if (i == 1)
                  Assert.assertNotSame(0.0, sc.calculatePositive(molecule, molecule.getAtom(i)));
              else
                  Assert.assertEquals(0.0, sc.calculatePositive(molecule, molecule.getAtom(i)), 0.001);
  
          }
      }
test_case.class_method_signature: StabilizationChargesTest.testCalculatePositive_IAtomContainer_IAtom()
test_case.full_signature: @Test @Category(SlowTest.class) public void testCalculatePositive_IAtomContainer_IAtom()
test_case.identifier: testCalculatePositive_IAtomContainer_IAtom
test_case.invocations: newInstance addAtom addAtom addBond setFormalCharge getAtom addAtom addBond addAtom addBond addExplicitHydrogens percieveAtomTypesAndConfigureAtoms saturate getAtomCount assertNotSame calculatePositive getAtom assertEquals calculatePositive getAtom
test_case.modifiers: @Test @Category(SlowTest.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCalculatePositive_IAtomContainer_IAtom()
focal_class.file: tool/charges/src/main/java/org/openscience/cdk/charges/StabilizationCharges.java
focal_class.identifier: StabilizationCharges
focal_class.class_method_signature: StabilizationCharges.StabilizationCharges()
focal_class.full_signature: public  StabilizationCharges()
focal_class.identifier: StabilizationCharges
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  StabilizationCharges()
focal_class.class_method_signature: StabilizationCharges.calculatePositive(IAtomContainer atomContainer, IAtom atom)
focal_class.full_signature: public double calculatePositive(IAtomContainer atomContainer, IAtom atom)
focal_class.identifier: calculatePositive
focal_class.modifiers: public
focal_class.parameters: (IAtomContainer atomContainer, IAtom atom)
focal_class.return: double
focal_class.signature: double calculatePositive(IAtomContainer atomContainer, IAtom atom)
focal_method.body: public double calculatePositive(IAtomContainer atomContainer, IAtom atom) {
          /* restrictions */
          //    	if(atomContainer.getConnectedSingleElectronsCount(atom) > 0 || atom.getFormalCharge() != 1){
          if (atom.getFormalCharge() != 1) {
              return 0.0;
          }
  
          // only must be generated all structures which stabilize the atom in question.
          StructureResonanceGenerator gRI = new StructureResonanceGenerator();
          List<IReactionProcess> reactionList = gRI.getReactions();
          reactionList.add(new HyperconjugationReaction());
          gRI.setReactions(reactionList);
          IAtomContainerSet resonanceS = gRI.getStructures(atomContainer);
          IAtomContainerSet containerS = gRI.getContainers(atomContainer);
          if (resonanceS.getAtomContainerCount() < 2) // meaning it was not find any resonance structure
              return 0.0;
  
          final int positionStart = atomContainer.indexOf(atom);
  
          List<Double> result1 = new ArrayList<Double>();
          List<Integer> distance1 = new ArrayList<Integer>();
  
          resonanceS.removeAtomContainer(0);// the first is the initial structure
          for (Iterator<IAtomContainer> itA = resonanceS.atomContainers().iterator(); itA.hasNext();) {
              final IAtomContainer resonance = itA.next();
  
              if (resonance.getAtomCount() < 2) // resonance with only one atom donnot have resonance
                  continue;
  
              final ShortestPaths shortestPaths = new ShortestPaths(resonance, resonance.getAtom(positionStart));
  
              /* search positive charge */
  
              PiElectronegativity electronegativity = new PiElectronegativity();
  
              for (Iterator<IAtom> itAtoms = resonance.atoms().iterator(); itAtoms.hasNext();) {
                  IAtom atomP = itAtoms.next();
                  IAtom atomR = atomContainer.getAtom(resonance.indexOf(atomP));
                  if (containerS.getAtomContainer(0).contains(atomR)) {
  
                      electronegativity.setMaxIterations(6);
                      double result = electronegativity.calculatePiElectronegativity(resonance, atomP);
                      result1.add(result);
  
                      int dis = shortestPaths.distanceTo(atomP);
                      distance1.add(dis);
                  }
  
              }
          }
          /* logarithm */
          double value = 0.0;
          double sum = 0.0;
          Iterator<Integer> itDist = distance1.iterator();
          for (Iterator<Double> itElec = result1.iterator(); itElec.hasNext();) {
              double suM = itElec.next();
              if (suM < 0) suM = -1 * suM;
              sum += suM * Math.pow(0.67, itDist.next().intValue());
          }
          value = sum;
  
          return value;
      }
focal_method.class_method_signature: StabilizationCharges.calculatePositive(IAtomContainer atomContainer, IAtom atom)
focal_method.full_signature: public double calculatePositive(IAtomContainer atomContainer, IAtom atom)
focal_method.identifier: calculatePositive
focal_method.invocations: getFormalCharge getReactions add setReactions getStructures getContainers getAtomContainerCount indexOf removeAtomContainer iterator atomContainers hasNext next getAtomCount getAtom iterator atoms hasNext next getAtom indexOf contains getAtomContainer setMaxIterations calculatePiElectronegativity add distanceTo add iterator iterator hasNext next pow intValue next
focal_method.modifiers: public
focal_method.parameters: (IAtomContainer atomContainer, IAtom atom)
focal_method.return: double
focal_method.signature: double calculatePositive(IAtomContainer atomContainer, IAtom atom)