Examples of FortranFormat


Examples of name.mjw.jamber.IO.FortranFormat

    // Prepare the Fortran parser
    LOG.debug("readFlag(): attempting to read %FLAG: " + flag.getName()
        + " with %FORMAT: " + flag.getFormat());

    FortranFormat formatter = new FortranFormat(flag.getFormat());

    // read it with BufferedReader
    BufferedReader br = new BufferedReader(new FileReader(fileName));

    // We could have a FLAG with no contents
    while ((line = br.readLine()) != null) {

      if (line.matches("^%FLAG " + flag.getName() + ".*")) {
        LOG.debug("readFlag(): Found %FLAG: " + flag.getName());

        // Move to next line which will be the %FORMAT
        // TODO Check if this is what is expected
        br.readLine();

        // We could be EOF
        while ((line = br.readLine()) != null) {

          // Keep reading content until we hit the next %FLAG or we
          // hit EOF
          if (!line.matches("^%FLAG.*")) {

            LOG.debug("readFlag(): " + line);

            ArrayList<Object> lineObjects = formatter.parse(line);

            // Contents of FLAG in file could be empty
            if (lineObjects != null) {
              for (Object lineObject : lineObjects) {
                if (lineObject != null) {
View Full Code Here

Examples of name.mjw.jamber.IO.FortranFormat

    // Now, keep reading until we hit an empty line
    while (!(line = br.readLine()).matches("\\s*")) {

      try {
        // C 12.01 0.616 ! sp2 C carbonyl group
        FortranFormat formatter = new FortranFormat(
            "(A2,1X,F10.2,1X,F10.2)");
        ArrayList<Object> lineObjects = formatter.parse(line);

        AtomIdentifier atomType = AtomIdentifierFactory
            .getAtomIdentifier((String) lineObjects.get(0),
                (Double) lineObjects.get(1));

View Full Code Here

Examples of name.mjw.jamber.IO.FortranFormat

    String line;
    while (!(line = br.readLine()).matches("\\s*")) {

      try {
        // OW-HW 553.0 0.9572 ! TIP3P water
        FortranFormat formatter = new FortranFormat("(A2,1X,A2,2F10.2)");
        ArrayList<Object> lineObjects = formatter.parse(line);

        AtomIdentifier i = AtomIdentifierFactory
            .getAtomIdentifier((String) lineObjects.get(0));
        AtomIdentifier j = AtomIdentifierFactory
            .getAtomIdentifier((String) lineObjects.get(1));
View Full Code Here

Examples of name.mjw.jamber.IO.FortranFormat

    String line;
    while (!(line = br.readLine()).matches("\\s*")) {

      try {
        // HW-OW-HW 100. 104.52 TIP3P water
        FortranFormat formatter = new FortranFormat(
            "(A2,1X,A2,1X,A2,2F10.2)");
        ArrayList<Object> lineObjects = formatter.parse(line);

        AtomIdentifier i = AtomIdentifierFactory
            .getAtomIdentifier((String) lineObjects.get(0));
        AtomIdentifier j = AtomIdentifierFactory
            .getAtomIdentifier((String) lineObjects.get(1));
View Full Code Here

Examples of name.mjw.jamber.IO.FortranFormat

    String line;
    while (!(line = br.readLine()).matches("\\s*")) {

      try {
        // X -C -C -X 4 14.50 180.0 2. Junmei et al, 1999
        FortranFormat formatter = new FortranFormat(
            "(A2,1X,A2,1X,A2,1X,A2,I4,3F15.2)");
        ArrayList<Object> lineObjects = formatter.parse(line);

        AtomIdentifier i = AtomIdentifierFactory
            .getAtomIdentifier((String) lineObjects.get(0));
        AtomIdentifier j = AtomIdentifierFactory
            .getAtomIdentifier((String) lineObjects.get(1));
        AtomIdentifier k = AtomIdentifierFactory
            .getAtomIdentifier((String) lineObjects.get(2));
        AtomIdentifier l = AtomIdentifierFactory
            .getAtomIdentifier((String) lineObjects.get(3));

        if (!atomTypes.contains(i)) {
          throw new RuntimeException("Unknown atom type " + i);
        }

        if (!atomTypes.contains(j)) {
          throw new RuntimeException("Unknown atom type " + j);
        }

        if (!atomTypes.contains(k)) {
          throw new RuntimeException("Unknown atom type " + k);
        }

        if (!atomTypes.contains(l)) {
          throw new RuntimeException("Unknown atom type " + l);
        }

        ProperDihedralType properDihedralType = new ProperDihedralType(
            i, j, k, l, (Integer) lineObjects.get(4),
            (Double) lineObjects.get(5),
            (Double) lineObjects.get(6),
            (Double) lineObjects.get(7));

        /*
         * Replace any existing properDihedralType with any new ones.
         */
        if (dihedralTypes.contains(properDihedralType)) {
          int indexOfDihedralTypeToBeRemoved = dihedralTypes
              .indexOf(properDihedralType);

          dihedralTypes.remove(indexOfDihedralTypeToBeRemoved);
          dihedralTypes.add(properDihedralType);

          LOG.warn("Replacing dihedralType:\n"
              + dihedralTypes.get(indexOfDihedralTypeToBeRemoved)
              + "\nwith\n" + properDihedralType);

        }

        // Multitermed dihedral; peroidicity is negative
        if (((Double) lineObjects.get(7)) < 0.0) {

          LOG.debug("Found multilined term" + properDihedralType);

          // Read the rest of the dihedral terms

          while (!(line = br.readLine()).matches("\\s*")) {

            LOG.debug("Adding sub term");
            lineObjects = formatter.parse(line);

            properDihedralType
                .setBarrierHeight((Double) lineObjects.get(5));
            properDihedralType
                .setPhase((Double) lineObjects.get(6));
View Full Code Here

Examples of name.mjw.jamber.IO.FortranFormat

    String line;
    while (!(line = br.readLine()).matches("\\s*")) {

      try {
        // X -X -C -O 10.5 180. 2. JCC,7,(1986),230
        FortranFormat formatter = new FortranFormat(
            "(A2,1X,A2,1X,A2,1X,A2,3F15.2)");
        ArrayList<Object> lineObjects = formatter.parse(line);

        AtomIdentifier i = AtomIdentifierFactory
            .getAtomIdentifier((String) lineObjects.get(0));
        AtomIdentifier j = AtomIdentifierFactory
            .getAtomIdentifier((String) lineObjects.get(1));
View Full Code Here

Examples of name.mjw.jamber.IO.FortranFormat

    while (!(line = br.readLine()).matches("\\s*")) {

      // TODO
      try {

        FortranFormat formatter = new FortranFormat(
            "(2X,A2,2X,A2,2X,4F10.2,I2)");

        ArrayList<Object> lineObjects = formatter.parse(line);

        LOG.debug(lineObjects);

      } catch (ParseException e) {
        System.out.println(line);
View Full Code Here

Examples of name.mjw.jamber.IO.FortranFormat

    String line;
    while (!(line = br.readLine()).matches("\\s*")) {

      try {

        FortranFormat formatter = new FortranFormat("(20(A2,2X))");
        ArrayList<Object> lineObjects = formatter.parse(line);

        // What we will point to
        AtomIdentifier toAtomType = AtomIdentifierFactory
            .getAtomIdentifier((String) lineObjects.get(0));
        LOG.debug("toAtomType is " + toAtomType);
View Full Code Here

Examples of name.mjw.jamber.IO.FortranFormat

    while (!(line = br.readLine()).matches("\\s*|^END")) {

      try {

        // H 0.6000 0.0157 !Ferguson base pair geom.
        FortranFormat formatter2 = new FortranFormat(
            "(2X,A2,10X,F6.4,2X,F6.4)");
        ArrayList<Object> lineObjects2 = formatter2.parse(line);

        LOG.debug(line);

        /*
         * There can be empty lines in the region before reaching the
View Full Code Here

Examples of name.mjw.jamber.IO.FortranFormat

      // String label;
      String kindNB;

      // MOD4 RE
      FortranFormat formatter = new FortranFormat("(A4,6X,A2)");
      ArrayList<Object> lineObjects = formatter.parse(line);

      // label = (String) lineObjects.get(0);
      kindNB = (String) lineObjects.get(1);

      /*
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.