Revision: 21211 http://sourceforge.net/p/jmol/code/21211 Author: hansonr Date: 2016-08-12 12:21:41 +0000 (Fri, 12 Aug 2016) Log Message: ----------- PyMOL reader upgrade for 176, 177, 181 dump_binary
Modified Paths: -------------- branches/v14_6/Jmol/src/org/jmol/adapter/readers/pymol/PyMOL.java branches/v14_6/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java branches/v14_6/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLScene.java branches/v14_6/Jmol/src/org/jmol/script/ScriptEval.java branches/v14_6/Jmol/src/org/jmol/shape/AtomShape.java branches/v14_6/Jmol/src/org/jmol/shape/Labels.java branches/v14_6/Jmol/src/org/jmol/viewer/Viewer.java trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOL.java trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLScene.java trunk/Jmol/src/org/jmol/script/ScriptEval.java trunk/Jmol/src/org/jmol/shape/AtomShape.java trunk/Jmol/src/org/jmol/shape/Labels.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: branches/v14_6/Jmol/src/org/jmol/adapter/readers/pymol/PyMOL.java =================================================================== --- branches/v14_6/Jmol/src/org/jmol/adapter/readers/pymol/PyMOL.java 2016-08-12 03:46:23 UTC (rev 21210) +++ branches/v14_6/Jmol/src/org/jmol/adapter/readers/pymol/PyMOL.java 2016-08-12 12:21:41 UTC (rev 21211) @@ -6431,14 +6431,14 @@ final static int SEGI = 35; final static int NAME = 36; final static int ELEM = 37; - final static int RESI = 38; + final static int RESI = 38; // not 181 final static int SSTYPE = 39; final static int ALTLOC = 40; final static int RESN = 41; - final static int INSCODE = 42; + final static int INSCODE = 42; // 181 only final static int CHEMFLAG = 43; final static int PROTEKTED = 44; - final static int ANISOU = 45; + final static int ANISOU = 45; // not 177 final static int HETMASK = 46; final static int BONMASK = 47; @@ -6448,7 +6448,7 @@ final static int SETMASK = 51; //1.7.6 type - final static int[] v176 = { LEN, 154, + final static int[] v176 = { LEN, 164, RESV, 0, CUSTOMTYPE, 4, PRIORITY, 8, @@ -6500,14 +6500,15 @@ NAME, 105, // 5 ELEM, 110, // 5 RESI, 115, // 6 - //HASPROP, 111, - SSTYPE, 112, - ALTLOC, 114, - RESN, 116, - ANISOU, 122, - //OLDID, 146 - //PROPID, 150, - + //HASPROP, 121, + SSTYPE, 122, + ALTLOC, 124, + + + RESN, 126, + ANISOU, 132, + //OLDID, 156 + //PROPID, 160, // 4 }; // typedef struct AtomInfoType_1_7_6 { Modified: branches/v14_6/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java =================================================================== --- branches/v14_6/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java 2016-08-12 03:46:23 UTC (rev 21210) +++ branches/v14_6/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java 2016-08-12 12:21:41 UTC (rev 21211) @@ -433,7 +433,7 @@ pymolScene.finalizeVisibility(); if (!isStateScript) { // same idea as for a Jmol state -- session reinitializes - vwr.initialize(false); + vwr.initialize(false, true); addJmolScript(pymolScene.getViewScript(getMapList(map, "view")) .toString()); } @@ -1149,13 +1149,14 @@ Lst<Object> labelPositions, float[] labelArray, BS bsState, int iState) { atomMap[apt] = -1; - String chainID, altLoc, group3, name, sym, label, ssType, resi; + String chainID, altLoc, group3, name, sym, label, ssType, resi, insCode = null; float bfactor, occupancy, radius, partialCharge; int seqNo, intReps, formalCharge, atomColor, serNo, cartoonType, flags, uniqueID = -1; boolean isHetero, bonded; float[] anisou = null; BS bsReps = null; if (haveBinaryArrays) { + int vpt; int pt = apt * vArray[PyMOL.LEN]; seqNo = atomInt(atomArray, pt, vArray[PyMOL.RESV]); chainID = atomStr(atomArray, pt, vArray[PyMOL.CHAIN], lexStr); @@ -1168,8 +1169,12 @@ label = atomStr(atomArray, pt, vArray[PyMOL.LABEL], lexStr); ssType = atomStr(atomArray, pt, vArray[PyMOL.SSTYPE], null); altLoc = atomStr(atomArray, pt, vArray[PyMOL.ALTLOC], null); - byte b = atomArray[pt + vArray[PyMOL.INSCODE]]; - resi = (b == 0 ? "" : "xxx" + (char) b); + if ((vpt = vArray[PyMOL.INSCODE]) == 0) { + resi = atomStr(atomArray, pt, vArray[PyMOL.RESI], null); + } else { + byte b = atomArray[pt + vpt]; + insCode = (b == 0 ? " " :"" + (char) b); + } bfactor = atomFloat(atomArray, pt, vArray[PyMOL.BFACTOR]); occupancy = atomFloat(atomArray, pt, vArray[PyMOL.OCCUPANCY]); radius= atomFloat(atomArray, pt, vArray[PyMOL.VDW]); @@ -1187,8 +1192,9 @@ if (uniqueID == 0) uniqueID = -1; anisou = new float[8]; - for (int i = 0; i < 6; i++) - anisou[i] = BC.bytesToShort(atomArray, pt + vArray[PyMOL.ANISOU] + (i << 1), false); + if ((vpt = vArray[PyMOL.ANISOU]) > 0) + for (int i = 0; i < 6; i++) + anisou[i] = BC.bytesToShort(atomArray, pt + vpt + (i << 1), false); bonded = atomBool(atomArray, pt, vArray[PyMOL.BONDED], vArray[PyMOL.BONMASK]); isHetero = atomBool(atomArray, pt, vArray[PyMOL.HETATM], vArray[PyMOL.HETMASK]); } else { @@ -1219,9 +1225,12 @@ if (a.size() > 46) anisou = floatsAt(a, 41, new float[8], 6); } + if (insCode == null) { + int len = resi.length(); + char ch = (len > 0 ? resi.charAt(len - 1) : ' '); + insCode = (PT.isDigit(ch) ? " " : "" + ch); + } - String insCode = (resi.length() > 3 ? resi.substring(3) : " "); - if (group3.length() > 3) group3 = group3.substring(0, 3); if (group3.equals(" ")) Modified: branches/v14_6/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLScene.java =================================================================== --- branches/v14_6/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLScene.java 2016-08-12 03:46:23 UTC (rev 21210) +++ branches/v14_6/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLScene.java 2016-08-12 12:21:41 UTC (rev 21211) @@ -1078,7 +1078,7 @@ s = "[x" + s.substring(s.length() - 6) + "]"; sb.append(";background " + s); sb.append(";moveto 0 PyMOL " + Escape.eAF(pymolView)); - sb.append(";save orientation 'default';"); + sb.append(";save orientation 'default';"); // DO NOT set antialiasDisplay here! It can cause immediate rendering problem in Java return sb; } @@ -1103,7 +1103,6 @@ if (frameObj == null) return; frameObj.finalizeObject(this, vwr.ms, null, false); - vwr.setBooleanProperty("antialiasDisplay", true); frameObj = null; } Modified: branches/v14_6/Jmol/src/org/jmol/script/ScriptEval.java =================================================================== --- branches/v14_6/Jmol/src/org/jmol/script/ScriptEval.java 2016-08-12 03:46:23 UTC (rev 21210) +++ branches/v14_6/Jmol/src/org/jmol/script/ScriptEval.java 2016-08-12 12:21:41 UTC (rev 21211) @@ -2368,7 +2368,7 @@ break; case T.initialize: if (!chk) - vwr.initialize(!isStateScript); + vwr.initialize(!isStateScript, false); break; case T.invertSelected: cmdInvertSelected(); Modified: branches/v14_6/Jmol/src/org/jmol/shape/AtomShape.java =================================================================== --- branches/v14_6/Jmol/src/org/jmol/shape/AtomShape.java 2016-08-12 03:46:23 UTC (rev 21210) +++ branches/v14_6/Jmol/src/org/jmol/shape/AtomShape.java 2016-08-12 12:21:41 UTC (rev 21211) @@ -206,6 +206,8 @@ } protected void setColixAndPalette(short colix, byte paletteID, int atomIndex) { + if (colixes == null) + System.out.println("ATOMSHAPE ERROR"); colixes[atomIndex] = colix = getColixI(colix, paletteID, atomIndex); bsColixSet.setBitTo(atomIndex, colix != C.INHERIT_ALL || shapeID == JC.SHAPE_BALLS); paletteIDs[atomIndex] = paletteID; Modified: branches/v14_6/Jmol/src/org/jmol/shape/Labels.java =================================================================== --- branches/v14_6/Jmol/src/org/jmol/shape/Labels.java 2016-08-12 03:46:23 UTC (rev 21210) +++ branches/v14_6/Jmol/src/org/jmol/shape/Labels.java 2016-08-12 12:21:41 UTC (rev 21211) @@ -408,6 +408,7 @@ // from PyMOL reader setScaling(); int n = checkStringLength(ac); + checkColixLength((short)-1, n); for (int i = bsSelected.nextSetBit(0); i >= 0 && i < n; i = bsSelected .nextSetBit(i + 1)) setPymolLabel(i, labels.get(Integer.valueOf(i)), null); Modified: branches/v14_6/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- branches/v14_6/Jmol/src/org/jmol/viewer/Viewer.java 2016-08-12 03:46:23 UTC (rev 21210) +++ branches/v14_6/Jmol/src/org/jmol/viewer/Viewer.java 2016-08-12 12:21:41 UTC (rev 21211) @@ -1,6 +1,6 @@ /* $RCSfile$ * $Author: hansonr $ - * $Date: 2014-02-02 22:24:37 -0600 (Sun, 02 Feb 2014) $ + * $Date: 2016-07-13 14:51:46 -0500 (Wed, 13 Jul 2016) $ * $Revision: 19253 $ * * Copyright (C) 2002-2006 Miguel, Jmol Development, www.jmol.org @@ -528,7 +528,7 @@ (rm = (JmolRepaintManager) o).set(this, shm); // again we through a JS error if in async mode ms = new ModelSet(this, null); - initialize(true); + initialize(true, false); fm = new FileManager(this); definedAtomSets = new Hashtable<String, Object>(); setJmolStatusListener(statusListener); @@ -767,7 +767,7 @@ // delegated to StateManager // /////////////////////////////////////////////////////////////// - public void initialize(boolean clearUserVariables) { + public void initialize(boolean clearUserVariables, boolean isPyMOL) { g = new GlobalSettings(this, g, clearUserVariables); setStartupBooleans(); setWidthHeightVar(); @@ -787,7 +787,7 @@ am.setAnimationOn(false); am.setAnimationFps(g.animationFps); sm.allowStatusReporting = g.statusReporting; - setBooleanProperty("antialiasDisplay", g.antialiasDisplay); + setBooleanProperty("antialiasDisplay", (isPyMOL ? true : g.antialiasDisplay)); stm.resetLighting(); tm.setDefaultPerspective(); } @@ -6984,19 +6984,23 @@ } private void setAntialias(int tok, boolean TF) { - + boolean isChanged = false; switch (tok) { case T.antialiasdisplay: + isChanged = (g.antialiasDisplay != TF); g.antialiasDisplay = TF; break; case T.antialiastranslucent: + isChanged = (g.antialiasTranslucent != TF); g.antialiasTranslucent = TF; break; case T.antialiasimages: g.antialiasImages = TF; return; } - resizeImage(0, 0, false, false, true); + if (isChanged) + refresh(3, "Viewer:setAntialias()"); +// resizeImage(0, 0, false, false, true); } // ////////////////////////////////////////////////////////////// Modified: trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOL.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOL.java 2016-08-12 03:46:23 UTC (rev 21210) +++ trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOL.java 2016-08-12 12:21:41 UTC (rev 21211) @@ -6431,14 +6431,14 @@ final static int SEGI = 35; final static int NAME = 36; final static int ELEM = 37; - final static int RESI = 38; + final static int RESI = 38; // not 181 final static int SSTYPE = 39; final static int ALTLOC = 40; final static int RESN = 41; - final static int INSCODE = 42; + final static int INSCODE = 42; // 181 only final static int CHEMFLAG = 43; final static int PROTEKTED = 44; - final static int ANISOU = 45; + final static int ANISOU = 45; // not 177 final static int HETMASK = 46; final static int BONMASK = 47; @@ -6448,7 +6448,7 @@ final static int SETMASK = 51; //1.7.6 type - final static int[] v176 = { LEN, 154, + final static int[] v176 = { LEN, 164, RESV, 0, CUSTOMTYPE, 4, PRIORITY, 8, @@ -6500,14 +6500,15 @@ NAME, 105, // 5 ELEM, 110, // 5 RESI, 115, // 6 - //HASPROP, 111, - SSTYPE, 112, - ALTLOC, 114, - RESN, 116, - ANISOU, 122, - //OLDID, 146 - //PROPID, 150, - + //HASPROP, 121, + SSTYPE, 122, + ALTLOC, 124, + + + RESN, 126, + ANISOU, 132, + //OLDID, 156 + //PROPID, 160, // 4 }; // typedef struct AtomInfoType_1_7_6 { Modified: trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java 2016-08-12 03:46:23 UTC (rev 21210) +++ trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java 2016-08-12 12:21:41 UTC (rev 21211) @@ -433,7 +433,7 @@ pymolScene.finalizeVisibility(); if (!isStateScript) { // same idea as for a Jmol state -- session reinitializes - vwr.initialize(false); + vwr.initialize(false, true); addJmolScript(pymolScene.getViewScript(getMapList(map, "view")) .toString()); } @@ -1149,13 +1149,14 @@ Lst<Object> labelPositions, float[] labelArray, BS bsState, int iState) { atomMap[apt] = -1; - String chainID, altLoc, group3, name, sym, label, ssType, resi; + String chainID, altLoc, group3, name, sym, label, ssType, resi, insCode = null; float bfactor, occupancy, radius, partialCharge; int seqNo, intReps, formalCharge, atomColor, serNo, cartoonType, flags, uniqueID = -1; boolean isHetero, bonded; float[] anisou = null; BS bsReps = null; if (haveBinaryArrays) { + int vpt; int pt = apt * vArray[PyMOL.LEN]; seqNo = atomInt(atomArray, pt, vArray[PyMOL.RESV]); chainID = atomStr(atomArray, pt, vArray[PyMOL.CHAIN], lexStr); @@ -1168,8 +1169,12 @@ label = atomStr(atomArray, pt, vArray[PyMOL.LABEL], lexStr); ssType = atomStr(atomArray, pt, vArray[PyMOL.SSTYPE], null); altLoc = atomStr(atomArray, pt, vArray[PyMOL.ALTLOC], null); - byte b = atomArray[pt + vArray[PyMOL.INSCODE]]; - resi = (b == 0 ? "" : "xxx" + (char) b); + if ((vpt = vArray[PyMOL.INSCODE]) == 0) { + resi = atomStr(atomArray, pt, vArray[PyMOL.RESI], null); + } else { + byte b = atomArray[pt + vpt]; + insCode = (b == 0 ? " " :"" + (char) b); + } bfactor = atomFloat(atomArray, pt, vArray[PyMOL.BFACTOR]); occupancy = atomFloat(atomArray, pt, vArray[PyMOL.OCCUPANCY]); radius= atomFloat(atomArray, pt, vArray[PyMOL.VDW]); @@ -1187,8 +1192,9 @@ if (uniqueID == 0) uniqueID = -1; anisou = new float[8]; - for (int i = 0; i < 6; i++) - anisou[i] = BC.bytesToShort(atomArray, pt + vArray[PyMOL.ANISOU] + (i << 1), false); + if ((vpt = vArray[PyMOL.ANISOU]) > 0) + for (int i = 0; i < 6; i++) + anisou[i] = BC.bytesToShort(atomArray, pt + vpt + (i << 1), false); bonded = atomBool(atomArray, pt, vArray[PyMOL.BONDED], vArray[PyMOL.BONMASK]); isHetero = atomBool(atomArray, pt, vArray[PyMOL.HETATM], vArray[PyMOL.HETMASK]); } else { @@ -1219,9 +1225,12 @@ if (a.size() > 46) anisou = floatsAt(a, 41, new float[8], 6); } + if (insCode == null) { + int len = resi.length(); + char ch = (len > 0 ? resi.charAt(len - 1) : ' '); + insCode = (PT.isDigit(ch) ? " " : "" + ch); + } - String insCode = (resi.length() > 3 ? resi.substring(3) : " "); - if (group3.length() > 3) group3 = group3.substring(0, 3); if (group3.equals(" ")) Modified: trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLScene.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLScene.java 2016-08-12 03:46:23 UTC (rev 21210) +++ trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLScene.java 2016-08-12 12:21:41 UTC (rev 21211) @@ -1078,7 +1078,7 @@ s = "[x" + s.substring(s.length() - 6) + "]"; sb.append(";background " + s); sb.append(";moveto 0 PyMOL " + Escape.eAF(pymolView)); - sb.append(";save orientation 'default';"); + sb.append(";save orientation 'default';"); // DO NOT set antialiasDisplay here! It can cause immediate rendering problem in Java return sb; } @@ -1103,7 +1103,6 @@ if (frameObj == null) return; frameObj.finalizeObject(this, vwr.ms, null, false); - vwr.setBooleanProperty("antialiasDisplay", true); frameObj = null; } Modified: trunk/Jmol/src/org/jmol/script/ScriptEval.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEval.java 2016-08-12 03:46:23 UTC (rev 21210) +++ trunk/Jmol/src/org/jmol/script/ScriptEval.java 2016-08-12 12:21:41 UTC (rev 21211) @@ -2368,7 +2368,7 @@ break; case T.initialize: if (!chk) - vwr.initialize(!isStateScript); + vwr.initialize(!isStateScript, false); break; case T.invertSelected: cmdInvertSelected(); Modified: trunk/Jmol/src/org/jmol/shape/AtomShape.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/AtomShape.java 2016-08-12 03:46:23 UTC (rev 21210) +++ trunk/Jmol/src/org/jmol/shape/AtomShape.java 2016-08-12 12:21:41 UTC (rev 21211) @@ -206,6 +206,8 @@ } protected void setColixAndPalette(short colix, byte paletteID, int atomIndex) { + if (colixes == null) + System.out.println("ATOMSHAPE ERROR"); colixes[atomIndex] = colix = getColixI(colix, paletteID, atomIndex); bsColixSet.setBitTo(atomIndex, colix != C.INHERIT_ALL || shapeID == JC.SHAPE_BALLS); paletteIDs[atomIndex] = paletteID; Modified: trunk/Jmol/src/org/jmol/shape/Labels.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Labels.java 2016-08-12 03:46:23 UTC (rev 21210) +++ trunk/Jmol/src/org/jmol/shape/Labels.java 2016-08-12 12:21:41 UTC (rev 21211) @@ -408,6 +408,7 @@ // from PyMOL reader setScaling(); int n = checkStringLength(ac); + checkColixLength((short)-1, n); for (int i = bsSelected.nextSetBit(0); i >= 0 && i < n; i = bsSelected .nextSetBit(i + 1)) setPymolLabel(i, labels.get(Integer.valueOf(i)), null); Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2016-08-12 03:46:23 UTC (rev 21210) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2016-08-12 12:21:41 UTC (rev 21211) @@ -528,7 +528,7 @@ (rm = (JmolRepaintManager) o).set(this, shm); // again we through a JS error if in async mode ms = new ModelSet(this, null); - initialize(true); + initialize(true, false); fm = new FileManager(this); definedAtomSets = new Hashtable<String, Object>(); setJmolStatusListener(statusListener); @@ -767,7 +767,7 @@ // delegated to StateManager // /////////////////////////////////////////////////////////////// - public void initialize(boolean clearUserVariables) { + public void initialize(boolean clearUserVariables, boolean isPyMOL) { g = new GlobalSettings(this, g, clearUserVariables); setStartupBooleans(); setWidthHeightVar(); @@ -787,7 +787,7 @@ am.setAnimationOn(false); am.setAnimationFps(g.animationFps); sm.allowStatusReporting = g.statusReporting; - setBooleanProperty("antialiasDisplay", g.antialiasDisplay); + setBooleanProperty("antialiasDisplay", (isPyMOL ? true : g.antialiasDisplay)); stm.resetLighting(); tm.setDefaultPerspective(); } @@ -6984,19 +6984,23 @@ } private void setAntialias(int tok, boolean TF) { - + boolean isChanged = false; switch (tok) { case T.antialiasdisplay: + isChanged = (g.antialiasDisplay != TF); g.antialiasDisplay = TF; break; case T.antialiastranslucent: + isChanged = (g.antialiasTranslucent != TF); g.antialiasTranslucent = TF; break; case T.antialiasimages: g.antialiasImages = TF; return; } - resizeImage(0, 0, false, false, true); + if (isChanged) + refresh(3, "Viewer:setAntialias()"); +// resizeImage(0, 0, false, false, true); } // ////////////////////////////////////////////////////////////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. http://sdm.link/zohodev2dev _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits