From: <ha...@us...> - 2010-03-25 15:00:55
|
Revision: 12698 http://jmol.svn.sourceforge.net/jmol/?rev=12698&view=rev Author: hansonr Date: 2010-03-25 15:00:49 +0000 (Thu, 25 Mar 2010) Log Message: ----------- version=11.9.36_dev # new feature: GenNBO file reader for xx.31-.41 files and .nbo output if in that directory # bug fix: Spartan and WebMO orbitals are already normalized! Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/quantum/GenNBOReader.java trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java trunk/Jmol/src/org/jmol/quantum/MOCalculation.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/quantum/GenNBOReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/quantum/GenNBOReader.java 2010-03-25 12:15:09 UTC (rev 12697) +++ trunk/Jmol/src/org/jmol/adapter/readers/quantum/GenNBOReader.java 2010-03-25 15:00:49 UTC (rev 12698) @@ -86,7 +86,7 @@ isOK = readData31(line1, line); } if (!isOK) - Logger.error("Unimplemented shell type -- no orbitals avaliable"); + Logger.error("Unimplemented shell type -- no orbitals avaliable: " + line); if (isOutputFile) return; if (isOK) { @@ -186,7 +186,6 @@ nOrbitals = 0; for (int i = 0; i < shellCount; i++) { tokens = getTokens(readLine()); - readLine(); // skip second line? int[] slater = new int[4]; slater[0] = parseInt(tokens[0]) - 1; // atom pointer; 1-based int n = parseInt(tokens[1]); @@ -194,25 +193,39 @@ switch (n) { case 1: slater[1] = JmolAdapter.SHELL_S; + readLine(); break; case 3: + if (!"101 102 103".equals(readLine().trim())) + return false; slater[1] = JmolAdapter.SHELL_P; break; case 4: + if (!"1 101 102 103".equals(readLine().trim())) + return false; slater[1] = JmolAdapter.SHELL_SP; break; case 5: // TODO order? - // GenNBO is 251 252 253 254 255 for Dxy Dxz Dyz Dx2-y2 D2z2-x2-y2 - // org.jmol.quantum.MOCalculation expects d2z^2-x2-y2, dxz, dyz, dx^2-y^2, dxy + // GenNBO is 251 252 253 254 255 + // for Dxy Dxz Dyz Dx2-y2 D2z2-x2-y2 + // org.jmol.quantum.MOCalculation expects + // d2z^2-x2-y2, dxz, dyz, dx2-y2, dxy + if (!"255 252 253 254 251".equals(readLine().trim())) + return false; slater[1] = JmolAdapter.SHELL_D_SPHERICAL; - return false; + break; case 6: - // TODO order? - // GenNBO is 201 202 203 204 205 206 for Dxx Dxy Dxz Dyy Dyz Dzz - // org.jmol.quantum.MOCalculation expects Dxx Dyy Dzz Dxy Dxz Dyz + // TODO order? 201 204 206 202 203 205 + // GenNBO is 201 202 203 204 205 206 + // for Dxx Dxy Dxz Dyy Dyz Dzz + // org.jmol.quantum.MOCalculation expects + // Dxx Dyy Dzz Dxy Dxz Dyz + // ie. 201 204 206 202 203 205 + if (!"201 204 206 202 203 205".equals(readLine().trim())) + return false; slater[1] = JmolAdapter.SHELL_D_CARTESIAN; - return false; + break; case 7: // TODO order? // GenNBO is 351 352 353 354 355 356 357 @@ -220,18 +233,25 @@ // 4xz2-x3-xy2 // 4yz2-x2y-y3 // x2z-y2z - // xyz+x3-3xy2 - // 3x2y-y3 + // xyz + // x3-3xy2 + // 3x2y-y3 + // org.jmol.quantum.MOCalculation expects the same + if (!"351 352 353 354 355 356 357".equals(readLine().trim())) + return false; slater[1] = JmolAdapter.SHELL_F_SPHERICAL; - return false; + break; case 10: // TODO order? // GenNBO is 301 302 303 304 305 306 307 308 309 310 // for xxx xxy xxz xyy xyz xzz yyy yyz yzz zzz // org.jmol.quantum.MOCalculation expects // xxx yyy zzz xyy xxy xxz xzz yzz yyz xyz + // 301 307 310 304 302 303 306 309 308 305 + if (!"301 307 310 304 302 303 306 309 308 305".equals(readLine().trim())) + return false; slater[1] = JmolAdapter.SHELL_F_CARTESIAN; - return false; + break; } // 0 = S, 1 = P, 2 = SP, 3 = D, 4 = F slater[2] = parseInt(tokens[2]) - 1; // gaussian list pointer @@ -239,11 +259,6 @@ shells.addElement(slater); } - for (int i = 0; i < nOrbitals; i++) { - Hashtable mo = new Hashtable(); - orbitals.add(mo); - } - // get alphas and exponents for (int j = 0; j < 5; j++) { @@ -305,7 +320,11 @@ } Logger.info(sb.toString()); tokens = getTokens(sb.toString()); - for (int i = 0; i < nOrbitals; i++) { + for (int i = 0; i < tokens.length; i++) { + Hashtable mo = new Hashtable(); + orbitals.add(mo); + } + for (int i = 0; i < tokens.length; i++) { Hashtable mo = (Hashtable) orbitals.get(i); String type = tokens[i]; mo.put("type", moType + " " + type); @@ -318,16 +337,14 @@ private void readOrbitalData(boolean isMO) throws Exception { if (isMO) readLine(); + int nAOs = nOrbitals; + nOrbitals = orbitals.size(); for (int i = 0; i < nOrbitals; i++) { Hashtable mo = (Hashtable) orbitals.get(i); - float[] coefs = new float[nOrbitals]; + float[] coefs = new float[nAOs]; mo.put("coefficients", coefs); if (isMO) - for (int j = 0; j < nOrbitals;) { - String[] data = getTokens(readLine()); - for (int k = 0; k < data.length; k++, j++) - coefs[j] = parseFloat(data[k]); - } + fillFloatArray(coefs); else coefs[i] = 1; } Modified: trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java 2010-03-25 12:15:09 UTC (rev 12697) +++ trunk/Jmol/src/org/jmol/adapter/smarter/Resolver.java 2010-03-25 15:00:49 UTC (rev 12698) @@ -774,9 +774,9 @@ if (line4trimmed.endsWith("V2000") || line4trimmed.endsWith("v2000")) return true; try { - Integer.parseInt(line4trimmed.substring(0, 3).trim()); - Integer.parseInt(line4trimmed.substring(3, 6).trim()); - return (lines[0].indexOf("@<TRIPOS>") != 0 + int n1 = Integer.parseInt(lines[3].substring(0, 3).trim()); + int n2 = Integer.parseInt(lines[3].substring(3, 6).trim()); + return (n1 != 0 && n2 != 0 && lines[0].indexOf("@<TRIPOS>") != 0 && lines[1].indexOf("@<TRIPOS>") != 0 && lines[2] .indexOf("@<TRIPOS>") != 0); } catch (NumberFormatException nfe) { Modified: trunk/Jmol/src/org/jmol/quantum/MOCalculation.java =================================================================== --- trunk/Jmol/src/org/jmol/quantum/MOCalculation.java 2010-03-25 12:15:09 UTC (rev 12697) +++ trunk/Jmol/src/org/jmol/quantum/MOCalculation.java 2010-03-25 15:00:49 UTC (rev 12698) @@ -227,7 +227,7 @@ } as5D = (moCoeff > moCoefficients.length); if (as5D) - Logger.info("MO calculation is assuming spherical (5D,7F) orbitals"); + Logger.error("MO calculation does not have the proper number of coefficients! Assuming spherical (5D,7F) orbitals"); } private boolean checkCalculationType() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |