From: <ha...@us...> - 2010-03-29 15:40:17
|
Revision: 12727 http://jmol.svn.sourceforge.net/jmol/?rev=12727&view=rev Author: hansonr Date: 2010-03-29 15:40:09 +0000 (Mon, 29 Mar 2010) Log Message: ----------- version=11.9.37_dev # TODO: minimize documentation # TODO: write JMOL not documented # code: generalized d/f orbital order reading # bug fix: WebMO f-orbital order fix Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/quantum/GenNBOReader.java trunk/Jmol/src/org/jmol/adapter/readers/quantum/MOReader.java trunk/Jmol/src/org/jmol/adapter/readers/quantum/SlaterReader.java trunk/Jmol/src/org/jmol/adapter/readers/quantum/WebMOReader.java trunk/Jmol/src/org/jmol/api/MOCalculationInterface.java trunk/Jmol/src/org/jmol/jvxl/readers/IsoMOReader.java trunk/Jmol/src/org/jmol/quantum/MOCalculation.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/JmolConstants.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Added Paths: ----------- trunk/Jmol/src/org/jmol/adapter/readers/quantum/BasisFunctionReader.java Added: trunk/Jmol/src/org/jmol/adapter/readers/quantum/BasisFunctionReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/quantum/BasisFunctionReader.java (rev 0) +++ trunk/Jmol/src/org/jmol/adapter/readers/quantum/BasisFunctionReader.java 2010-03-29 15:40:09 UTC (rev 12727) @@ -0,0 +1,115 @@ +/* $RCSfile$ + * $Author: egonw $ + * $Date: 2006-03-18 15:59:33 -0600 (Sat, 18 Mar 2006) $ + * $Revision: 4652 $ + * + * Copyright (C) 2003-2005 Miguel, Jmol Development, www.jmol.org + * + * Contact: jmo...@li... + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.jmol.adapter.readers.quantum; + +import org.jmol.adapter.smarter.*; +import org.jmol.util.Logger; + +import java.util.Hashtable; + +import java.util.Vector; + +/** + * + * @author hansonr <ha...@st...> + */ +abstract class BasisFunctionReader extends AtomSetCollectionReader { + + protected Hashtable moData = new Hashtable(); + protected Vector orbitals = new Vector(); + protected int nOrbitals = 0; + + private int[][] dfCoefMaps; + + + // DS: org.jmol.quantum.MOCalculation expects + // d2z^2-x2-y2, dxz, dyz, dx2-y2, dxy + + // DC: org.jmol.quantum.MOCalculation expects + // Dxx Dyy Dzz Dxy Dxz Dyz + + // FS: org.jmol.quantum.MOCalculation expects + // as 2z3-3x2z-3y2z + // 4xz2-x3-xy2 + // 4yz2-x2y-y3 + // x2z-y2z + // xyz + // x3-3xy2 + // 3x2y-y3 + + // FC: org.jmol.quantum.MOCalculation expects + // xxx yyy zzz xyy xxy xxz xzz yzz yyz xyz + + + /** + * + * finds the position in the Jmol-required list of function types. This list is + * reader-dependent. + * + * @param fileList + * @param shellType + * @param jmolList + * @param minLength + * @return true if successful + * + */ + protected boolean getDFMap(String fileList, int shellType, String jmolList, int minLength) { + if (fileList.equals(jmolList)) + return true; + + + // say we had line = "251 252 253 254 255" i points here + // Jmol expects list "255 252 253 254 251" pt points here + // we need an array that reads + // [4 0 0 0 -4] + // meaning add that number to the pointer for this coef. + if (dfCoefMaps == null) { + dfCoefMaps = new int[][] {null, null, null, // first unused; P and SP are assumed standard X Y Z + new int[5], new int[6], new int[7], new int[10]}; + moData.put("dfCoefMaps", dfCoefMaps); + } + String[] tokens = getTokens(fileList); + boolean isOK = true; + for (int i = 0; i < tokens.length && isOK; i++) { + String key = tokens[i]; + if (key.length() >= minLength) { + int pt = jmolList.indexOf(key); + if (pt >= 0) { + pt /= 6; + dfCoefMaps[shellType][pt] = i - pt; + continue; + } + } + isOK = false; + } + if (!isOK) { + Logger.error("Disabling orbitals of type " + shellType + " -- Cannot read orbital order for: " + fileList + "\n expecting: " + jmolList); + dfCoefMaps[shellType][0] = Integer.MIN_VALUE; + } + return isOK; + } + + + +} Property changes on: trunk/Jmol/src/org/jmol/adapter/readers/quantum/BasisFunctionReader.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/Jmol/src/org/jmol/adapter/readers/quantum/GenNBOReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/quantum/GenNBOReader.java 2010-03-28 12:25:54 UTC (rev 12726) +++ trunk/Jmol/src/org/jmol/adapter/readers/quantum/GenNBOReader.java 2010-03-29 15:40:09 UTC (rev 12727) @@ -64,7 +64,6 @@ private boolean isOutputFile; private String moType = ""; - private int nOrbitals; /* * molname.31 AO molname.32 PNAO molname.33 NAO molname.34 PNHO molname.35 NHO @@ -153,6 +152,37 @@ reader = readerSave; } + private static String DS_LIST = "255 252 253 254 251"; + // 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 + + private static String DC_LIST = "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 + + private static String FS_LIST = "351 352 353 354 355 356 357"; + // GenNBO is 351 352 353 354 355 356 357 + // as 2z3-3x2z-3y2z + // 4xz2-x3-xy2 + // 4yz2-x2y-y3 + // x2z-y2z + // xyz + // x3-3xy2 + // 3x2y-y3 + // org.jmol.quantum.MOCalculation expects the same + private static String FC_LIST = "301 307 310 304 302 303 306 309 308 305"; + // 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 + + + private boolean readData31(String line1, String line2) throws Exception { if (line1 == null) line1 = readLine(); @@ -194,70 +224,42 @@ slater[0] = parseInt(tokens[0]) - 1; // atom pointer; 1-based int n = parseInt(tokens[1]); nOrbitals += n; + line = readLine().trim(); switch (n) { case 1: slater[1] = JmolAdapter.SHELL_S; - readLine(); break; case 3: - if (!"101 102 103".equals(readLine().trim())) + if (!"101 102 103".equals(line)) return false; slater[1] = JmolAdapter.SHELL_P; break; case 4: - if (!"1 101 102 103".equals(readLine().trim())) + if (!"1 101 102 103".equals(line)) return false; slater[1] = JmolAdapter.SHELL_SP; - break; + 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, dx2-y2, dxy - if (!"255 252 253 254 251".equals(readLine().trim())) + if (!getDFMap(line, JmolAdapter.SHELL_D_SPHERICAL, DS_LIST, 3)) return false; slater[1] = JmolAdapter.SHELL_D_SPHERICAL; break; case 6: - // 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())) + if (!getDFMap(line, JmolAdapter.SHELL_D_CARTESIAN, DC_LIST, 3)) return false; slater[1] = JmolAdapter.SHELL_D_CARTESIAN; break; case 7: - // TODO order? - // GenNBO is 351 352 353 354 355 356 357 - // as 2z3-3x2z-3y2z - // 4xz2-x3-xy2 - // 4yz2-x2y-y3 - // x2z-y2z - // xyz - // x3-3xy2 - // 3x2y-y3 - // org.jmol.quantum.MOCalculation expects the same - if (!"351 352 353 354 355 356 357".equals(readLine().trim())) + if (!getDFMap(line, JmolAdapter.SHELL_F_SPHERICAL, FS_LIST, 3)) return false; slater[1] = JmolAdapter.SHELL_F_SPHERICAL; 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())) + if (!getDFMap(line, JmolAdapter.SHELL_F_CARTESIAN, FC_LIST, 3)) return false; slater[1] = JmolAdapter.SHELL_F_CARTESIAN; break; } - // 0 = S, 1 = P, 2 = SP, 3 = D, 4 = F slater[2] = parseInt(tokens[2]) - 1; // gaussian list pointer slater[3] = parseInt(tokens[3]); // number of gaussians shells.addElement(slater); Modified: trunk/Jmol/src/org/jmol/adapter/readers/quantum/MOReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/quantum/MOReader.java 2010-03-28 12:25:54 UTC (rev 12726) +++ trunk/Jmol/src/org/jmol/adapter/readers/quantum/MOReader.java 2010-03-29 15:40:09 UTC (rev 12727) @@ -78,15 +78,13 @@ /AONBO / : Print the AO to NBO transformation * */ -abstract public class MOReader extends AtomSetCollectionReader { +abstract public class MOReader extends BasisFunctionReader { protected int shellCount = 0; protected int gaussianCount = 0; - protected Hashtable moData = new Hashtable(); protected Vector shells; protected float[][] gaussians; - protected Vector orbitals = new Vector(); protected String energyUnits = ""; protected Vector moTypes; @@ -491,5 +489,5 @@ alphaBeta = ""; } } - + } Modified: trunk/Jmol/src/org/jmol/adapter/readers/quantum/SlaterReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/quantum/SlaterReader.java 2010-03-28 12:25:54 UTC (rev 12726) +++ trunk/Jmol/src/org/jmol/adapter/readers/quantum/SlaterReader.java 2010-03-29 15:40:09 UTC (rev 12727) @@ -23,7 +23,6 @@ */ package org.jmol.adapter.readers.quantum; -import org.jmol.adapter.smarter.*; import org.jmol.quantum.SlaterData; import org.jmol.util.Logger; @@ -37,7 +36,7 @@ * * @author hansonr <ha...@st...> */ -abstract class SlaterReader extends AtomSetCollectionReader { +abstract class SlaterReader extends BasisFunctionReader { /* * -- this abstract superclass is cartesian bases only (s, p, d, f) @@ -46,11 +45,8 @@ * */ - protected final Hashtable moData = new Hashtable(); - protected int nOrbitals = 0; protected final Vector slaters = new Vector(); protected SlaterData[] slaterArray; - protected final Vector orbitals = new Vector(); /** * Modified: trunk/Jmol/src/org/jmol/adapter/readers/quantum/WebMOReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/quantum/WebMOReader.java 2010-03-28 12:25:54 UTC (rev 12726) +++ trunk/Jmol/src/org/jmol/adapter/readers/quantum/WebMOReader.java 2010-03-29 15:40:09 UTC (rev 12727) @@ -86,6 +86,8 @@ protected void finalizeReader() throws Exception { super.finalizeReader(); + if (nOrbitals > 0) + setMOs("eV"); if (Logger.debugging) Logger.debug(orbitals.size() + " molecular orbitals read"); } @@ -106,36 +108,29 @@ void readAtoms() throws Exception { /* - - [ATOMS] - C 0 0 -1.11419008746451 - O 0 0 1.11433559637682 - - !!!!or!!!! - - [ATOMS] - 6 0 0 0 - 6 2.81259696844285 0 0 - 16 1.40112510589261 3.14400070481769 0 - 6 4.21654880978248 -0.850781692374614 -2.34559506901613 - + * + * [ATOMS] C 0 0 -1.11419008746451 O 0 0 1.11433559637682 + * + * !!!!or!!!! + * + * [ATOMS] 6 0 0 0 6 2.81259696844285 0 0 16 1.40112510589261 + * 3.14400070481769 0 6 4.21654880978248 -0.850781692374614 + * -2.34559506901613 */ - readLine(); - boolean isAtomicNumber = (parseInt(line) != Integer.MIN_VALUE); - while (line != null && (line.length() == 0 || line.charAt(0) != '[')) { - if (line.length() != 0) { - Atom atom = atomSetCollection.addNewAtom(); - String[] tokens = getTokens(); - if (isAtomicNumber) { - atom.elementSymbol = getElementSymbol(parseInt(tokens[0])); - } else { - atom.elementSymbol = tokens[0]; - } - atom.set(parseFloat(tokens[1]), parseFloat(tokens[2]), parseFloat(tokens[3])); - atom.scale(ANGSTROMS_PER_BOHR); - } - readLine(); + while (getLine()) { + String[] tokens = getTokens(); + if (tokens.length == 0) + continue; + int atNo = parseInt(line); + Atom atom = atomSetCollection.addNewAtom(); + if (atNo == Integer.MIN_VALUE) + atom.elementSymbol = tokens[0]; + else + atom.elementSymbol = getElementSymbol(atNo); + atom.set(parseFloat(tokens[1]), parseFloat(tokens[2]), + parseFloat(tokens[3])); + atom.scale(ANGSTROMS_PER_BOHR); } } @@ -149,11 +144,10 @@ */ - while (readLine() != null - && (line.length() == 0 || line.charAt(0) != '[')) { - if (line.length() == 0) + while (getLine()) { + String[] tokens = getTokens(); + if (tokens.length == 0) continue; - String[] tokens = getTokens(); int atomIndex1 = parseInt(tokens[0]); int atomIndex2 = parseInt(tokens[1]); int order = parseInt(tokens[2]); @@ -162,23 +156,76 @@ } } + + // DS: org.jmol.quantum.MOCalculation expects + // d2z^2-x2-y2, dxz, dyz, dx2-y2, dxy + + // DC: org.jmol.quantum.MOCalculation expects + // Dxx Dyy Dzz Dxy Dxz Dyz + + // FS: org.jmol.quantum.MOCalculation expects + // as 2z3-3x2z-3y2z + // 4xz2-x3-xy2 + // 4yz2-x2y-y3 + // x2z-y2z + // xyz + // x3-3xy2 + // 3x2y-y3 + + // FC: org.jmol.quantum.MOCalculation expects + // xxx yyy zzz xyy xxy xxz xzz yzz yyz xyz + + + private static String DS_LIST = "NOT IMPLEMENTED IN THIS READER"; + + private static String DC_LIST = "xx yy zz xy xz yz"; + + private static String FS_LIST = "NOT IMPLEMENTED IN THIS READER"; + + private static String FC_LIST = "xxx yyy zzz yyx xxy xxz zzx zzy yyz xyz"; + void readAtomicOrbitalOrder() throws Exception { /* [AO_ORDER] DOrbitals XX YY ZZ XY XZ YZ FOrbitals XXX YYY ZZZ XXY XXZ YYX YYZ ZZX ZZY XYZ */ - Hashtable info = new Hashtable(); - while (readLine() != null - && (line.length() == 0 || line.charAt(0) != '[')) { - if (line.length() == 0) + + while (getLine()) { + String[] tokens = getTokens(); + if (tokens.length == 0) continue; - String[] tokens = getTokens(); - info.put(tokens[0].substring(0, 1), tokens); + String data = line.substring(9).trim().toLowerCase(); + boolean isOK = false; + switch(tokens.length - 1) { + case 3: + case 4: + isOK = true; + break; + case 5: + isOK = (tokens[0].equals("DOrbitals") && getDFMap(data, JmolAdapter.SHELL_D_SPHERICAL, DS_LIST, 99)); + break; + case 6: + isOK = (tokens[0].equals("DOrbitals") && getDFMap(data, JmolAdapter.SHELL_D_CARTESIAN, DC_LIST, 2)); + break; + case 7: + isOK = (tokens[0].equals("FOrbitals") && getDFMap(data, JmolAdapter.SHELL_F_SPHERICAL, FS_LIST, 99)); + break; + case 10: + isOK = (tokens[0].equals("FOrbitals") && getDFMap(data, JmolAdapter.SHELL_F_CARTESIAN, FC_LIST, 3)); + break; + } + if (!isOK) { + Logger.error("atomic orbital order is unrecognized -- skipping reading of MOs due to line: " + line); + orbitals = null; + } } - moData.put("atomicOrbitalOrder", info); } + private boolean getLine() throws Exception { + return (readLine() != null && (line.length() == 0 || line.charAt(0) != '[')); + } + void readGaussianBasis() throws Exception { /* * standard Gaussian format: @@ -202,8 +249,7 @@ int atomIndex = 0; int gaussianPtr = 0; - while (readLine() != null - && (line.length() == 0 || line.charAt(0) != '[')) { + while (getLine()) { String[] tokens = getTokens(); if (tokens.length == 0) continue; @@ -242,19 +288,17 @@ void readSlaterBasis() throws Exception { /* - * slater format: - [STO] - 1 0 0 0 1 1.565085 0.998181645138011 - 1 1 0 0 0 1.842345 2.59926303779824 - 1 0 1 0 0 1.842345 2.59926303779824 - 1 0 0 1 0 1.842345 2.59926303779824 + * slater format: [STO] 1 0 0 0 1 1.565085 0.998181645138011 1 1 0 0 0 + * 1.842345 2.59926303779824 1 0 1 0 0 1.842345 2.59926303779824 1 0 0 1 0 + * 1.842345 2.59926303779824 */ - while (readLine() != null && (line.length() == 0 || line.charAt(0) != '[')) { + while (getLine()) { String[] tokens = getTokens(); - if (tokens.length >= 7) - addSlater(parseInt(tokens[0]) - 1, parseInt(tokens[1]), - parseInt(tokens[2]), parseInt(tokens[3]), parseInt(tokens[4]), - parseFloat(tokens[5]), parseFloat(tokens[6])); + if (tokens.length < 7) + continue; + addSlater(parseInt(tokens[0]) - 1, parseInt(tokens[1]), + parseInt(tokens[2]), parseInt(tokens[3]), parseInt(tokens[4]), + parseFloat(tokens[5]), parseFloat(tokens[6])); } setSlaters(false, false); } @@ -269,15 +313,21 @@ 3 0.111068760356317 4 -0.020187156204269 */ + if (orbitals == null) { + Logger.error("MOLECULAR ORBITALS SKIPPED"); + while(getLine()){ + // skip + } + return; + } Hashtable mo = new Hashtable(); Vector data = new Vector(); float energy = parseFloat(readLine()); float occupancy = parseFloat(readLine()); - while (readLine() != null - && (line.length() == 0 || line.charAt(0) != '[')) { - if (line.length() == 0) + while (getLine()) { + String[] tokens = getTokens(); + if (tokens.length == 0) continue; - String[] tokens = getTokens(); data.addElement(tokens[1]); } float[] coefs = new float[data.size()]; @@ -287,6 +337,6 @@ mo.put("occupancy", new Float(occupancy)); mo.put("coefficients", coefs); orbitals.addElement(mo); - setMOs("eV"); + nOrbitals++; } } Modified: trunk/Jmol/src/org/jmol/api/MOCalculationInterface.java =================================================================== --- trunk/Jmol/src/org/jmol/api/MOCalculationInterface.java 2010-03-28 12:25:54 UTC (rev 12726) +++ trunk/Jmol/src/org/jmol/api/MOCalculationInterface.java 2010-03-29 15:40:09 UTC (rev 12727) @@ -1,7 +1,6 @@ package org.jmol.api; import java.util.BitSet; -import java.util.Hashtable; import java.util.Vector; import javax.vecmath.Point3f; @@ -13,7 +12,7 @@ String calculationType, Point3f[] atomCoordAngstroms, int firstAtomOffset, Vector shells, - float[][] gaussians, Hashtable aoOrdersDF, + float[][] gaussians, int[][] dfCoefMaps, Object slaters, float[] moCoefficients, float[] nuclearCharges, boolean doNormalize); Modified: trunk/Jmol/src/org/jmol/jvxl/readers/IsoMOReader.java =================================================================== --- trunk/Jmol/src/org/jmol/jvxl/readers/IsoMOReader.java 2010-03-28 12:25:54 UTC (rev 12726) +++ trunk/Jmol/src/org/jmol/jvxl/readers/IsoMOReader.java 2010-03-29 15:40:09 UTC (rev 12727) @@ -108,7 +108,7 @@ q.calculate(volumeData, bsMySelected, (String) moData .get("calculationType"), atomData.atomXyz, atomData.firstAtomIndex, (Vector) moData.get("shells"), (float[][]) moData.get("gaussians"), - (Hashtable) moData.get("atomicOrbitalOrder"), null, coef, + (int[][]) moData.get("dfCoefMaps"), null, coef, nuclearCharges, moData.get("isNormalized") == null); break; case Parameters.QM_TYPE_SLATER: Modified: trunk/Jmol/src/org/jmol/quantum/MOCalculation.java =================================================================== --- trunk/Jmol/src/org/jmol/quantum/MOCalculation.java 2010-03-28 12:25:54 UTC (rev 12726) +++ trunk/Jmol/src/org/jmol/quantum/MOCalculation.java 2010-03-29 15:40:09 UTC (rev 12727) @@ -31,7 +31,6 @@ import javax.vecmath.Point3f; import java.util.Vector; -import java.util.Hashtable; import java.util.BitSet; /* @@ -123,7 +122,9 @@ private float occupancy = 2f; //for now -- RHF only //private float coefMax = Integer.MAX_VALUE; private boolean doNormalize = true; - + // DS DC FS FC + private int[][] dfCoefMaps = new int[][] {null, null, null, new int[5], new int[6], new int[7], new int[10]}; + // private float[] nuclearCharges; protected float[][][] voxelDataTemp; @@ -131,23 +132,25 @@ public MOCalculation() { } -public void calculate(VolumeDataInterface volumeData, BitSet bsSelected, + public void calculate(VolumeDataInterface volumeData, BitSet bsSelected, String calculationType, Point3f[] atomCoordAngstroms, int firstAtomOffset, Vector shells, - float[][] gaussians, Hashtable aoOrdersDF, + float[][] gaussians, int[][] dfCoefMaps, Object slaters, float[] moCoefficients, float[] nuclearCharges, boolean doNormalize) { - this.doNormalize = doNormalize; + boolean testing = false; this.calculationType = calculationType; this.firstAtomOffset = firstAtomOffset; this.shells = shells; this.gaussians = gaussians; - //this.aoOrdersDF = aoOrdersDF; + if (dfCoefMaps != null) + this.dfCoefMaps = dfCoefMaps; this.slaters = (SlaterData[]) slaters; this.moCoefficients = moCoefficients; //this.nuclearCharges = nuclearCharges; - boolean testing = false; this.isElectronDensity = (testing || nuclearCharges != null); + this.doNormalize = doNormalize; + int[] countsXYZ = volumeData.getVoxelCounts(); initialize(countsXYZ[0], countsXYZ[1], countsXYZ[2]); voxelData = volumeData.getVoxelData(); @@ -285,14 +288,17 @@ case JmolConstants.SHELL_SP: addDataSP(); break; + case JmolConstants.SHELL_D_SPHERICAL: + addData5D(); + break; case JmolConstants.SHELL_D_CARTESIAN: if (as5D) addData5D(); else addData6D(); break; - case JmolConstants.SHELL_D_SPHERICAL: - addData5D(); + case JmolConstants.SHELL_F_SPHERICAL: + addData7F(); break; case JmolConstants.SHELL_F_CARTESIAN: if (as5D) @@ -300,9 +306,6 @@ else addData10F(); break; - case JmolConstants.SHELL_F_SPHERICAL: - addData7F(); - break; default: Logger.warn(" Unsupported basis type for atomno=" + (atomIndex + 1) + " -- use \"set loglevel 5\" to debug."); @@ -529,18 +532,19 @@ private void addData6D() { //expects 6 orbitals in the order XX YY ZZ XY XZ YZ - if (thisAtom == null || isElectronDensity) { + int[] map = dfCoefMaps[JmolConstants.SHELL_D_CARTESIAN]; + if (thisAtom == null || isElectronDensity || map[0] == Integer.MIN_VALUE) { moCoeff += 6; return; } if (doDebug) - dumpInfo("XXYYZZXYXZYZ"); - float mxx = moCoefficients[moCoeff++]; - float myy = moCoefficients[moCoeff++]; - float mzz = moCoefficients[moCoeff++]; - float mxy = moCoefficients[moCoeff++]; - float mxz = moCoefficients[moCoeff++]; - float myz = moCoefficients[moCoeff++]; + dumpInfo(JmolConstants.SHELL_D_CARTESIAN, map); + float mxx = moCoefficients[map[0] + moCoeff++]; + float myy = moCoefficients[map[1] + moCoeff++]; + float mzz = moCoefficients[map[2] + moCoeff++]; + float mxy = moCoefficients[map[3] + moCoeff++]; + float mxz = moCoefficients[map[4] + moCoeff++]; + float myz = moCoefficients[map[5] + moCoeff++]; for (int ig = 0; ig < nGaussians; ig++) { float alpha = gaussians[gaussianPtr + ig][0]; float c1 = gaussians[gaussianPtr + ig][1]; @@ -593,12 +597,13 @@ // "Trasnformation Between Cartesian and Pure Spherical Harmonic Gaussians", // Schelgel and Frisch, Int. J. Quant. Chem 54, 83-87, 1995 - if (thisAtom == null || isElectronDensity) { + int[] map = dfCoefMaps[JmolConstants.SHELL_D_SPHERICAL]; + if (thisAtom == null || isElectronDensity || map[0] == Integer.MIN_VALUE) { moCoeff += 5; return; } if (doDebug) - dumpInfo(JmolConstants.SHELL_D_SPHERICAL); + dumpInfo(JmolConstants.SHELL_D_SPHERICAL, map); float alpha, c1, a; float x, y, z; @@ -622,11 +627,11 @@ // Normalization constant that shows up for dx^2-y^2 final float root34 =(doNormalize ? (float) Math.sqrt(0.75) : 1); - float m0 = moCoefficients[moCoeff++]; - float m1p = moCoefficients[moCoeff++]; - float m1n = moCoefficients[moCoeff++]; - float m2p = moCoefficients[moCoeff++]; - float m2n = moCoefficients[moCoeff++]; + float m0 = moCoefficients[map[0] + moCoeff++]; + float m1p = moCoefficients[map[1] + moCoeff++]; + float m1n = moCoefficients[map[2] + moCoeff++]; + float m2p = moCoefficients[map[3] + moCoeff++]; + float m2n = moCoefficients[map[4] + moCoeff++]; for (int ig = 0; ig < nGaussians; ig++) { alpha = gaussians[gaussianPtr + ig][0]; @@ -674,12 +679,13 @@ private void addData10F() { // expects 10 orbitals in the order XXX, YYY, ZZZ, XYY, XXY, // XXZ, XZZ, YZZ, YYZ, XYZ - if (thisAtom == null || isElectronDensity) { + int[] map = dfCoefMaps[JmolConstants.SHELL_F_CARTESIAN]; + if (thisAtom == null || isElectronDensity || map[0] == Integer.MIN_VALUE) { moCoeff += 10; return; } if (doDebug) - dumpInfo(JmolConstants.SHELL_F_CARTESIAN); + dumpInfo(JmolConstants.SHELL_F_CARTESIAN, map); float alpha; float c1; float a; @@ -707,16 +713,16 @@ final float norm2 =(doNormalize ? (float) (norm1 / Math.sqrt(3)) : 1); final float norm3 =(doNormalize ? (float) (norm1 / Math.sqrt(15)) : 1); - float mxxx = moCoefficients[moCoeff++]; - float myyy = moCoefficients[moCoeff++]; - float mzzz = moCoefficients[moCoeff++]; - float mxyy = moCoefficients[moCoeff++]; - float mxxy = moCoefficients[moCoeff++]; - float mxxz = moCoefficients[moCoeff++]; - float mxzz = moCoefficients[moCoeff++]; - float myzz = moCoefficients[moCoeff++]; - float myyz = moCoefficients[moCoeff++]; - float mxyz = moCoefficients[moCoeff++]; + float mxxx = moCoefficients[map[0] + moCoeff++]; + float myyy = moCoefficients[map[1] + moCoeff++]; + float mzzz = moCoefficients[map[2] + moCoeff++]; + float mxyy = moCoefficients[map[3] + moCoeff++]; + float mxxy = moCoefficients[map[4] + moCoeff++]; + float mxxz = moCoefficients[map[5] + moCoeff++]; + float mxzz = moCoefficients[map[6] + moCoeff++]; + float myzz = moCoefficients[map[7] + moCoeff++]; + float myyz = moCoefficients[map[8] + moCoeff++]; + float mxyz = moCoefficients[map[9] + moCoeff++]; for (int ig = 0; ig < nGaussians; ig++) { alpha = gaussians[gaussianPtr + ig][0]; c1 = gaussians[gaussianPtr + ig][1]; @@ -775,13 +781,14 @@ private void addData7F() { // expects 7 real orbitals in the order f0, f+1, f-1, f+2, f-2, f+3, f-3 - if (thisAtom == null || isElectronDensity) { + int[] map = dfCoefMaps[JmolConstants.SHELL_F_SPHERICAL]; + if (thisAtom == null || isElectronDensity || map[0] == Integer.MIN_VALUE) { moCoeff += 7; return; } if (doDebug) - dumpInfo(JmolConstants.SHELL_F_SPHERICAL); + dumpInfo(JmolConstants.SHELL_F_SPHERICAL, map); float alpha, c1, a; float x, y, z, xx, yy, zz; @@ -825,13 +832,13 @@ final float c3n_yyy = c3p_xxx; final float c3n_xxy = c3p_xyy; - float m0 = moCoefficients[moCoeff++]; - float m1p = moCoefficients[moCoeff++]; - float m1n = moCoefficients[moCoeff++]; - float m2p = moCoefficients[moCoeff++]; - float m2n = moCoefficients[moCoeff++]; - float m3p = moCoefficients[moCoeff++]; - float m3n = moCoefficients[moCoeff++]; + float m0 = moCoefficients[map[0] + moCoeff++]; + float m1p = moCoefficients[map[1] + moCoeff++]; + float m1n = moCoefficients[map[2] + moCoeff++]; + float m2p = moCoefficients[map[3] + moCoeff++]; + float m2n = moCoefficients[map[4] + moCoeff++]; + float m3p = moCoefficients[map[5] + moCoeff++]; + float m3n = moCoefficients[map[6] + moCoeff++]; for (int ig = 0; ig < nGaussians; ig++) { alpha = gaussians[gaussianPtr + ig][0]; @@ -1102,7 +1109,7 @@ return; } - private void dumpInfo(int shell) { + private void dumpInfo(int shell, int[] map) { for (int ig = 0; ig < nGaussians; ig++) { float alpha = gaussians[gaussianPtr + ig][0]; float c1 = gaussians[gaussianPtr + ig][1]; @@ -1111,8 +1118,8 @@ if (shell >= 0 && Logger.debugging) { String[] so = JmolConstants.getShellOrder(shell); for (int i = 0; i < so.length; i++) - Logger.debug("MO coeff " + so[i] + " " + (moCoeff + i + 1) + " " - + moCoefficients[moCoeff + i]); + Logger.debug("MO coeff " + so[i] + " " + (map[i] + moCoeff + i + 1) + " " + + moCoefficients[map[i] + moCoeff + i]); } } Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2010-03-28 12:25:54 UTC (rev 12726) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2010-03-29 15:40:09 UTC (rev 12727) @@ -3,6 +3,12 @@ version=11.9.37_dev +# TODO: minimize documentation +# TODO: write JMOL not documented + +# code: generalized d/f orbital order reading +# bug fix: WebMO f-orbital order fix +# # new feature: invertSelected STEREO {center} {atomsToInvert} # # Does a rotation of 180 degrees around a center about a line connecting Modified: trunk/Jmol/src/org/jmol/viewer/JmolConstants.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2010-03-28 12:25:54 UTC (rev 12726) +++ trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2010-03-29 15:40:09 UTC (rev 12727) @@ -3109,18 +3109,18 @@ // these next in cartesian/spherical pairs: - final public static int SHELL_D_CARTESIAN = 3; - final public static int SHELL_D_SPHERICAL = 4; - final public static int SHELL_F_CARTESIAN = 5; - final public static int SHELL_F_SPHERICAL = 6; + final public static int SHELL_D_SPHERICAL = 3; + final public static int SHELL_D_CARTESIAN = 4; + final public static int SHELL_F_SPHERICAL = 5; + final public static int SHELL_F_CARTESIAN = 6; final private static String[] quantumShellTags = {"S", "P", "SP", "L", - "D", "5D", "F", "7F"}; + "5D", "D", "7F", "F"}; final private static int[] quantumShellIDs = { SHELL_S, SHELL_P, SHELL_SP, SHELL_L, - SHELL_D_CARTESIAN, SHELL_D_SPHERICAL, - SHELL_F_CARTESIAN, SHELL_F_SPHERICAL + SHELL_D_SPHERICAL, SHELL_D_CARTESIAN, + SHELL_F_SPHERICAL, SHELL_F_CARTESIAN }; public static final String LOAD_ATOM_DATA_TYPES = "xyz;vxyz;vibration;temperature;occupancy;partialcharge"; Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2010-03-28 12:25:54 UTC (rev 12726) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2010-03-29 15:40:09 UTC (rev 12727) @@ -6568,6 +6568,7 @@ return; } resizeImage(0, 0, false, false, true); + requestRepaintAndWait(); } // ////////////////////////////////////////////////////////////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |