Revision: 20848 http://sourceforge.net/p/jmol/code/20848 Author: hansonr Date: 2015-10-28 03:40:52 +0000 (Wed, 28 Oct 2015) Log Message: ----------- Jmol.___JmolVersion="14.4.0_2015.10.28"
bug fix: XODYDATA file reader does not read bond info or formal charge // changes in 14.4.0_2015.10.28 Modified Paths: -------------- branches/v14_4/Jmol/src/org/jmol/adapter/readers/xml/XmlOdysseyReader.java branches/v14_4/Jmol/src/org/jmol/scriptext/MathExt.java branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties Modified: branches/v14_4/Jmol/src/org/jmol/adapter/readers/xml/XmlOdysseyReader.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/adapter/readers/xml/XmlOdysseyReader.java 2015-10-27 11:50:31 UTC (rev 20847) +++ branches/v14_4/Jmol/src/org/jmol/adapter/readers/xml/XmlOdysseyReader.java 2015-10-28 03:40:52 UTC (rev 20848) @@ -43,8 +43,11 @@ private String[] myAttributes = { "id", "label", //general "xyz", "element", "hybrid", //atoms "a", "b", "order", //bond + "charge", // group + "entity", // member "box" // boundary }; + private int formalCharge = Integer.MIN_VALUE; public XmlOdysseyReader() { } @@ -63,11 +66,11 @@ } if ("atom".equals(localName)) { - atom = new Atom(); - if (atts.containsKey("label")) - atom.atomName = atts.get("label"); - else - atom.atomName = atts.get("id"); + String id = atts.get("id"); + (atom = new Atom()).atomName = atts + .get(atts.containsKey("label") ? "label" : "id"); + if (id != null && stateScriptVersionInt >= 140400) + asc.atomSymbolicMap.put(id, atom); if (atts.containsKey("xyz")) { String xyz = atts.get("xyz"); String[] tokens = PT.getTokens(xyz); @@ -77,7 +80,6 @@ if (atts.containsKey("element")) { atom.elementSymbol = atts.get("element"); } - return; } if ("bond".equals(localName)) { @@ -89,7 +91,19 @@ asc.addNewBondFromNames(atom1, atom2, order); return; } - + if ("group".equals(localName)) { + String charge = atts.get("charge"); + if (charge != null && charge.indexOf(".") < 0) { + formalCharge = PT.parseInt(charge); + } + return; + } + if ("member".equals(localName) && formalCharge != Integer.MIN_VALUE) { + Atom atom = asc.getAtomFromName(atts.get("entity")); + if (atom != null) + atom.formalCharge = formalCharge; + return; + } if ("boundary".equals(localName)) { String[] boxDim = PT.getTokens(atts.get("box")); float x = parseFloatStr(boxDim[0]); @@ -115,7 +129,6 @@ parent.applySymmetryAndSetTrajectory(); return; } - if ("odyssey_simulation".equals(localName)) { if (modelName != null && phase != null) modelName += " - " + phase; @@ -155,13 +168,13 @@ atom = null; return; } - if ("title".equals(localName)) { + if ("group".equals(localName)) { + formalCharge = Integer.MIN_VALUE; + } else if ("title".equals(localName)) { modelName = chars; - } - if ("formula".equals(localName)) { + } else if ("formula".equals(localName)) { formula = chars; - } - if ("phase".equals(localName)) { + } else if ("phase".equals(localName)) { phase = chars; } keepChars = false; Modified: branches/v14_4/Jmol/src/org/jmol/scriptext/MathExt.java =================================================================== --- branches/v14_4/Jmol/src/org/jmol/scriptext/MathExt.java 2015-10-27 11:50:31 UTC (rev 20847) +++ branches/v14_4/Jmol/src/org/jmol/scriptext/MathExt.java 2015-10-28 03:40:52 UTC (rev 20848) @@ -3233,6 +3233,8 @@ Map<String, Integer> htPivot = null; while (true) { if (AU.isAF(floatOrSVArray)) { + if (tok == T.pivot) + return "NaN"; data = (float[]) floatOrSVArray; ndata = data.length; if (ndata == 0) @@ -3245,6 +3247,8 @@ break; } else { SV sv0 = sv.get(0); + if (sv0.tok == T.point3f) + return getMinMaxPoint(sv, tok); if (sv0.tok == T.string && ((String) sv0.value).startsWith("{")) { Object pt = SV.ptValue(sv0); if (pt instanceof P3) @@ -3282,7 +3286,7 @@ boolean isInt = true; boolean isPivot = (tok == T.pivot); for (int i = ndata; --i >= 0;) { - SV svi = sv.get(i); + SV svi = (sv == null ? SV.vF : sv.get(i)); float v = (isPivot ? 1 : data == null ? SV.fValue(svi) : data[i]); if (Float.isNaN(v)) continue; @@ -3363,52 +3367,44 @@ sv = (Lst<SV>) pointOrSVArray; ndata = sv.size(); } - if (sv != null || data != null) { - P3 result = new P3(); - float[] fdata = new float[ndata]; - boolean ok = true; - for (int xyz = 0; xyz < 3 && ok; xyz++) { - for (int i = 0; i < ndata; i++) { - P3 pt = (data == null ? SV.ptValue(sv.get(i)) : data[i]); - if (pt == null) { - ok = false; - break; - } - switch (xyz) { - case 0: - fdata[i] = pt.x; - break; - case 1: - fdata[i] = pt.y; - break; - case 2: - fdata[i] = pt.z; - break; - } - } - if (!ok) + if (sv == null && data == null) + return "NaN"; + P3 result = new P3(); + float[] fdata = new float[ndata]; + for (int xyz = 0; xyz < 3; xyz++) { + for (int i = 0; i < ndata; i++) { + P3 pt = (data == null ? SV.ptValue(sv.get(i)) : data[i]); + if (pt == null) + return "NaN"; + switch (xyz) { + case 0: + fdata[i] = pt.x; break; - Object f = getMinMax(fdata, tok); - if (f instanceof Number) { - float value = ((Number) f).floatValue(); - switch (xyz) { - case 0: - result.x = value; - break; - case 1: - result.y = value; - break; - case 2: - result.z = value; - break; - } - } else { + case 1: + fdata[i] = pt.y; break; + case 2: + fdata[i] = pt.z; + break; } } - return result; + Object f = getMinMax(fdata, tok); + if (!(f instanceof Number)) + return "NaN"; + float value = ((Number) f).floatValue(); + switch (xyz) { + case 0: + result.x = value; + break; + case 1: + result.y = value; + break; + case 2: + result.z = value; + break; + } } - return "NaN"; + return result; } private Object getMinMaxQuaternion(Lst<SV> svData, int tok) { Modified: branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties 2015-10-27 11:50:31 UTC (rev 20847) +++ branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties 2015-10-28 03:40:52 UTC (rev 20848) @@ -7,8 +7,17 @@ # see also http://chemapps.stolaf.edu/jmol/zip for daily updates -Jmol.___JmolVersion="14.4.0_2015.10.22b" +Jmol.___JmolVersion="14.4.0_2015.10.28" +bug fix: XODYDATA file reader does not read bond info or formal charge // changes in 14.4.0_2015.10.28 + +JmolVersion="14.4.0_2015.10.24" + +bug fix: [{1,2,3},{4,5,6}].average fails +bug fix: [{1,2,3},{4,5,6}].pivot should return "NaN" + +JmolVersion="14.4.0_2015.10.22b" + bug fix: CIF parser fails to read CIF files containing only a single (non-loop) _struct_ref_seq_dif.align_id bug fix: WRITE .... AS does not properly allow for unquoted file name This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits