test_class.declarator: fbot
test_class.modifier: private static
test_class.original_string: private static FixBondOrdersTool fbot;
test_class.type: FixBondOrdersTool
test_class.var_name: fbot
test_class.file: legacy/src/test/java/org/openscience/cdk/smiles/FixBondOrdersToolTest.java
test_class.identifier: FixBondOrdersToolTest
test_class.superclass: extends CDKTestCase
test_case.body: @Test
      public void xtestPyrrole() throws Exception {
          IAtomContainer enol = new AtomContainer();
  
          // atom block
          IAtom atom1 = new Atom(Elements.CARBON);
          atom1.setHybridization(Hybridization.SP2);
          IAtom atom2 = new Atom(Elements.CARBON);
          atom2.setHybridization(Hybridization.SP2);
          IAtom atom3 = new Atom(Elements.CARBON);
          atom3.setHybridization(Hybridization.SP2);
          IAtom atom4 = new Atom(Elements.CARBON);
          atom4.setHybridization(Hybridization.SP2);
          IAtom atom5 = new Atom(Elements.NITROGEN);
          atom5.setHybridization(Hybridization.SP2);
          atom5.setImplicitHydrogenCount(1);
  
          // bond block
          IBond bond1 = new Bond(atom1, atom2);
          IBond bond2 = new Bond(atom2, atom3);
          IBond bond3 = new Bond(atom3, atom4);
          IBond bond4 = new Bond(atom4, atom5);
          IBond bond5 = new Bond(atom5, atom1);
  
          enol.addAtom(atom1);
          enol.addAtom(atom2);
          enol.addAtom(atom3);
          enol.addAtom(atom4);
          enol.addAtom(atom5);
          enol.addBond(bond1);
          enol.addBond(bond2);
          enol.addBond(bond3);
          enol.addBond(bond4);
          enol.addBond(bond5);
  
          // perceive atom types
          AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(enol);
  
          // now have the algorithm have a go at it
          enol = fbot.kekuliseAromaticRings(enol);
          Assert.assertNotNull(enol);
          //Assert.assertTrue(fbot.isOK(enol));
  
          // now check whether it did the right thing
          Assert.assertEquals(Order.DOUBLE, enol.getBond(0).getOrder());;
          Assert.assertEquals(Order.SINGLE, enol.getBond(1).getOrder());;
          Assert.assertEquals(Order.DOUBLE, enol.getBond(2).getOrder());;
          Assert.assertEquals(Order.SINGLE, enol.getBond(3).getOrder());;
          Assert.assertEquals(Order.SINGLE, enol.getBond(4).getOrder());;
      }
