Revision: 20142
          http://sourceforge.net/p/jmol/code/20142
Author:   hansonr
Date:     2014-11-27 05:01:33 +0000 (Thu, 27 Nov 2014)
Log Message:
-----------
Jmol.___JmolVersion="14.3.11_2014.11.27"

new feature: ZMatrixReader also serves as simple input file reader 
             for Q-Chem, Jaguar, MolPro, and ADF, as produced by NBO6Pro
             

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/adapter/readers/simple/ZMatrixReader.java
    trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: trunk/Jmol/src/org/jmol/adapter/readers/simple/ZMatrixReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/simple/ZMatrixReader.java   
2014-11-27 01:10:19 UTC (rev 20141)
+++ trunk/Jmol/src/org/jmol/adapter/readers/simple/ZMatrixReader.java   
2014-11-27 05:01:33 UTC (rev 20142)
@@ -46,7 +46,8 @@
 
 public class ZMatrixReader extends AtomSetCollectionReader {
   /*
-   * a simple Z-matrix reader
+   * a simple Z-matrix reader, also serves as simple
+   * input file reader for Q-Chem, Jaguar, MolPro, and ADF, as produced by 
NBO6Pro
    * 
    * Can be invoked using ZMATRIX::   or with file starting with #ZMATRIX
    * # are comments; can include jmolscript: xxxx
@@ -217,6 +218,34 @@
       line = line.substring(0, line.indexOf("#"));
     if (line.indexOf(":") >= 0)
       return true; // Variables: or Constants:
+    if (line.contains("$molecule")) {
+      // Q-Chem input 
+      rd(); // spin
+      return readBlock("$end");
+    }    
+    if (line.startsWith("$"))
+      return true; // $NBO
+    if (line.contains("%mem")) {
+      // Gaussian
+      discardLinesUntilBlank();
+      discardLinesUntilBlank();
+      rd(); // spin
+      return readBlock(null);
+    }
+    if (line.contains("ATOMS cartesian")) {
+      // ADF input 
+      return readBlock("END");
+    }
+    if (line.contains("&zmat")) {
+      // Jaguar input 
+      return readBlock("&");
+    }
+    if (line.contains("geometry={")) {
+      // MolPRO via NBO6
+      readLines(2);
+      return readBlock("}");
+    }
+    
     tokens = getTokensStr(line);
     if (tokens.length == 2) {
       getSymbolic();
@@ -226,13 +255,21 @@
     return true;
   }
 
-  private void cleanLine() {
+  private boolean readBlock(String strEnd) throws Exception {
+    lineBuffer.clear();
+    while (rd() != null && cleanLine() != null 
+        && (strEnd == null ? line.length() > 0 : line.indexOf(strEnd) < 0))
+      lineBuffer.addLast(getTokens());
+    return (continuing = false);
+  }
+
+  private String cleanLine() {
     // remove commas for Gaussian and parenthetical expressions for MOPAC 
     line = line.replace(',', ' ');
     int pt1, pt2;
     while ((pt1 = line.indexOf('(')) >= 0 && (pt2 = line.indexOf('(', pt1)) >= 
0)
       line = line.substring(0, pt1) + " " + line.substring(pt2 + 1);
-    line = line.trim();
+    return (line = line.trim());
   }
 
   @Override

Modified: trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java       2014-11-27 
01:10:19 UTC (rev 20141)
+++ trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java       2014-11-27 
05:01:33 UTC (rev 20142)
@@ -675,7 +675,7 @@
   {"TlsDataOnly", "REFMAC\n\nTL", "REFMAC\r\n\r\n", "REFMAC\r\rTL"};
   
   private final static String[] zMatrixFileStartRecords =
-  {"ZMatrix", "#ZMATRIX"};
+  {"ZMatrix", "#ZMATRIX", "%mem="};
   
   private final static String[] magresFileStartRecords =
   {"Magres", "#$magres", "# magres"};
@@ -847,6 +847,8 @@
   private final static String[] gaussianFchkContainsRecords =
   { "GaussianFchk", "Number of point charges in /Mol/" };
 
+  private final static String[] zmatrixContainsRecords =
+  { "ZMatrix", " ATOMS cartesian", "$molecule", "&zmat", "geometry={" };
   
   
   private final static String[][] headerContainsRecords =
@@ -860,6 +862,7 @@
     dmolContainsRecords, gulpContainsRecords, 
     espressoContainsRecords, siestaContainsRecords, xcrysDenContainsRecords,
     
mopacArchiveContainsRecords,abinitContainsRecords,gaussianFchkContainsRecords,
+    zmatrixContainsRecords
     
   };
 }

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2014-11-27 01:10:19 UTC 
(rev 20141)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2014-11-27 05:01:33 UTC 
(rev 20142)
@@ -17,6 +17,10 @@
 
 Jmol.___JmolVersion="14.3.11_2014.11.27"
 
+new feature: ZMatrixReader also serves as simple input file reader 
+             for Q-Chem, Jaguar, MolPro, and ADF, as produced by NBO6Pro
+             
+
 JmolVersion="14.3.10_2014.11.27"
 
 released as 14.3.10

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=157005751&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