Revision: 20160
          http://sourceforge.net/p/jmol/code/20160
Author:   hansonr
Date:     2014-12-09 23:42:28 +0000 (Tue, 09 Dec 2014)
Log Message:
-----------
Jmol.___JmolVersion="14.3.11_2014.12.09"

new feature: Castep reading of .ts files

bug fix: array.add("\t",array) broken 2014.12.04
bug fix: array.split("",true) doesn't handle CSV with new lines in quotes

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/adapter/readers/xtal/CastepReader.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CastepReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CastepReader.java      
2014-12-09 13:05:53 UTC (rev 20159)
+++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CastepReader.java      
2014-12-09 23:42:28 UTC (rev 20160)
@@ -92,6 +92,7 @@
   private String[] tokens;
 
   private boolean isPhonon;
+  private boolean isTS;
   private boolean isOutput;
   private boolean isCell;
 
@@ -235,7 +236,7 @@
           continue;
         }
       }
-    if (isPhonon || isOutput) {
+    if (isPhonon || isOutput || isTS) {
       if (isPhonon) {
         isTrajectory = (desiredVibrationNumber <= 0);
         asc.allowMultiple = false;
@@ -262,11 +263,11 @@
       } else if (doProcessLines && line.contains("Born Effective Charges")) {
         readOutputBornChargeTensors();
       } else if (line.contains("Final energy ")) { // not "Final energy, E"
-        readEnergy(3);
+        readEnergy(3, null);
       } else if (line.contains("Dispersion corrected final energy*")) {
-        readEnergy(5);
+        readEnergy(5, null);
       } else if (line.contains("Total energy corrected")) {
-        readEnergy(8);
+        readEnergy(8, null);
       }
       return true;
     }
@@ -327,13 +328,13 @@
 
   }
 
-  private void readEnergy(int pt) throws Exception {
+  private void readEnergy(int pt, String prefix) throws Exception {
     if (isTrajectory)
       applySymmetryAndSetTrajectory();
     tokens = getTokens();
     try {
       Double energy = Double.valueOf(Double.parseDouble(tokens[pt]));
-      asc.setAtomSetName("Energy = " + energy + " eV");
+      asc.setAtomSetName(prefix + "Energy = " + energy + " eV");
       asc.setAtomSetEnergy("" + energy, energy.floatValue());
       asc.setAtomSetAuxiliaryInfo("Energy", energy);
     } catch (Exception e) {
@@ -357,12 +358,15 @@
   }
   
   private void readPhononTrajectories() throws Exception {
-    isTrajectory = (desiredVibrationNumber <= 0);
+    if (!isTS) // force this only for .phonon, not .ts
+      isTrajectory = (desiredVibrationNumber <= 0);
     if (isTrajectory)
       asc.setTrajectory();
     doApplySymmetry = true;
     while (line != null && line.contains("<-- E")) {
       asc.newAtomSetClear(false);
+      if (isTS)
+        readEnergy(0, getTokensStr(prevline + " -")[0] + " ");
       discardLinesUntilContains("<-- h");
       setSpaceGroupName("P1");
       abc = read3Vectors(true);
@@ -381,7 +385,7 @@
 
   @Override
   protected void finalizeSubclassReader() throws Exception {
-    if (isPhonon || isOutput) {
+    if (isPhonon || isOutput || isTS) {
       isTrajectory = false;
     } else {
       doApplySymmetry = true;
@@ -530,6 +534,11 @@
           isCell = true;
           break;
         }
+        if (line.startsWith("LST")) {
+          isTS = true;
+          Logger.info("reading CASTEP .ts file");
+          return -1;
+        }
         if (line.startsWith("BEGIN header")) {
           isPhonon = true;
           Logger.info("reading CASTEP .phonon file");

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2014-12-09 13:05:53 UTC 
(rev 20159)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2014-12-09 23:42:28 UTC 
(rev 20160)
@@ -18,6 +18,8 @@
 
 Jmol.___JmolVersion="14.3.11_2014.12.09"
 
+new feature: Castep reading of .ts files
+
 bug fix: array.add("\t",array) broken 2014.12.04
 bug fix: array.split("",true) doesn't handle CSV with new lines in quotes
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to