Revision: 18553 http://sourceforge.net/p/jmol/code/18553 Author: hansonr Date: 2013-08-12 20:17:37 +0000 (Mon, 12 Aug 2013) Log Message: ----------- ___JmolVersion="13.2.4_dev_2013.08.12"
bug fix: set loglevel 6 (debugHigh) not working bug fix: {*}.tensor("", "id") not implemented bug fix: {*}.tensor("") not implemented bug fix: {*}.tensor("adp") fails bug fix: {*}.symmetry fails when space group is P1 bug fix: atom tensors lost when merging Modified Paths: -------------- branches/v13_2/Jmol/src/org/jmol/adapter/readers/xtal/CastepReader.java branches/v13_2/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java branches/v13_2/Jmol/src/org/jmol/adapter/readers/xtal/MagresReader.java branches/v13_2/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java branches/v13_2/Jmol/src/org/jmol/api/JmolNMRInterface.java branches/v13_2/Jmol/src/org/jmol/modelset/Atom.java branches/v13_2/Jmol/src/org/jmol/modelset/AtomCollection.java branches/v13_2/Jmol/src/org/jmol/modelset/Measurement.java branches/v13_2/Jmol/src/org/jmol/modelset/MeasurementData.java branches/v13_2/Jmol/src/org/jmol/modelset/ModelCollection.java branches/v13_2/Jmol/src/org/jmol/quantum/NMRCalculation.java branches/v13_2/Jmol/src/org/jmol/script/ScriptMathProcessor.java branches/v13_2/Jmol/src/org/jmol/shape/Measures.java branches/v13_2/Jmol/src/org/jmol/shapespecial/Ellipsoid.java branches/v13_2/Jmol/src/org/jmol/symmetry/UnitCell.java branches/v13_2/Jmol/src/org/jmol/util/Logger.java branches/v13_2/Jmol/src/org/jmol/util/Tensor.java branches/v13_2/Jmol/src/org/jmol/util/V3.java branches/v13_2/Jmol/src/org/jmol/viewer/Jmol.properties Modified: branches/v13_2/Jmol/src/org/jmol/adapter/readers/xtal/CastepReader.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/adapter/readers/xtal/CastepReader.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/adapter/readers/xtal/CastepReader.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -572,7 +572,7 @@ for (int p = 0, i = 0; i < 3; i++) for (int j = 0; j < 3; j++) a[i][j] = data[p++]; - atom.addTensor(Tensor.getTensorFromAsymmetricTensor(a, "charge"), null); + atom.addTensor(Tensor.getTensorFromAsymmetricTensor(a, "charge", atom.atomName + " " + line0), null); if (!haveCharges) appendLoadNote("Ellipsoids set \"charge\": Born Effective Charges"); haveCharges = true; Modified: branches/v13_2/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -1022,7 +1022,7 @@ atoms[index].addTensor(Tensor.getTensorFromEigenVectors(directLatticeVectors, new float[] {parseFloatStr(tokens[1]), parseFloatStr(tokens[3]), - parseFloatStr(tokens[5]) }, "unknown"), null); + parseFloatStr(tokens[5]) }, "unknown", atoms[index].atomName), null); readLine(); } return true; Modified: branches/v13_2/Jmol/src/org/jmol/adapter/readers/xtal/MagresReader.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/adapter/readers/xtal/MagresReader.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/adapter/readers/xtal/MagresReader.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -273,36 +273,39 @@ */ private boolean readTensor() throws Exception { String[] tokens = getTokens(); - String id = tokens[0]; - String units = magresUnits.get(id); + String type = tokens[0]; + String units = magresUnits.get(type); if (units == null) { - Logger.warn(id + " ignored; no units defined; line: " + line); + Logger.warn(type + " ignored; no units defined; line: " + line); return true; } - boolean isIsc = id.startsWith("isc"); + boolean isIsc = type.startsWith("isc"); if (tokens.length == 10) { // raw vector - you get ONE - magresUnits.remove(id); + magresUnits.remove(type); float[] data = new float[9]; for (int i = 0; i < 9;) data[i] = parseFloatStr(tokens[++i]); - Logger.info("Magres reader creating magres_" + id + ": " + Escape.eAF(data)); - atomSetCollection.setAtomSetAuxiliaryInfo("magres_" + id, data); + Logger.info("Magres reader creating magres_" + type + ": " + Escape.eAF(data)); + atomSetCollection.setAtomSetAuxiliaryInfo("magres_" + type, data); } String atomName1 = getAtomName(tokens[1], tokens[2]); int pt = 3; String atomName2 = (isIsc ? getAtomName(tokens[pt++], tokens[pt++]) : null); if (atomName1.equals(atomName2)) { - Logger.warn(id + " ignored; atom1 == atom2 for " + atomName1 + " line: " + line); + Logger.warn(type + " ignored; atom1 == atom2 for " + atomName1 + " line: " + line); return true; } + String id = atomName1; + if (atomName2 != null) + id += "//" + atomName2; double[][] a = new double[3][3]; for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) a[i][j] = Double.valueOf(tokens[pt++]).doubleValue(); int index1 = atomSetCollection.getAtomIndexFromName(atomName1); int index2; - Tensor t = Tensor.getTensorFromAsymmetricTensor(a, id); + Tensor t = Tensor.getTensorFromAsymmetricTensor(a, type, id); if (atomName2 == null) { index2 = -1; atomSetCollection.getAtoms()[index1].addTensor(t, null); Modified: branches/v13_2/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -1353,7 +1353,9 @@ float d2 = cartesian.distanceSquared(cartesians[j]); if (checkSpecial && d2 < 0.0001) { special = atoms[iAtomFirst + j]; - break; + if (special.atomName == null || special.atomName.equals(atoms[i].atomName)) + break; + special = null; } if (checkRange111 && j < baseCount && d2 < minDist2) minDist2 = d2; @@ -1398,7 +1400,7 @@ eigenVectors = symmetry.rotateEllipsoid(iSym, ptTemp, eigenVectors, ptTemp1, ptTemp2); atom1.addTensor(Tensor.getTensorFromEigenVectors(eigenVectors, - t.eigenValues, t.type), null); + t.eigenValues, t.isIsotropic ? "iso" : t.type, t.id), null); } } } Modified: branches/v13_2/Jmol/src/org/jmol/api/JmolNMRInterface.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/api/JmolNMRInterface.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/api/JmolNMRInterface.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -82,7 +82,7 @@ public JmolList<Object> getTensorInfo(String tensorType, String infoType, BS bs); - public Map<String, Float> getMinDistances(MeasurementData md); + public Map<String, Integer> getMinDistances(MeasurementData md); public boolean getState(SB sb); Modified: branches/v13_2/Jmol/src/org/jmol/modelset/Atom.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/modelset/Atom.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/modelset/Atom.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -293,7 +293,9 @@ public float getADPMinMax(boolean isMax) { Tensor[] tensors = getTensors(); - return (tensors == null || tensors[0] == null || tensors[0].iType != Tensor.TYPE_ADP? 0 : tensors[0].getFactoredValue(isMax ? 2 : 1)); + Tensor t; + return (tensors == null || (t = tensors[0]) == null + || t.iType != Tensor.TYPE_ADP ? 0 : t.getFactoredValue(isMax ? 2 : 1)); } public Tensor[] getTensors() { @@ -725,7 +727,7 @@ for (int j = 0; j < nOps; j++) if (atomSymmetry.get(pt++)) str += "," + (j + 1) + "" + cellRange[i]; - return str.substring(1); + return (str.length() == 0 ? "" : str.substring(1)); } public int getModelIndex() { Modified: branches/v13_2/Jmol/src/org/jmol/modelset/AtomCollection.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/modelset/AtomCollection.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/modelset/AtomCollection.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -104,6 +104,7 @@ ionicRadii = mergeModelSet.ionicRadii; partialCharges = mergeModelSet.partialCharges; atomTensors = mergeModelSet.atomTensors; + atomTensorList = mergeModelSet.atomTensorList; setHaveStraightness(false); surfaceDistance100s = null; } Modified: branches/v13_2/Jmol/src/org/jmol/modelset/Measurement.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/modelset/Measurement.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/modelset/Measurement.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -534,15 +534,15 @@ return true; } - public boolean isMin(Map<String, Float> htMin) { + public boolean isMin(Map<String, Integer> htMin) { Atom a1 = (Atom) getAtom(1); Atom a2 = (Atom) getAtom(2); - float d = a2.distanceSquared(a1); + int d = (int) (a2.distanceSquared(a1)*100); String n1 = a1.getAtomName(); String n2 = a2.getAtomName(); String key = (n1.compareTo(n2) < 0 ? n1 + n2 : n2 + n1); - Float min = htMin.get(key); - return (min != null && d == min.floatValue()); + Integer min = htMin.get(key); + return (min != null && d == min.intValue()); } } Modified: branches/v13_2/Jmol/src/org/jmol/modelset/MeasurementData.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/modelset/MeasurementData.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/modelset/MeasurementData.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -83,7 +83,7 @@ /* * the general constructor. tokAction is not used here */ - public MeasurementData set(int tokAction, Map<String, Float> htMin, + public MeasurementData set(int tokAction, Map<String, Integer> htMin, RadiusData radiusData, String strFormat, String units, TickInfo tickInfo, boolean mustBeConnected, boolean mustNotBeConnected, @@ -161,7 +161,7 @@ private Viewer viewer; private int iFirstAtom; private boolean justOneModel = true; - public Map<String, Float> htMin; + public Map<String, Integer> htMin; /** * called by the client to generate a set of measurements Modified: branches/v13_2/Jmol/src/org/jmol/modelset/ModelCollection.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/modelset/ModelCollection.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/modelset/ModelCollection.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -3102,7 +3102,7 @@ if (partialCharges != null) for (int i = i0; i < atomCount; i++) partialCharges[i] = partialCharges[map[i]]; - if (atomTensors != null) { + if (atomTensorList != null) { for (int i = i0; i < atomCount; i++) { Tensor[] list = atomTensorList[i] = atomTensorList[map[i]]; for (int j = list.length; --j >= 0;) { @@ -3134,7 +3134,7 @@ bfactor100s = ArrayUtil.arrayCopyShort(bfactor100s, newLength); if (partialCharges != null) partialCharges = ArrayUtil.arrayCopyF(partialCharges, newLength); - if (atomTensors != null) + if (atomTensorList != null) atomTensorList = (Tensor[][]) ArrayUtil.arrayCopyObject(atomTensorList, newLength); if (atomNames != null) atomNames = ArrayUtil.arrayCopyS(atomNames, newLength); Modified: branches/v13_2/Jmol/src/org/jmol/quantum/NMRCalculation.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/quantum/NMRCalculation.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/quantum/NMRCalculation.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -35,6 +35,7 @@ import org.jmol.io.JmolBinary; import org.jmol.modelset.Atom; import org.jmol.modelset.MeasurementData; +import org.jmol.modelset.Model; import org.jmol.util.BS; import org.jmol.util.Escape; import org.jmol.util.JmolList; @@ -87,40 +88,64 @@ } /** - * Returns a list of tensors that are of the specified type and - * have both atomIndex1 and atomIndex2 in bs. + * Returns a list of tensors that are of the specified type and have both + * atomIndex1 and atomIndex2 in bsA. If there is just one atom specified, then + * the list is "all tensors involving this atom". * + * We have to use atom sites, because interaction tensors are not duplicated. + * * @param type - * @param bs - * @param bs2 + * @param bsA * @return list of Tensors */ @SuppressWarnings("unchecked") - private JmolList<Tensor> getInteractionTensorList(String type, BS bs, BS bs2) { - type = type.toLowerCase(); - BS bsModels = viewer.getModelBitSet(bs, false); - int iAtom = (bs.cardinality() == 1 ? bs.nextSetBit(0) : -1); + private JmolList<Tensor> getInteractionTensorList(String type, BS bsA) { + if (type != null) + type = type.toLowerCase(); + BS bsModels = viewer.getModelBitSet(bsA, false); + BS bs1 = getAtomSiteBS(bsA); + int iAtom = (bs1.cardinality() == 1 ? bs1.nextSetBit(0) : -1); JmolList<Tensor> list = new JmolList<Tensor>(); for (int i = bsModels.nextSetBit(0); i >= 0; i = bsModels.nextSetBit(i + 1)) { - JmolList<Tensor> tensors = (JmolList<Tensor>) viewer.getModelAuxiliaryInfoValue(i, "interactionTensors"); + JmolList<Tensor> tensors = (JmolList<Tensor>) viewer + .getModelAuxiliaryInfoValue(i, "interactionTensors"); if (tensors == null) continue; int n = tensors.size(); for (int j = 0; j < n; j++) { Tensor t = tensors.get(j); - if (t.type.equals(type) - && t.isSelected(bs, iAtom) - && (bs2 == null || bs2.get(getOtherAtom(t, iAtom)))) - + if (type == null || t.type.equals(type) && t.isSelected(bs1, iAtom)) list.addLast(t); - } + } } return list; } - private int getOtherAtom(Tensor t, int iAtom) { - return (t.atomIndex1 == iAtom ? t.atomIndex2 : t.atomIndex1); + /** + * Interaction tensors are not repeated for every possible combination. They are just for the + * base atom set. These are identified as a.atomIndex == models[b.modelIndex].firstAtomIndex + b.atomSite - 1 + * @param bsA + * @return new bs in terms of atom sites + */ + private BS getAtomSiteBS(BS bsA) { + if (bsA == null) + return null; + BS bs = new BS(); + Atom[] atoms = viewer.modelSet.atoms; + Model[] models = viewer.modelSet.models; + + for (int i = bsA.nextSetBit(0); i >= 0; i = bsA.nextSetBit(i + 1)) { + if (!bsA.get(i)) + continue; + Atom a = atoms[i]; + bs.set(models[a.modelIndex].firstAtomIndex - 1 + a.atomSite); + } + return bs; } + +// private int getOtherAtom(Tensor t, int iAtom) { +// return (t.atomIndex1 == iAtom ? t.atomIndex2 : t.atomIndex1); +// } public BS getUniqueTensorSet(BS bsAtoms) { BS bs = new BS(); @@ -176,11 +201,9 @@ if (type == null || a1.modelIndex != a2.modelIndex) return 0; BS bs = new BS(); - BS bs2 = new BS(); - int i0 = viewer.modelSet.models[a1.modelIndex].firstAtomIndex - 1; - bs.set(a1.atomSite + i0); - bs2.set(a2.atomSite + i0); - JmolList<Tensor> list = getInteractionTensorList(type, bs, bs2); + bs.set(a1.index); + bs.set(a2.index); + JmolList<Tensor> list = getInteractionTensorList(type, bs); if (list.size() == 0) return Float.NaN; isc = list.get(0); @@ -216,8 +239,7 @@ } public float getDipolarCouplingHz(Atom a1, Atom a2, V3 vField) { - V3 v12 = V3.newV(a2); - v12.sub(a1); + V3 v12 = V3.newVsub(a2, a1); double r = v12.length(); double costheta = v12.dot(vField) / r / vField.length(); return (float) (getDipolarConstantHz(a1, a2) * (3 * costheta - 1) / 2); @@ -369,10 +391,11 @@ public JmolList<Object> getTensorInfo(String tensorType, String infoType, BS bs) { - + if ("".equals(tensorType)) + tensorType = null; JmolList<Object> data = new JmolList<Object>(); JmolList<Object> list1; - if (infoType.equals(";dc.")) { + if (";dc.".equals(infoType)) { // tensorType is irrelevant for dipolar coupling constant Atom[] atoms = viewer.modelSet.atoms; for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) @@ -384,9 +407,11 @@ .addLast(Float.valueOf(getDipolarConstantHz(atoms[i], atoms[j]))); data.addLast(list1); } - } else if (tensorType.startsWith("isc")) { + return data; + } + if (tensorType == null || tensorType.startsWith("isc")) { boolean isJ = infoType.equals(";j."); - JmolList<Tensor> list = getInteractionTensorList(tensorType, bs, null); + JmolList<Tensor> list = getInteractionTensorList(tensorType, bs); int n = (list == null ? 0 : list.size()); for (int i = 0; i < n; i++) { Tensor t = list.get(i); @@ -397,9 +422,17 @@ : t.getInfo(infoType)); data.addLast(list1); } - } else { - boolean isChi = tensorType.startsWith("efg") && infoType.equals(";chi."); - for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { + if (tensorType != null) + return data; + } + boolean isChi = tensorType != null && tensorType.startsWith("efg") + && infoType.equals(";chi."); + for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { + if (tensorType == null) { + Tensor[] a = viewer.modelSet.getAtomTensorList(i); + for (int j = 0; j < a.length; j++) + data.addLast(a[j].getInfo(infoType)); + } else { Tensor t = viewer.modelSet.getAtomTensor(i, tensorType); data.addLast(t == null ? null : isChi ? Float .valueOf(getQuadrupolarConstant(t)) : t.getInfo(infoType)); @@ -408,7 +441,7 @@ return data; } - public Map<String, Float> getMinDistances(MeasurementData md) { + public Map<String, Integer> getMinDistances(MeasurementData md) { BS bsPoints1 = (BS) md.points.get(0); int n1 = bsPoints1.cardinality(); if (n1 == 0 || !(md.points.get(1) instanceof BS)) @@ -417,7 +450,7 @@ int n2 = bsPoints2.cardinality(); if (n1 < 2 && n2 < 2) return null; - Map<String, Float> htMin = new Hashtable<String, Float>(); + Map<String, Integer> htMin = new Hashtable<String, Integer>(); Atom[] atoms = viewer.modelSet.atoms; for (int i = bsPoints1.nextSetBit(0); i >= 0; i = bsPoints1 .nextSetBit(i + 1)) { @@ -426,19 +459,19 @@ for (int j = bsPoints2.nextSetBit(0); j >= 0; j = bsPoints2 .nextSetBit(j + 1)) { Atom a2 = atoms[j]; - float d = a2.distanceSquared(a1); + int d = (int) (a2.distanceSquared(a1) * 100); if (d == 0) continue; String name1 = a2.getAtomName(); String key = (name.compareTo(name1) < 0 ? name + name1 : name1 + name); - Float min = htMin.get(key); + Integer min = htMin.get(key); if (min == null) { - min = Float.valueOf(d); + min = Integer.valueOf(d); htMin.put(key, min); continue; } - if (d < min.floatValue()) - htMin.put(key, Float.valueOf(d)); + if (d < min.intValue()) + htMin.put(key, Integer.valueOf(d)); } } return htMin; Modified: branches/v13_2/Jmol/src/org/jmol/script/ScriptMathProcessor.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/script/ScriptMathProcessor.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/script/ScriptMathProcessor.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -835,17 +835,18 @@ } private boolean evaluateTensor(SV[] args) throws ScriptException { + // {*}.tensor() + // {*}.tensor("isc") // only within this atom set + // {atomindex=1}.tensor("isc") // all to this atom // {*}.tensor("efg","eigenvalues") - // T.tensor is set to allow exactly 2 parameters - // change that in T.java to adjust - if (args.length == 0 || args.length > 2) + if (args.length > 2) return false; BS bs = SV.getBitSet(getX(), false); - String tensorType = SV.sValue(args[0]).toLowerCase(); + String tensorType = (args.length == 0 ? null : SV.sValue(args[0]).toLowerCase()); String infoType = ";" - + (args.length == 1 ? "all" : SV.sValue(args[1]).toLowerCase()) + "."; + + (args.length < 2 ? "all" : SV.sValue(args[1]).toLowerCase()) + "."; JmolNMRInterface calc = viewer.getNMRCalculation(); - if (tensorType.equals("unique")) + if ("unique".equals(tensorType)) return addXBs(calc.getUniqueTensorSet(bs)); return addXList(calc.getTensorInfo(tensorType, infoType, bs)); } Modified: branches/v13_2/Jmol/src/org/jmol/shape/Measures.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/shape/Measures.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/shape/Measures.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -67,7 +67,7 @@ TickInfo tickInfo; TickInfo defaultTickInfo; public JmolFont font3d; - private Map<String, Float> htMin; + private Map<String, Integer> htMin; @Override protected void initModelSet() { Modified: branches/v13_2/Jmol/src/org/jmol/shapespecial/Ellipsoid.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/shapespecial/Ellipsoid.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/shapespecial/Ellipsoid.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -128,7 +128,7 @@ protected void setEquation(double[] coef) { isValid = false; - tensor = Tensor.getTensorFromThermalEquation(coef); + tensor = Tensor.getTensorFromThermalEquation(coef, null); validate(true); } Modified: branches/v13_2/Jmol/src/org/jmol/symmetry/UnitCell.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/symmetry/UnitCell.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/symmetry/UnitCell.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -26,6 +26,7 @@ package org.jmol.symmetry; import org.jmol.util.BoxInfo; +import org.jmol.util.Escape; import org.jmol.util.Matrix3f; import org.jmol.util.Matrix4f; import org.jmol.util.P3; @@ -307,7 +308,7 @@ float[] eigenValues = new float[] {f, f, f}; // sqrt will be taken when converted to lengths later // no factor of 0.5 pi^2 - return Tensor.getTensorFromEigenVectors(unitVectors, eigenValues, "iso"); + return Tensor.getTensorFromEigenVectors(unitVectors, eigenValues, "iso", "Uiso=" + f); } double[] Bcart = new double[6]; @@ -367,7 +368,7 @@ //System.out.println("UnitCell Bcart=" + Bcart[0] + " " + Bcart[1] + " " // + Bcart[2] + " " + Bcart[3] + " " + Bcart[4] + " " + Bcart[5]); - return Tensor.getTensorFromThermalEquation(Bcart); + return Tensor.getTensorFromThermalEquation(Bcart, Escape.eAF(parBorU)); } P3[] getCanonicalCopy(float scale) { Modified: branches/v13_2/Jmol/src/org/jmol/util/Logger.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/util/Logger.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/util/Logger.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -110,6 +110,7 @@ level = LEVEL_MAX - 1; _activeLevels[level] = active; debugging = isActiveLevel(LEVEL_DEBUG) || isActiveLevel(LEVEL_DEBUGHIGH); + debuggingHigh = (debugging && _activeLevels[LEVEL_DEBUGHIGH]); } /** Modified: branches/v13_2/Jmol/src/org/jmol/util/Tensor.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/util/Tensor.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/util/Tensor.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -45,8 +45,10 @@ private static EigenSort tSort; // used for sorting eigenvector/values + // base data: + public String id; public String type; public int iType = TYPE_OTHER; @@ -120,7 +122,8 @@ + ";asymmatrix..." + ";symmatrix...." + ";value........" + ";isotropy....." + ";anisotropy..." + ";asymmetry...." + ";eulerzyz....." + ";eulerzxz....." + ";quaternion..." - + ";indices......" + ";string......." + ";type........."; + + ";indices......" + ";string......." + ";type........." + + ";id..........."; /** * returns an object of the specified type, including "eigenvalues", * "eigenvectors", "asymmetric", "symmetric", "trace", "indices", and "type" @@ -137,8 +140,11 @@ Map<String, Object> info = new Hashtable<String, Object>(); String[] s = Parser.getTokens(TextFormat.replaceAllCharacter(infoList, ";.", ' ').trim()); Arrays.sort(s); - for (int i = 0; i < s.length; i++) - info.put(s[i], getInfo(s[i])); + for (int i = 0; i < s.length; i++) { + Object o = getInfo(s[i]); + if (o != null) + info.put(s[i], o); + } return info; case 1: @@ -195,6 +201,9 @@ return this.toString(); case 14: return type; + + case 15: + return id; } } @@ -222,6 +231,7 @@ t.modelIndex = t0.modelIndex; t.atomIndex1 = t0.atomIndex1; t.atomIndex2 = t0.atomIndex2; + t.id = t0.id; return t; } @@ -237,9 +247,10 @@ * * @param asymmetricTensor * @param type + * @param id * @return Tensor */ - public static Tensor getTensorFromAsymmetricTensor(double[][] asymmetricTensor, String type) { + public static Tensor getTensorFromAsymmetricTensor(double[][] asymmetricTensor, String type, String id) { double[][] a = new double[3][3]; for (int i = 3; --i >= 0;) for (int j = 3; --j >= 0;) @@ -284,9 +295,10 @@ V3[] vectors = new V3[3]; float[] values = new float[3]; eigen.fillArrays(vectors, values); - Tensor t = newTensorType(vectors, values, type); + Tensor t = newTensorType(vectors, values, type, id); t.asymMatrix = asymmetricTensor; t.symMatrix = a; + t.id = id; return t; } @@ -296,17 +308,18 @@ * @param eigenVectors * @param eigenValues * @param type + * @param id * @return Tensor */ public static Tensor getTensorFromEigenVectors(V3[] eigenVectors, - float[] eigenValues, String type) { + float[] eigenValues, String type, String id) { float[] values = new float[3]; V3[] vectors = new V3[3]; for (int i = 0; i < 3; i++) { vectors[i] = V3.newV(eigenVectors[i]); values[i] = eigenValues[i]; } - return newTensorType(vectors, values, type); + return newTensorType(vectors, values, type, id); } /** @@ -340,12 +353,14 @@ * (see http://www.iucr.org/iucr-top/comm/cnom/adp/finrepone/finrepone.html) * * @param coefs + * @param id * @return Tensor */ - public static Tensor getTensorFromThermalEquation(double[] coefs) { + public static Tensor getTensorFromThermalEquation(double[] coefs, String id) { Tensor t = new Tensor(); t.eigenValues = new float[3]; t.eigenVectors = new V3[3]; + t.id = (id == null ? "coefs=" + Escape.eAD(coefs) : id); // assumes an ellipsoid centered on 0,0,0 // called by UnitCell for the initial creation from PDB/CIF ADP data double[][] mat = new double[3][3]; @@ -406,15 +421,17 @@ * @param vectors * @param values * @param type + * @param id * @return Tensor */ - private static Tensor newTensorType(V3[] vectors, float[] values, String type) { + private static Tensor newTensorType(V3[] vectors, float[] values, String type, String id) { Tensor t = new Tensor(); t.eigenValues = values; t.eigenVectors = vectors; for (int i = 0; i < 3; i++) t.eigenVectors[i].normalize(); t.setType(type); + t.id = id; t.sortAndNormalize(); t.eigenSignMask = (t.eigenValues[0] >= 0 ? 1 : 0) + (t.eigenValues[1] >= 0 ? 2 : 0) + (t.eigenValues[2] >= 0 ? 4 : 0); Modified: branches/v13_2/Jmol/src/org/jmol/util/V3.java =================================================================== --- branches/v13_2/Jmol/src/org/jmol/util/V3.java 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/util/V3.java 2013-08-12 20:17:37 UTC (rev 18553) @@ -33,13 +33,13 @@ public class V3 extends Tuple3f { public static V3 newV(Tuple3f t) { - V3 v = new V3(); - v.x = t.x; - v.y = t.y; - v.z = t.z; - return v; + return V3.new3(t.x, t.y, t.z); } + public static V3 newVsub(Tuple3f t1, Tuple3f t2) { + return V3.new3(t1.x - t2.x, t1.y - t2.y,t1.z - t2.z); + } + public static V3 new3(float x, float y, float z) { V3 v = new V3(); v.x = x; Modified: branches/v13_2/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- branches/v13_2/Jmol/src/org/jmol/viewer/Jmol.properties 2013-08-12 20:16:55 UTC (rev 18552) +++ branches/v13_2/Jmol/src/org/jmol/viewer/Jmol.properties 2013-08-12 20:17:37 UTC (rev 18553) @@ -9,8 +9,15 @@ # Don't use ___ in your text, as that is the key for stripping out # the information saved in the JAR version of this file. -___JmolVersion="13.2.4_dev_2013.08.10" +___JmolVersion="13.2.4_dev_2013.08.12" +bug fix: set loglevel 6 (debugHigh) not working +bug fix: {*}.tensor("", "id") not implemented +bug fix: {*}.tensor("") not implemented +bug fix: {*}.tensor("adp") fails +bug fix: {*}.symmetry fails when space group is P1 +bug fix: atom tensors lost when merging + bug fix: float parser broken in dev_2013.08.07 bug fix: zoom setting lost in state bug fix: shapeInfo not reporting visibility of isosurface This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite! It's a free troubleshooting tool designed for production. Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits