From: Egon W. <eg...@us...> - 2002-10-24 13:19:28
|
Update of /cvsroot/jmol/Jmol/src/org/openscience/jmol In directory usw-pr-cvs1:/tmp/cvs-serv10223/src/org/openscience/jmol Modified Files: ABINITReader.java Log Message: Applied Fabian's patch for reading energies from ABINIT files. Index: ABINITReader.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/openscience/jmol/ABINITReader.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** ABINITReader.java 17 Oct 2002 15:45:05 -0000 1.5 --- ABINITReader.java 24 Oct 2002 13:19:23 -0000 1.6 *************** *** 344,348 **** String line; int count = 0; ! //We assume we have only 1 dataset. --- 344,348 ---- String line; int count = 0; ! String energy = ""; //We assume we have only 1 dataset. *************** *** 478,484 **** } } else if (fieldVal.equals("Cartesian") ! && nextAbinitToken(false).equals("coordinates")) { ! ! nextAbinitToken(false); //read "(bohr)" --- 478,484 ---- } } else if (fieldVal.equals("Cartesian") ! && nextAbinitToken(false).equals("coordinates")) { ! ! nextAbinitToken(false); //read "(bohr)" *************** *** 491,494 **** --- 491,505 ---- } + } else if (fieldVal.equals("At") && + nextAbinitToken(false).equals("the")){ + //Read: "end of Broyden step 0, total energy=" (7 tokens) + for (int i=0; i<7; i++) { + nextAbinitToken(false); + } + nextAbinitToken(false); + energy = fieldVal; + + //Energy is the last thing to be read --> store data + //Set the atom types int[] atomType = new int[natom]; *************** *** 505,515 **** //use defaults value crystalFile.setCrystalBox(new CrystalBox()); crystalFile.generateCrystalFrame(); ! } //end if "Cartesian coordinates" ! ! ! // It is unnecessary to scan the end of the line. // Go directly to the next line nextAbinitToken(true); --- 516,530 ---- //use defaults value crystalFile.setCrystalBox(new CrystalBox()); + + //generate the frame crystalFile.generateCrystalFrame(); + + //Add the Energy Property to the frame + crystalFile.getFrame(crystalFile.getNumberOfFrames()-1) + .addProperty(new Energy(FortranFormat.atof(energy))); + } //end if "Cartesian coordinates" ! // It is unnecessary to scan the end of the line. // Go directly to the next line nextAbinitToken(true); |