コード例 #1
0
  public void setCalculationValues() {
    atom tempa;
    int temp;
    int atom1 = myAtoms[0].getMM3TypeNum();
    int atom2 = myAtoms[1].getMM3TypeNum();
    int atom3 = myAtoms[2].getMM3TypeNum();
    int atom4 = myAtoms[3].getMM3TypeNum();

    if (atom1 > atom2) {
      temp = atom1;
      atom1 = atom2;
      atom2 = temp;
      tempa = myAtoms[0];
      myAtoms[0] = myAtoms[1];
      myAtoms[1] = tempa;
    }

    if (atom3 > atom4) {
      temp = atom3;
      atom3 = atom4;
      atom4 = temp;
      tempa = myAtoms[2];
      myAtoms[2] = myAtoms[3];
      myAtoms[3] = tempa;
    }

    try {
      AtomDataFile dataFile =
          new AtomDataFile(newNanocad.txtDir + newNanocad.fileSeparator + "mm3estaticdata.txt");
      // AtomDataFile dataFile= new AtomDataFile("mm3estaticdata.txt");
      if (dataFile.findData(atom1, atom2, 0, 1)) {
        firstCharge = dataFile.parseDouble(2);
        firstDistribution = dataFile.parseDouble(3);
      } else {
        // System.out.println("No data for " + atom1 + " " + atom2 + " dipole.");
        firstCharge = 0.0;
        firstDistribution = 0.0;
      }

      if (dataFile.findData(atom3, atom4, 0, 1)) {
        secondCharge = dataFile.parseDouble(2);
        secondDistribution = dataFile.parseDouble(3);
      } else {
        // System.out.println("No data for " + atom3 + " " + atom4 + " dipole.");
        secondCharge = 0.0;
        secondDistribution = 0.0;
      }
    } catch (java.io.IOException e) {
      System.err.println("Dipole data lookup error");
      e.printStackTrace();
    }
  }
コード例 #2
0
  public void setCalculationValues() {
    int atom1 = myAtoms[0].getMM3TypeNum();
    int atom2 = myAtoms[1].getMM3TypeNum();
    int atom3 = myAtoms[2].getMM3TypeNum();

    if (atom1 < atom3 || atom1 < 1 || atom2 < 1 || atom3 < 1) {
      kBondAngle = 0.0;
      return;
    }

    try {
      AtomDataFile dataFile =
          new AtomDataFile(newNanocad.txtDir + newNanocad.fileSeparator + "mm3strbenddata.txt");
      // AtomDataFile dataFile = new AtomDataFile("mm3strbenddata.txt");
      if (dataFile.findData(atom1, 0)) kBondAngle = dataFile.parseDouble(1);
      else {
        kBondAngle = 0.0;
        return;
      }

      dataFile = new AtomDataFile(newNanocad.txtDir + newNanocad.fileSeparator + "mm3adata.txt");
      // dataFile = new AtomDataFile("mm3adata.txt");
      if (dataFile.findData(atom2, atom1, atom3, 1, 0, 2))
        idealAngle = convert * dataFile.parseDouble(4);
      else {
        idealAngle = 0.0;
        return;
      }

      dataFile = new AtomDataFile(newNanocad.txtDir + newNanocad.fileSeparator + "mm3ldata.txt");
      // dataFile = new AtomDataFile("mm3ldata.txt");
      if (dataFile.findData(Math.min(atom1, atom2), Math.max(atom1, atom2), 0, 1))
        idealLength1 = dataFile.parseDouble(3);
      else {
        idealLength1 = 0.0;
        return;
      }

      if (dataFile.findData(Math.min(atom2, atom3), Math.max(atom2, atom3), 0, 1))
        idealLength2 = dataFile.parseDouble(3);
      else {
        idealLength2 = 0.0;
        return;
      }
    } catch (java.io.IOException e) {
      System.err.println("Stretch-bend data lookup error");
      e.printStackTrace();
    }
  }