test_class.file: tool/forcefield/src/test/java/org/openscience/cdk/modeling/builder3d/MMFF94BasedParameterSetReaderTest.java
test_class.identifier: MMFF94BasedParameterSetReaderTest
test_case.body: @Test
      public void testreadParameterSets() throws Exception {
          MMFF94BasedParameterSetReader mmff94bpsr = new MMFF94BasedParameterSetReader();
          mmff94bpsr.readParameterSets(DefaultChemObjectBuilder.getInstance());
          Map<String, Object> parameterSet = new Hashtable<String, Object>();
          parameterSet = mmff94bpsr.getParamterSet();
  
          //test atom type
          List<IAtomType> atomtypes = mmff94bpsr.getAtomTypes();
          IAtomType atomtype = atomtypes.get(0);
          String sid = "C";
          assertEquals(sid, atomtype.getAtomTypeName());
          String rootType = "C";
          assertEquals(rootType, atomtype.getSymbol());
          String smaxbond = "4";
          assertEquals(Integer.parseInt(smaxbond), (int) atomtype.getFormalNeighbourCount());
          String satomNr = "6";
          assertEquals(Integer.parseInt(satomNr), (int) atomtype.getAtomicNumber());
  
          //atom
          //TODO testing
  
          //bond
          //		String scode = "0";
          String sid1 = "C";
          String sid2 = "C";
          String slen = "1.508";
          String sk2 = "306.432";
          String sk3 = "-612.865";
          String sk4 = "715.009";
          String sbci = "0.0000";
          String bondkey = "bond" + sid1 + ";" + sid2;
          List<Double> bonddata = new ArrayList<Double>();
          bonddata.add((Double) (new Double(slen).doubleValue()));
          bonddata.add((Double) (new Double(sk2).doubleValue()));
          bonddata.add((Double) (new Double(sk3).doubleValue()));
          bonddata.add((Double) (new Double(sk4).doubleValue()));
          bonddata.add((Double) (new Double(sbci).doubleValue()));
  
          //strbnd
          //		scode = "0";
          sid1 = "C";
          sid2 = "C";
          String sid3 = "C";
          String value1 = "14.82507";
          String value2 = "14.82507";
          String strbndkey = "strbnd" + sid1 + ";" + sid2 + ";" + sid3;
          List<Double> strbnddata = new ArrayList<Double>();
          strbnddata.add((Double) (new Double(value1).doubleValue()));
          strbnddata.add((Double) (new Double(value2).doubleValue()));
  
          //angle
          //      scode = "0";
          sid1 = "C=";
          sid2 = "C";
          sid3 = "N";
          value1 = "105.837";
          value2 = "86.1429";
          String value3 = "-34.5494";
          String value4 = "0";
          String anglekey = "angle" + sid1 + ";" + sid2 + ";" + sid3;
          List<Double> angledata = new ArrayList<Double>();
          angledata.add((Double) (new Double(value1).doubleValue()));
          angledata.add((Double) (new Double(value2).doubleValue()));
          angledata.add((Double) (new Double(value3).doubleValue()));
          angledata.add((Double) (new Double(value4).doubleValue()));
  
          //torsion
          //	    scode = "0";
          sid1 = "HC";
          sid2 = "C";
          sid3 = "C";
          String sid4 = "HC";
          value1 = "0.142";
          value2 = "0.693";
          value3 = "0.157";
          value4 = "0.000";
          String value5 = "0.000";
          String torsionkey = "torsion" + ";" + sid1 + ";" + sid2 + ";" + sid3 + ";" + sid4;
          List<Double> torsiondata = new ArrayList<Double>();
          torsiondata.add((Double) (new Double(value1).doubleValue()));
          torsiondata.add((Double) (new Double(value2).doubleValue()));
          torsiondata.add((Double) (new Double(value3).doubleValue()));
          torsiondata.add((Double) (new Double(value4).doubleValue()));
          torsiondata.add((Double) (new Double(value5).doubleValue()));
  
          //opbend
          //      scode = "0";
          sid1 = "O=";
          sid2 = "C=";
          sid3 = "CR4R";
          sid4 = "CR4R";
          value1 = "10.86681780";
          String opbendkey = "opbend" + ";" + sid1 + ";" + sid2 + ";" + sid3 + ";" + sid4;
          List<Double> opbenddata = new ArrayList<Double>();
          opbenddata.add((Double) (new Double(value1).doubleValue()));
  
          //TODO data lines testing
  
          for (Entry<String, Object> e : parameterSet.entrySet()) {
              if (e.getKey().equals(bondkey))
                  assertEquals(bonddata, e.getValue());
              else if (e.getKey().equals(strbndkey))
                  assertEquals(strbnddata, e.getValue());
              else if (e.getKey().equals(anglekey))
                  assertEquals(angledata, e.getValue());
              else if (e.getKey().equals(torsionkey))
                  assertEquals(torsiondata, e.getValue());
              else if (e.getKey().equals(opbendkey)) assertEquals(opbenddata, e.getValue());
          }
      }
test_case.class_method_signature: MMFF94BasedParameterSetReaderTest.testreadParameterSets()
test_case.full_signature: @Test public void testreadParameterSets()
test_case.identifier: testreadParameterSets
test_case.invocations: readParameterSets getInstance getParamterSet getAtomTypes get assertEquals getAtomTypeName assertEquals getSymbol assertEquals parseInt getFormalNeighbourCount assertEquals parseInt getAtomicNumber add doubleValue add doubleValue add doubleValue add doubleValue add doubleValue add doubleValue add doubleValue add doubleValue add doubleValue add doubleValue add doubleValue add doubleValue add doubleValue add doubleValue add doubleValue add doubleValue add doubleValue entrySet equals getKey assertEquals getValue equals getKey assertEquals getValue equals getKey assertEquals getValue equals getKey assertEquals getValue equals getKey assertEquals getValue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testreadParameterSets()
focal_class.declarator: LOG            = LoggingToolFactory
                                                         .createLoggingTool(MMFF94BasedParameterSetReader.class)
focal_class.modifier: private final
focal_class.original_string: private final ILoggingTool  LOG            = LoggingToolFactory
                                                         .createLoggingTool(MMFF94BasedParameterSetReader.class);
focal_class.type: ILoggingTool
focal_class.var_name: LOG
focal_class.declarator: configFile     = "org/openscience/cdk/modeling/forcefield/data/mmff94.prm"
focal_class.modifier: private
focal_class.original_string: private String              configFile     = "org/openscience/cdk/modeling/forcefield/data/mmff94.prm";
focal_class.type: String
focal_class.var_name: configFile
focal_class.declarator: ins            = null
focal_class.modifier: private
focal_class.original_string: private InputStream         ins            = null;
focal_class.type: InputStream
focal_class.var_name: ins
focal_class.declarator: parameterSet
focal_class.modifier: private
focal_class.original_string: private Map<String, Object> parameterSet;
focal_class.type: Map<String, Object>
focal_class.var_name: parameterSet
focal_class.declarator: atomTypes
focal_class.modifier: private
focal_class.original_string: private List<IAtomType>     atomTypes;
focal_class.type: List<IAtomType>
focal_class.var_name: atomTypes
focal_class.declarator: st
focal_class.modifier: private
focal_class.original_string: private StringTokenizer     st;
focal_class.type: StringTokenizer
focal_class.var_name: st
focal_class.declarator: key            = ""
focal_class.modifier: private
focal_class.original_string: private String              key            = "";
focal_class.type: String
focal_class.var_name: key
focal_class.declarator: sid
focal_class.modifier: private
focal_class.original_string: private String              sid;
focal_class.type: String
focal_class.var_name: sid
focal_class.declarator: configFilevdW  = "org/openscience/cdk/modeling/forcefield/data/mmffvdw.prm"
focal_class.modifier: private
focal_class.original_string: private String              configFilevdW  = "org/openscience/cdk/modeling/forcefield/data/mmffvdw.prm";
focal_class.type: String
focal_class.var_name: configFilevdW
focal_class.declarator: insvdW         = null
focal_class.modifier: private
focal_class.original_string: private InputStream         insvdW         = null;
focal_class.type: InputStream
focal_class.var_name: insvdW
focal_class.declarator: stvdW
focal_class.modifier: private
focal_class.original_string: private StringTokenizer     stvdW;
focal_class.type: StringTokenizer
focal_class.var_name: stvdW
focal_class.declarator: sidvdW
focal_class.modifier: private
focal_class.original_string: private String              sidvdW;
focal_class.type: String
focal_class.var_name: sidvdW
focal_class.declarator: configFileDFSB = "org/openscience/cdk/modeling/forcefield/data/mmffdfsb.par"
focal_class.modifier: private
focal_class.original_string: private String              configFileDFSB = "org/openscience/cdk/modeling/forcefield/data/mmffdfsb.par";
focal_class.type: String
focal_class.var_name: configFileDFSB
focal_class.declarator: insDFSB
focal_class.modifier: private
focal_class.original_string: private InputStream         insDFSB;
focal_class.type: InputStream
focal_class.var_name: insDFSB
focal_class.declarator: stDFSB
focal_class.modifier: private
focal_class.original_string: private StringTokenizer     stDFSB;
focal_class.type: StringTokenizer
focal_class.var_name: stDFSB
focal_class.file: tool/forcefield/src/main/java/org/openscience/cdk/modeling/builder3d/MMFF94BasedParameterSetReader.java
focal_class.identifier: MMFF94BasedParameterSetReader
focal_class.class_method_signature: MMFF94BasedParameterSetReader.MMFF94BasedParameterSetReader()
focal_class.full_signature: public  MMFF94BasedParameterSetReader()
focal_class.identifier: MMFF94BasedParameterSetReader
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  MMFF94BasedParameterSetReader()
focal_class.class_method_signature: MMFF94BasedParameterSetReader.getParamterSet()
focal_class.full_signature: public Map<String, Object> getParamterSet()
focal_class.identifier: getParamterSet
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> getParamterSet()
focal_class.class_method_signature: MMFF94BasedParameterSetReader.getAtomTypes()
focal_class.full_signature: public List<IAtomType> getAtomTypes()
focal_class.identifier: getAtomTypes
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<IAtomType>
focal_class.signature: List<IAtomType> getAtomTypes()
focal_class.class_method_signature: MMFF94BasedParameterSetReader.setInputStream(InputStream ins)
focal_class.full_signature: public void setInputStream(InputStream ins)
focal_class.identifier: setInputStream
focal_class.modifiers: public
focal_class.parameters: (InputStream ins)
focal_class.return: void
focal_class.signature: void setInputStream(InputStream ins)
focal_class.class_method_signature: MMFF94BasedParameterSetReader.setAtomTypeData()
focal_class.full_signature: private void setAtomTypeData()
focal_class.identifier: setAtomTypeData
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void setAtomTypeData()
focal_class.class_method_signature: MMFF94BasedParameterSetReader.setAtomTypes(IChemObjectBuilder builder)
focal_class.full_signature: private void setAtomTypes(IChemObjectBuilder builder)
focal_class.identifier: setAtomTypes
focal_class.modifiers: private
focal_class.parameters: (IChemObjectBuilder builder)
focal_class.return: void
focal_class.signature: void setAtomTypes(IChemObjectBuilder builder)
focal_class.class_method_signature: MMFF94BasedParameterSetReader.setBond()
focal_class.full_signature: private void setBond()
focal_class.identifier: setBond
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void setBond()
focal_class.class_method_signature: MMFF94BasedParameterSetReader.setAngle()
focal_class.full_signature: private void setAngle()
focal_class.identifier: setAngle
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void setAngle()
focal_class.class_method_signature: MMFF94BasedParameterSetReader.setStrBnd()
focal_class.full_signature: private void setStrBnd()
focal_class.identifier: setStrBnd
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void setStrBnd()
focal_class.class_method_signature: MMFF94BasedParameterSetReader.setTorsion()
focal_class.full_signature: private void setTorsion()
focal_class.identifier: setTorsion
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void setTorsion()
focal_class.class_method_signature: MMFF94BasedParameterSetReader.setOpBend()
focal_class.full_signature: private void setOpBend()
focal_class.identifier: setOpBend
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void setOpBend()
focal_class.class_method_signature: MMFF94BasedParameterSetReader.setDefaultStrBnd()
focal_class.full_signature: private void setDefaultStrBnd()
focal_class.identifier: setDefaultStrBnd
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void setDefaultStrBnd()
focal_class.class_method_signature: MMFF94BasedParameterSetReader.readParameterSets(IChemObjectBuilder builder)
focal_class.full_signature: public void readParameterSets(IChemObjectBuilder builder)
focal_class.identifier: readParameterSets
focal_class.modifiers: public
focal_class.parameters: (IChemObjectBuilder builder)
focal_class.return: void
focal_class.signature: void readParameterSets(IChemObjectBuilder builder)
focal_class.class_method_signature: MMFF94BasedParameterSetReader.massNumber(int atomicNumber, double exactMass)
focal_class.full_signature: private Integer massNumber(int atomicNumber, double exactMass)
focal_class.identifier: massNumber
focal_class.modifiers: private
focal_class.parameters: (int atomicNumber, double exactMass)
focal_class.return: Integer
focal_class.signature: Integer massNumber(int atomicNumber, double exactMass)
focal_method.body: public void readParameterSets(IChemObjectBuilder builder) throws Exception {
          //vdW,bond,angle,strbond,opbend,torsion,data
          LOG.debug("------ Read MMFF94 ParameterSets ------");
  
          if (ins == null) {
              ClassLoader loader = this.getClass().getClassLoader();
              ins = loader.getResourceAsStream(configFile);
          }
          if (ins == null) {
              throw new IOException("There was a problem getting the default stream: " + configFile);
          }
  
          BufferedReader r = new BufferedReader(new InputStreamReader(ins), 1024);
          String s;
          int[] a = {0, 0, 0, 0, 0, 0, 0, 0};
  
          if (insvdW == null) {
              insvdW = this.getClass().getClassLoader().getResourceAsStream(configFilevdW);
          }
          if (insvdW == null) {
              throw new IOException("There was a problem getting the default stream: " + configFilevdW);
          }
  
          BufferedReader rvdW = new BufferedReader(new InputStreamReader(insvdW), 1024);
          String svdW;
          int ntvdW;
  
          if (insDFSB == null) {
              insDFSB = this.getClass().getClassLoader().getResourceAsStream(configFileDFSB);
          }
          if (insDFSB == null) {
              throw new IOException("There was a problem getting the default stream: " + configFileDFSB);
          }
  
          BufferedReader rDFSB = new BufferedReader(new InputStreamReader(insDFSB), 1024);
          String sDFSB;
          int ntDFSB;
  
          try {
              while (true) {
                  s = r.readLine();
                  if (s == null) {
                      break;
                  }
                  st = new StringTokenizer(s, "\t; ");
                  int nt = st.countTokens();
                  if (s.startsWith("atom") & nt <= 8) {
                      setAtomTypes(builder);
                      a[0]++;
                  } else if (s.startsWith("bond") & nt == 9) {
                      setBond();
                      a[1]++;
                  } else if (s.startsWith("angle") & nt <= 10) {
                      setAngle();
                      a[2]++;
                  } else if (s.startsWith("strbnd") & nt == 7) {
                      setStrBnd();
                      a[3]++;
                  } else if (s.startsWith("torsion") & nt == 11) {
                      setTorsion();
                      a[4]++;
                  } else if (s.startsWith("opbend") & nt == 6) {
                      setOpBend();
                      a[5]++;
                  } else if (s.startsWith("data") & nt == 10) {
                      readatmmffvdw: while (true) {
                          svdW = rvdW.readLine();
                          if (svdW == null) {
                              break;
                          }
                          stvdW = new StringTokenizer(svdW, "\t; ");
                          ntvdW = stvdW.countTokens();
                          LOG.debug("ntvdW : " + ntvdW);
                          if (svdW.startsWith("vdw") & ntvdW == 9) {
                              st.nextToken();
                              sid = st.nextToken();
                              stvdW.nextToken();
                              sidvdW = stvdW.nextToken();
                              if (sid.equals(sidvdW)) {
                                  setAtomTypeData();
                                  a[6]++;
                              }
                              break readatmmffvdw;
                          }
                      }// end while
                  }
              }// end while
  
              ins.close();
              insvdW.close();
          } catch (IOException e) {
              throw new IOException("There was a problem parsing the mmff94 forcefield");
          }
  
          try {
              LOG.debug("Parses the Default Stretch-Bend Parameters");
              while (true) {
                  sDFSB = rDFSB.readLine();
                  LOG.debug("sDFSB = " + sDFSB);
                  if (sDFSB == null) {
                      LOG.debug("sDFSB == null, break");
                      break;
                  }
                  stDFSB = new StringTokenizer(sDFSB, "\t; ");
                  ntDFSB = stDFSB.countTokens();
                  LOG.debug("ntDFSB : " + ntDFSB);
                  if (sDFSB.startsWith("DFSB") & ntDFSB == 6) {
                      setDefaultStrBnd();
                  }
              }
              insDFSB.close();
              LOG.debug("insDFSB closed");
          } catch (IOException e) {
              throw new IOException("There was a problem parsing the Default Stretch-Bend Parameters (mmffdfsb.par)");
          }
      }
focal_method.class_method_signature: MMFF94BasedParameterSetReader.readParameterSets(IChemObjectBuilder builder)
focal_method.full_signature: public void readParameterSets(IChemObjectBuilder builder)
focal_method.identifier: readParameterSets
focal_method.invocations: debug getClassLoader getClass getResourceAsStream getResourceAsStream getClassLoader getClass getResourceAsStream getClassLoader getClass readLine countTokens startsWith setAtomTypes startsWith setBond startsWith setAngle startsWith setStrBnd startsWith setTorsion startsWith setOpBend startsWith readLine countTokens debug startsWith nextToken nextToken nextToken nextToken equals setAtomTypeData close close debug readLine debug debug countTokens debug startsWith setDefaultStrBnd close debug
focal_method.modifiers: public
focal_method.parameters: (IChemObjectBuilder builder)
focal_method.return: void
focal_method.signature: void readParameterSets(IChemObjectBuilder builder)