Revision: 5176
Author:   hansonr
Date:     2006-05-25 09:59:48 -0700 (Thu, 25 May 2006)
ViewCVS:  http://svn.sourceforge.net/jmol/?rev=5176&view=rev

Log Message:
-----------
10.3; needs to be added anytime to 10.2; 

resolver fix for NWChem files -- was picking up "TITLE" and declaring it a PDB 
file;
now added "fileStartsWith" capability in resolver and check 
for " argument 1 = ", which is done first, but is very specific to NWChem files.
test file from Giacomo Mulas <[EMAIL PROTECTED]> c10h8.nwo

uploaded to the 10.3 test directory at St. Olaf.

compare:

http://www.stolaf.edu/people/hansonr/jmol/test/10.2/new.htm?model=c10h8.nwo
http://www.stolaf.edu/people/hansonr/jmol/test/10.3/new.htm?model=c10h8.nwo

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java
Modified: trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java       2006-05-25 
15:47:50 UTC (rev 5175)
+++ trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java       2006-05-25 
16:59:48 UTC (rev 5176)
@@ -114,13 +114,22 @@
     if (checkCube(lines))
       return "Cube";
     // run these loops forward ... easier for people to understand
-    for (int i = 0; i < startsWithRecords.length; ++i) {
-      String[] recordTags = startsWithRecords[i];
+    //file starts with added 4/26 to ensure no issue with NWChem files
+    for (int i = 0; i < fileStartsWithRecords.length; ++i) {
+      String[] recordTags = fileStartsWithRecords[i];
       for (int j = 0; j < recordTags.length; ++j) {
         String recordTag = recordTags[j];
+        if (lines[0].startsWith(recordTag))
+            return fileStartsWithFormats[i];
+      }
+    }
+    for (int i = 0; i < lineStartsWithRecords.length; ++i) {
+      String[] recordTags = lineStartsWithRecords[i];
+      for (int j = 0; j < recordTags.length; ++j) {
+        String recordTag = recordTags[j];
         for (int k = 0; k < lines.length; ++k) {
           if (lines[k].startsWith(recordTag))
-            return startsWithFormats[i];
+            return lineStartsWithFormats[i];
         }
       }
     }
@@ -212,6 +221,19 @@
   }
 
   ////////////////////////////////////////////////////////////////
+  // these test files that startWith one of these strings
+  ////////////////////////////////////////////////////////////////
+
+  final static String[] nwchemRecords =
+  {" argument  1 = "};
+
+  final static String[][] fileStartsWithRecords =
+  { nwchemRecords};
+
+  final static String[] fileStartsWithFormats =
+  { "NWChem"};
+
+  ////////////////////////////////////////////////////////////////
   // these test lines that startWith one of these strings
   ////////////////////////////////////////////////////////////////
 
@@ -246,21 +268,18 @@
   final static String[] mdlRecords = 
   {"$MDL "};
 
-  final static String[] nwchemRecords =
-  {" argument  1"};
-
-  final static String[] spartanSmolRecords =
+    final static String[] spartanSmolRecords =
   {"INPUT="};
 
   final static String[] csfRecords =
   {"local_transform"};
   
-  final static String[][] startsWithRecords =
+  final static String[][] lineStartsWithRecords =
   { pdbRecords, shelxRecords, cifRecords, ghemicalMMRecords,
     jaguarRecords, hinRecords , mdlRecords, nwchemRecords,
     spartanSmolRecords, csfRecords};
 
-  final static String[] startsWithFormats =
+  final static String[] lineStartsWithFormats =
   { "Pdb", "Shelx", "Cif", "GhemicalMM",
     "Jaguar", "Hin", "Mol", "NWChem", "SpartanSmol", "Csf"};
 


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



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Jmol-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to