test_case.class_method_signature: FixBondOrdersToolTest.xtestPyrrole()
test_case.full_signature: @Test public void xtestPyrrole()
test_case.identifier: xtestPyrrole
test_case.invocations: setHybridization setHybridization setHybridization setHybridization setHybridization setImplicitHydrogenCount addAtom addAtom addAtom addAtom addAtom addBond addBond addBond addBond addBond percieveAtomTypesAndConfigureAtoms kekuliseAromaticRings assertNotNull assertEquals getOrder getBond assertEquals getOrder getBond assertEquals getOrder getBond assertEquals getOrder getBond assertEquals getOrder getBond
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void xtestPyrrole()
focal_class.declarator: interrupted
focal_class.modifier: private
focal_class.original_string: private boolean interrupted;
focal_class.type: boolean
focal_class.var_name: interrupted
focal_class.file: legacy/src/main/java/org/openscience/cdk/smiles/FixBondOrdersTool.java
focal_class.identifier: FixBondOrdersTool
focal_class.class_method_signature: FixBondOrdersTool.FixBondOrdersTool()
focal_class.full_signature: public  FixBondOrdersTool()
focal_class.identifier: FixBondOrdersTool
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  FixBondOrdersTool()
focal_class.class_method_signature: FixBondOrdersTool.kekuliseAromaticRings(IAtomContainer molecule)
focal_class.full_signature: public IAtomContainer kekuliseAromaticRings(IAtomContainer molecule)
focal_class.identifier: kekuliseAromaticRings
focal_class.modifiers: public
focal_class.parameters: (IAtomContainer molecule)
focal_class.return: IAtomContainer
focal_class.signature: IAtomContainer kekuliseAromaticRings(IAtomContainer molecule)
focal_class.class_method_signature: FixBondOrdersTool.removeExtraRings(IAtomContainer m)
focal_class.full_signature: private IRingSet removeExtraRings(IAtomContainer m)
focal_class.identifier: removeExtraRings
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer m)
focal_class.return: IRingSet
focal_class.signature: IRingSet removeExtraRings(IAtomContainer m)
focal_class.class_method_signature: FixBondOrdersTool.getRingSystem(IAtomContainer mol, IRingSet ringSet)
focal_class.full_signature: private List<Integer[]> getRingSystem(IAtomContainer mol, IRingSet ringSet)
focal_class.identifier: getRingSystem
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer mol, IRingSet ringSet)
focal_class.return: List<Integer[]>
focal_class.signature: List<Integer[]> getRingSystem(IAtomContainer mol, IRingSet ringSet)
focal_class.class_method_signature: FixBondOrdersTool.assignRingGroups(List<Integer[]> rBondsArray)
focal_class.full_signature: private List<List<Integer>> assignRingGroups(List<Integer[]> rBondsArray)
focal_class.identifier: assignRingGroups
focal_class.modifiers: private
focal_class.parameters: (List<Integer[]> rBondsArray)
focal_class.return: List<List<Integer>>
focal_class.signature: List<List<Integer>> assignRingGroups(List<Integer[]> rBondsArray)
focal_class.class_method_signature: FixBondOrdersTool.combineGroups(List<List<Integer>> ringGroups)
focal_class.full_signature: private Boolean combineGroups(List<List<Integer>> ringGroups)
focal_class.identifier: combineGroups
focal_class.modifiers: private
focal_class.parameters: (List<List<Integer>> ringGroups)
focal_class.return: Boolean
focal_class.signature: Boolean combineGroups(List<List<Integer>> ringGroups)
focal_class.class_method_signature: FixBondOrdersTool.setAllRingBondsSingleOrder(List<Integer> ringGroup, IRingSet ringSet)
focal_class.full_signature: private Boolean setAllRingBondsSingleOrder(List<Integer> ringGroup, IRingSet ringSet)
focal_class.identifier: setAllRingBondsSingleOrder
focal_class.modifiers: private
focal_class.parameters: (List<Integer> ringGroup, IRingSet ringSet)
focal_class.return: Boolean
focal_class.signature: Boolean setAllRingBondsSingleOrder(List<Integer> ringGroup, IRingSet ringSet)
focal_class.class_method_signature: FixBondOrdersTool.getAtomNosForRingGroup(IAtomContainer molecule, List<Integer> ringGroup, IRingSet ringSet)
focal_class.full_signature: private List<Integer> getAtomNosForRingGroup(IAtomContainer molecule, List<Integer> ringGroup, IRingSet ringSet)
focal_class.identifier: getAtomNosForRingGroup
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer molecule, List<Integer> ringGroup, IRingSet ringSet)
focal_class.return: List<Integer>
focal_class.signature: List<Integer> getAtomNosForRingGroup(IAtomContainer molecule, List<Integer> ringGroup, IRingSet ringSet)
focal_class.class_method_signature: FixBondOrdersTool.getBondNosForRingGroup(IAtomContainer molecule, List<Integer> ringGroup, IRingSet ringSet)
focal_class.full_signature: private List<Integer> getBondNosForRingGroup(IAtomContainer molecule, List<Integer> ringGroup, IRingSet ringSet)
focal_class.identifier: getBondNosForRingGroup
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer molecule, List<Integer> ringGroup, IRingSet ringSet)
focal_class.return: List<Integer>
focal_class.signature: List<Integer> getBondNosForRingGroup(IAtomContainer molecule, List<Integer> ringGroup, IRingSet ringSet)
focal_class.class_method_signature: FixBondOrdersTool.getAtomNoPairsForRingGroup(IAtomContainer molecule, List<Integer> bondsToCheck)
focal_class.full_signature: private List<Integer[]> getAtomNoPairsForRingGroup(IAtomContainer molecule, List<Integer> bondsToCheck)
focal_class.identifier: getAtomNoPairsForRingGroup
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer molecule, List<Integer> bondsToCheck)
focal_class.return: List<Integer[]>
focal_class.signature: List<Integer[]> getAtomNoPairsForRingGroup(IAtomContainer molecule, List<Integer> bondsToCheck)
focal_class.class_method_signature: FixBondOrdersTool.getFreeValenciesForRingGroup(IAtomContainer molecule, List<Integer> atomsToCheck, Matrix M,
              IRingSet rs)
focal_class.full_signature: private List<Integer> getFreeValenciesForRingGroup(IAtomContainer molecule, List<Integer> atomsToCheck, Matrix M,
              IRingSet rs)
focal_class.identifier: getFreeValenciesForRingGroup
focal_class.modifiers: private
focal_class.parameters: (IAtomContainer molecule, List<Integer> atomsToCheck, Matrix M,
              IRingSet rs)
focal_class.return: List<Integer>
focal_class.signature: List<Integer> getFreeValenciesForRingGroup(IAtomContainer molecule, List<Integer> atomsToCheck, Matrix M,
              IRingSet rs)
focal_class.class_method_signature: FixBondOrdersTool.solveMatrix(Matrix M, List<Integer> atomNos, List<Integer> bondNos, List<Integer> freeValencies,
              List<Integer[]> atomNoPairs, List<Integer> bondOrder)
focal_class.full_signature: private Boolean solveMatrix(Matrix M, List<Integer> atomNos, List<Integer> bondNos, List<Integer> freeValencies,
              List<Integer[]> atomNoPairs, List<Integer> bondOrder)
focal_class.identifier: solveMatrix
focal_class.modifiers: private
focal_class.parameters: (Matrix M, List<Integer> atomNos, List<Integer> bondNos, List<Integer> freeValencies,
              List<Integer[]> atomNoPairs, List<Integer> bondOrder)
focal_class.return: Boolean
focal_class.signature: Boolean solveMatrix(Matrix M, List<Integer> atomNos, List<Integer> bondNos, List<Integer> freeValencies,
              List<Integer[]> atomNoPairs, List<Integer> bondOrder)
focal_class.class_method_signature: FixBondOrdersTool.setInterrupted(boolean interrupted)
focal_class.full_signature: public void setInterrupted(boolean interrupted)
focal_class.identifier: setInterrupted
focal_class.modifiers: public
focal_class.parameters: (boolean interrupted)
focal_class.return: void
focal_class.signature: void setInterrupted(boolean interrupted)
focal_class.class_method_signature: FixBondOrdersTool.isInterrupted()
focal_class.full_signature: public boolean isInterrupted()
focal_class.identifier: isInterrupted
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isInterrupted()
focal_method.body: public IAtomContainer kekuliseAromaticRings(IAtomContainer molecule) throws CDKException {
          IAtomContainer mNew = null;
          try {
              mNew = (IAtomContainer) molecule.clone();
          } catch (Exception e) {
              throw new CDKException("Failed to clone source molecule");
          }
  
          IRingSet ringSet;
  
          try {
              ringSet = removeExtraRings(mNew);
          } catch (CDKException x) {
              throw x;
          } catch (Exception x) {
              throw new CDKException("failure in SSSRFinder.findAllRings", x);
          }
  
          if (ringSet == null) {
              throw new CDKException("failure in SSSRFinder.findAllRings");
          }
  
          //We need to establish which rings share bonds and set up sets of such interdependant rings
          List<Integer[]> rBondsArray = null;
          List<List<Integer>> ringGroups = null;
  
          //Start by getting a list (same dimensions and ordering as ringset) of all the ring bond numbers in the reduced ring set
          rBondsArray = getRingSystem(mNew, ringSet);
          //Now find out which share a bond and assign them accordingly to groups
          ringGroups = assignRingGroups(rBondsArray);
  
          //Loop through each group of rings checking all choices of double bond combis and seeing if you can get a
          //proper molecule.
          for (int i = 0; i < ringGroups.size(); i++) {
  
              //Set all ring bonds with single order to allow Matrix solving to work
              setAllRingBondsSingleOrder(ringGroups.get(i), ringSet);
  
              //Set up  lists of atoms, bonds and atom pairs for this ringGroup
              List<Integer> atomNos = null;
              atomNos = getAtomNosForRingGroup(mNew, ringGroups.get(i), ringSet);
  
              List<Integer> bondNos = null;
              bondNos = getBondNosForRingGroup(mNew, ringGroups.get(i), ringSet);
  
              //Array of same dimensions as bondNos (cols in Matrix)
              List<Integer[]> atomNoPairs = null;
              atomNoPairs = getAtomNoPairsForRingGroup(mNew, bondNos);
  
              //Set up ajacency Matrix
              Matrix M = new Matrix(atomNos.size(), bondNos.size());
              for (int x = 0; x < M.getRows(); x++) {
                  for (int y = 0; y < M.getCols(); y++) {
                      if (Objects.equals(atomNos.get(x), atomNoPairs.get(y)[0])) {
                          M.set(x, y, 1);
                      } else {
                          if (Objects.equals(atomNos.get(x), atomNoPairs.get(y)[1])) {
                              M.set(x, y, 1);
                          } else {
                              M.set(x, y, 0);
                          }
                      }
                  }
              }
  
              //Array of same dimensions as atomNos (rows in Matrix)
              List<Integer> freeValencies = null;
              freeValencies = getFreeValenciesForRingGroup(mNew, atomNos, M, ringSet);
  
              //Array of "answers"
              List<Integer> bondOrders = new ArrayList<Integer>();
              for (int j = 0; j < bondNos.size(); j++) {
                  bondOrders.add(0);
              }
  
              if (solveMatrix(M, atomNos, bondNos, freeValencies, atomNoPairs, bondOrders)) {
                  for (int j = 0; j < bondOrders.size(); j++) {
                      mNew.getBond(bondNos.get(j)).setOrder(
                              bondOrders.get(j) == 1 ? IBond.Order.SINGLE : IBond.Order.DOUBLE);
                  }
              } else {
                  //                TODO Put any failure code here
              }
          }
          return mNew;
      }
focal_method.class_method_signature: FixBondOrdersTool.kekuliseAromaticRings(IAtomContainer molecule)
focal_method.full_signature: public IAtomContainer kekuliseAromaticRings(IAtomContainer molecule)
focal_method.identifier: kekuliseAromaticRings
focal_method.invocations: clone removeExtraRings getRingSystem assignRingGroups size setAllRingBondsSingleOrder get getAtomNosForRingGroup get getBondNosForRingGroup get getAtomNoPairsForRingGroup size size getRows getCols equals get get set equals get get set set getFreeValenciesForRingGroup size add solveMatrix size setOrder getBond get get
focal_method.modifiers: public
focal_method.parameters: (IAtomContainer molecule)
focal_method.return: IAtomContainer
focal_method.signature: IAtomContainer kekuliseAromaticRings(IAtomContainer molecule)