Revision: 18301 http://sourceforge.net/p/jmol/code/18301 Author: hansonr Date: 2013-06-06 20:59:04 +0000 (Thu, 06 Jun 2013) Log Message: ----------- ___JmolVersion="13.1.16_a"
new feature: set defaults PyMOL -- zoomHeight TRUE -- measurementUnits ANGSTROMS TODO: PyMOL uniqueAtomSettings should override scene color settings TODO: PyMOL uniqueAtomSettings for all atom settings new feature: color BALLS -- distinct from color ATOMS because it doesn't get inherited -- for PyMOL compatability with sphere_color new feature: restore SCENE "xxxx" nSec new feature: Scene menu -- PyMOL scene names, in order new feature: added parameters to moveTo allows setting cameraDepth, cameraX, and cameraY new feature: moveTo <nseconds> PYMOL [18-element standard PyMOL view matrix] -- used for PSE file loading -- to be used also for scenes [0-8] are 3x3 rotation matrix (row/column inverted) [9,10] are x,y translations (y negative) [11] is distance from camera to center (negative) [12-14] are rotation center coords [15-16] are slab and depth distance from camera (0 to ignore) [17] is field of view; positive for orthographic projection new feature: cache CLEAR -- same as cache REMOVE ALL new feature: load xxx.pse FILTER "DOCACHE" -- specifically for editing large PSE files when included in a state -- caches streamlined file that is still readable by PyMOL (needs testing!) (no electron density map data, for instance -- see HupA_2.pse) -- caches all isosurfaces, creating JVXL equivalents -- should be followed with WRITE xxx.pngj or WRITE xxx.jmol or WRITE xxx.zip -- for example: before: 04/07/2013 07:46 AM 11,929,507 HupA_2.pse $ zap;load SYNC "file:///C:/temp/downloads/HupA_2.pse" filter 'DOcache' $ write t.zip after: Listing archive: t.zip Physical Size = 395174 Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2013-05-17 06:46:36 ..... 1092432 219718 HupA_2.pse 2013-05-17 06:46:36 ..... 1473760 6589 isosurface_level2 2013-05-17 06:46:36 ..... 25495 11624 state.spt 2013-05-17 06:46:36 ..... 134 119 JmolManifest.txt 2013-05-17 06:46:36 ..... 0 2 Jmol_version_13.1.16_dev_2013.05.17__2013-05-15_07.09 2013-05-17 06:46:36 ..... 158082 156316 preview.png ------------------- ----- ------------ ------------ ------------------------ 2749903 394368 6 files, 0 folders new feature: anim FRAMES [1, 3, 9, 9, 9, 3, 1] -- arbitrary PyMOL-like model list new feature: FRAME n -- same as MODEL n, unless we have PyMOL-like frames -- if have frames, then FRAME 2 goes to the second frame (model 3 in this case) -- MODEL n still always goes to a specific model. -- all relative options -- FIRST LAST PREV NEXT -- refer to frames if there are frames even if the MODEL command is given. new feature: pyMOL PSE state options: LOAD "FOO.PSE" state FILTER "xxxx" -- [state not present; default] load all PyMOL states (one PyMOL state == one Jmol model) -- state = 0 (load only the current PyMOL state) -- state > 0 (load just a specific PyMOL state) -- FILTER "nosurface" -- load PyMOL file without surfaces -- FILTER " new feature: getProperty BONDINFO {atomset1} {atomset2} new feature: measurements with IDs and radius/diameter: -- measure ID "xxx" ... -- measure ID "xxx" RADIUS x.y (or DIAMETER x.y) -- renders as dots new feature: set zoomHeight -- FALSE by default -- set TRUE for PyMOL-like resizing (scale only set by height adjustment) new feature: isosurface color density (decimal) - variable decimal point size new feature: PyMOL CGOs as CGO command - needs testing - CGO ID "xxx" [ cgo data (float array) ] - includes basic CGO methods BEGIN GL_POINTS GL_LINES GL_LINESTRIP GL_TRIANGLE GL_TRIANGLE_STRIP GL_TRIANGLE_FAN VERTEX END COLOR NORMAL SIMPLE_LINE SAUSAGE TRICOLOR_TRIANGLE popup: added menu for MEP range -0.1 0.1 PyMOL: uniqueBondSettings working PyMOL: better scene restore; PyMOL: adds SASURFACE option (surface_solvent ON), with "carving" (ProFusion_ABL.pse, scene F6) PyMOL: abstraction of scene setting from reader PyMOL: first phase of reader development complete (working with Jaime Prilusky) -- 104 test models http://ispcsrv3.weizmann.ac.il/a2jmolb/browse -- implementation of standard objects, including: -- atoms with labels -- bonds -- standard PyMOL rendering, including: -- lines -- sticks -- nonbonded (stars) -- nb_spheres -- cartoons of various types (not plank) -- rockets -- ribbon (backbone/trace) -- putty (trace) -- dots -- measures -- simple CGO objects -- molecular surfaces -- electron density as points and meshes -- custom colors -- fog and slab -- morphing movies -- JVXL caching of isosurfaces PyMOL: measurement font/offsets enabled -- adds measure ID "xxx" FONT scale face style -- adds measure ID "xxx" OFFSET [mode, sx, sy, sz, ax, ay, az] -- adds measure ID "xxx" OFFSET {sx, sy, sz} PyMOL: perspective fix for translated center -- H115W.PinM.PSE PyMOL: preliminary scene implementation -- view only -- use RESTORE ORIENTATION xxxxx code: Text.java, Object2d.java moved from shapes to modelset bug fix: COMPARE move of group saved in state may not be correct when restored bug fix: write command doesn't accept parameter sequence IMAGE PNGJ ... (broken in 13.1.14) bug fix: load APPEND with PDB file loses structure (broken in 13.1.15) bug fix: restore command broken bug fix: JavaScript: adding SYNC bug fix: antialiasing or resizing stray lines problem solved (introduced in 11.0, 08/2006!) bug fix: "display add" by itself should not do anything bug fix: Hall translation initialization problem bug fix: JavaScript reading of old-style JVXL files bug fix: Gaussian reader not splitting MO set by model bug fix: polyhedron reading from state bug fix: connect delete not saved in state bug fix: rockets not working for alpha polymer (also in 13.0.16) bug fix: GXL added to carbohydrates bug fix: show state/anim turns "anim" into "animation" bug fix: MoldenReader orbitals are not in energy order; use FILTER "NOSORT" to prevent sorting by energy bug fix: simultaneous spin/animation broken in 13.1.13 bug fix: MoldenReader fix for file blank lines and g,h,i orbitals - also for 13.0.16 bug fix: COMPARE does not allow nSeconds at beginning, as described in documentation bug fix: isosurface VOLUME/AREA SET n cannot return to full array reporting; SET -1 added. bug fix: isosurface VOLUME/AREA always returns an array, possibly of length 0 bug fix: isosurface molecular/solvent can give inappropriate inner surfaces bug fix: show selected includes deleted atoms Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/pymol/JmolObject.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/adapter/smarter/AtomSetCollectionReader.java trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java trunk/Jmol/src/org/jmol/render/RepaintManager.java trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java trunk/Jmol/src/org/jmol/script/T.java trunk/Jmol/src/org/jmol/smiles/InvalidSmilesException.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/StateManager.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/pymol/JmolObject.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/pymol/JmolObject.java 2013-06-06 20:56:00 UTC (rev 18300) +++ trunk/Jmol/src/org/jmol/adapter/readers/pymol/JmolObject.java 2013-06-06 20:59:04 UTC (rev 18301) @@ -60,7 +60,7 @@ private short[] colixes; private Object[] colors; - String objectNameID; + String jmolName; int argb; float translucency = 0; boolean visible = true; @@ -77,7 +77,7 @@ this.id = id; this.bsAtoms = bsAtoms; this.info = info; - this.objectNameID = branchNameID; + this.jmolName = branchNameID; } /** @@ -173,12 +173,9 @@ sm.viewer.setCurrentModelIndex(-1); } return; - case T.group: - // if we implement GROUP in Jmol, we need to do something here. - return; case T.scene: - sm.viewer.saveScene(objectNameID, (Map<String, Object>) info); - sm.viewer.saveOrientation(objectNameID, + sm.viewer.saveScene(jmolName, (Map<String, Object>) info); + sm.viewer.saveOrientation(jmolName, (float[]) ((Map<String, Object>) info).get("pymolView")); return; case JC.SHAPE_LABELS: @@ -234,7 +231,7 @@ sm.setShapePropertyBs(id, "measure", md, bsAtoms); return; case T.isosurface: - sID = (bsAtoms == null ? (String) info : objectNameID); + sID = (bsAtoms == null ? (String) info : jmolName); // when getting a scene, ignore creation of this surface if (sm.getShapeIdFromObjectName(sID) >= 0) { sm.viewer.setObjectProp(sID, T.display); Modified: trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java 2013-06-06 20:56:00 UTC (rev 18300) +++ trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java 2013-06-06 20:59:04 UTC (rev 18301) @@ -179,7 +179,7 @@ @Override public void finalizeModelSet(int baseModelIndex, int baseAtomIndex) { - pymolScene.setObjects(mepList, doCache, baseModelIndex, baseAtomIndex); + pymolScene.setReaderObjects(mepList, doCache, baseModelIndex, baseAtomIndex); if (haveMeasurements) { appendLoadNote(viewer.getMeasurementInfoAsString()); @@ -271,7 +271,7 @@ try { viewer.log(TextFormat.simpleReplace(list.toString(), "[", "\n[")); } catch (Throwable e) { - e.printStackTrace(); + // } } } @@ -364,7 +364,7 @@ } for (int i = 1; i < n; i++) processObject(listAt(names, i), false, 0); - pymolScene.setObjectInfo(null, 0, null, false, null, null, null); + pymolScene.setReaderObjectInfo(null, 0, null, false, null, null, null); // not currently generating selections //processSelections(); @@ -380,9 +380,9 @@ } processDefinitions(); - processSelections(map); + processSelectionsAndScenes(map); // no need to render if this is a state script - pymolScene.finalizeEverything(); + pymolScene.finalizeVisibility(); if (!isStateScript) { // same idea as for a Jmol state -- session reinitializes viewer.initialize(true); @@ -554,7 +554,7 @@ if (haveFrames && !haveCommands && !haveViews) { // simple animation isMovie = true; - pymolScene.setObjectInfo(null, 0, null, false, null, null, null); + pymolScene.setReaderObjectInfo(null, 0, null, false, null, null, null); pymolScene.setFrameObject(T.movie, movie); } else { //isMovie = true; for now, no scripted movies @@ -622,7 +622,7 @@ execObject, 6)); if (" ".equals(parentGroupName)) parentGroupName = null; - pymolScene.setObjectInfo(objectName, type, parentGroupName, isHidden, listAt(objectHeader, 8), stateSettings, (moleculeOnly ? "_" + (iState + 1) : "")); + pymolScene.setReaderObjectInfo(objectName, type, parentGroupName, isHidden, listAt(objectHeader, 8), stateSettings, (moleculeOnly ? "_" + (iState + 1) : "")); BS bsAtoms = null; boolean doExclude = (bsBytesExcluded != null); String msg = null; @@ -886,12 +886,12 @@ int n = bonds.size(); for (int i = 0; i < n; i++) { JmolList<Object> b = listAt(bonds, i); - int order = intAt(b, 2) | asSingle; + int order = intAt(b, 2); if (order < 1 || order > 3) order = 1; int ia = intAt(b, 0); int ib = intAt(b, 1); - Bond bond = new Bond(ia, ib, order); + Bond bond = new Bond(ia, ib, order | asSingle); bond.uniqueID = (b.size() > 6 && intAt(b, 6) != 0 ? intAt(b, 5) : -1); bondList.addLast(bond); } @@ -1220,7 +1220,7 @@ * @param map */ @SuppressWarnings("unchecked") - private void processSelections(Map<String, Object> map) { + private void processSelectionsAndScenes(Map<String, Object> map) { if (!pymolScene.needSelections()) return; Map<String, JmolList<Object>> htObjNames = PyMOLScene.listToMap(getMapList( Modified: trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLScene.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLScene.java 2013-06-06 20:56:00 UTC (rev 18300) +++ trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLScene.java 2013-06-06 20:59:04 UTC (rev 18301) @@ -30,7 +30,7 @@ /** * A class to allow manipulation of scenes dissociated from file loading. A * "scene" in this context is a distillation of PyMOL information into a - * Hashtable for easier retrieval. This organization is: + * Hashtable for easier retrieval using RESTORE SCENE name. * */ class PyMOLScene implements JmolSceneGenerator { @@ -116,14 +116,17 @@ private int bgRgb; private int surfaceMode; private int surfaceColor; + private int sphereColor; private int labelFontId; private int labelColor; + private float cartoonTranslucency; private float labelSize; + private float meshWidth; + private float nonbondedSize; + private float sphereScale; private float sphereTranslucency; - private float cartoonTranslucency; private float stickTranslucency; - private float nonBondedSize; - private float sphereScale; + private float transparency; private boolean cartoonLadderMode; private boolean cartoonRockets; private boolean haveNucleicLadder; @@ -132,7 +135,7 @@ private String objectName; private String objectNameID; - private String objectSelectionName; + private String objectJmolName; private int objectType; private BS objectAtoms; private boolean objectHidden; @@ -180,7 +183,7 @@ 0, labelPosition0); } - void setObjectInfo(String name, int type, String groupName, boolean isHidden, + void setReaderObjectInfo(String name, int type, String groupName, boolean isHidden, JmolList<Object> listObjSettings, JmolList<Object> listStateSettings, String ext) { objectName = name; @@ -190,7 +193,7 @@ objectSettings = new Hashtable<Integer, JmolList<Object>>(); stateSettings = new Hashtable<Integer, JmolList<Object>>(); if (objectName != null) { - objectSelectionName = getSelectionName(name); + objectJmolName = getJmolName(name); if (groupName != null) { htObjectGroups.put(objectName, groupName); htObjectGroups.put(objectNameID, groupName); @@ -223,8 +226,10 @@ } private void getObjectSettings() { - nonBondedSize = floatSetting(PyMOL.nonbonded_size); + transparency = floatSetting(PyMOL.transparency); + nonbondedSize = floatSetting(PyMOL.nonbonded_size); sphereScale = floatSetting(PyMOL.sphere_scale); + sphereColor = (int) floatSetting(PyMOL.sphere_color); cartoonTranslucency = floatSetting(PyMOL.cartoon_transparency); stickTranslucency = floatSetting(PyMOL.stick_transparency); sphereTranslucency = floatSetting(PyMOL.sphere_transparency); @@ -233,6 +238,7 @@ surfaceMode = (int) floatSetting(PyMOL.surface_mode); surfaceColor = (int) floatSetting(PyMOL.surface_color); solventAccessible = booleanSetting(PyMOL.surface_solvent); + meshWidth = floatSetting(PyMOL.mesh_width); String carveSet = stringSetting(PyMOL.surface_carve_selection).trim(); if (carveSet.length() == 0) { bsCarve = null; @@ -264,11 +270,49 @@ this.newChain = newChain; this.radii = radii; } + + ////////////// scene-related methods ////////// + +// From module/pymol/Viewing.py: +// +// DESCRIPTION +// +// "scene" makes it possible to save and restore multiple scenes +// within a single session. A scene consists of the view, all object +// activity information, all atom-wise visibility, color, +// representations, and the global frame index. + /** + * Set scene object/state-specific global fields and + * settings based on the name and state or stored values + * from when the file was loaded. + * + * @param name + * @param istate + * + */ + private void setSceneObject(String name, int istate) { + objectName = name; + objectType = getObjectType(name); + objectJmolName = getJmolName(name); + objectNameID = (istate == 0 && objectType != 0 ? getObjectID(name) : objectJmolName + "_" + + istate); + objectAtoms = htObjectAtoms.get(name); + objectSettings = htObjectSettings.get(name); + stateSettings = htStateSettings.get(name+"_" + istate); + String groupName = htObjectGroups.get(name); + objectHidden = (htHiddenObjects.containsKey(name) || groupName != null + && !groups.get(groupName).visible); + getObjectSettings(); + } + + /** + * Build a scene at file reading time. We only implement frame-specific + * scenes. Creates a map of information that can be used later and + * will also be a reference to this instance of PyMOLScene, which is an + * implementation of JmolSceneGenerator. * - * frame scenes only here - * * @param name * @param thisScene * @param htObjNames @@ -279,14 +323,6 @@ Map<String, JmolList<Object>> htObjNames, Map<String, JmolList<Object>> htSecrets) { Object frame = thisScene.get(2); - // generator : this - // name : scene name - // pymolFrame : specified frame - // pymolView : specified view [ 18-member array ] - // visibilities: { name1: [visFlag, repOn, repVis, colorIndex],...} - // moleculeReps: [ representation-based list of object lists] - // colors: [colorIndex, object list] - // Map<String, Object> smap = new Hashtable<String, Object>(); smap.put("pymolFrame", frame); smap.put("generator", this); @@ -319,8 +355,9 @@ sname = "_!c_" + name + "_"; JmolList<Object> colorection = listAt(thisScene, 3); int n = colorection.size(); - // I don't know what the idea of the pyList is that it is bivalued: - // [3, 262, 0, 263, 4, 264, 26, 265, 27, 266, 28, 267] + // [color/selEntry,color/selEntry,color/selEntry.....] + // [3, 262, 0, 263, 4, 264, .....] + // see layer3/Selector.c SelectorColorectionApply Object[] colors = new Object[n / 2]; for (int j = 0, i = 0; j < n; j += 2) { int color = intAt(colorection, j); @@ -329,11 +366,13 @@ colors[i++] = new Object[] { Integer.valueOf(color), c.get(1) }; } smap.put("colors", colors); - addJmolObject(T.scene, null, smap).objectNameID = name; + addJmolObject(T.scene, null, smap).jmolName = name; } /** - * Generate the saved scene. + * Generate the saved scene using file settings preserved here and + * scene-specific information including frame, view, colors, visibilities, + * . Called by StateManager via implemented JmolSceneGenerator. * * @param scene * @@ -353,14 +392,23 @@ generateVisibilities((Map<String, Object>) scene.get("visibilities")); generateColors((Object[]) scene.get("colors")); generateShapes((Object[]) scene.get("moleculeReps")); - finalizeEverything(); + finalizeVisibility(); finalizeObjects(); } catch (Exception e) { System.out.println("PyMOLScene exception " + e); - e.printStackTrace(); + if (!viewer.isApplet()) + e.printStackTrace(); } } + /** + * Set PyMOL "atom-wise" colors -- the colors that are defined + * initially as element colors but possibly set with the PyMOL 'color' + * command and are used when representation colors (cartoon, dots, etc.) + * are not defined (-1). This is the same as Jmol's inherited atom color. + * + * @param colors + */ @SuppressWarnings("unchecked") private void generateColors(Object[] colors) { if (colors == null) @@ -376,6 +424,14 @@ } } + /** + * Add selected atoms to a growing bit set. + * + * @param molecules + * @param istate + * @param bs + * @return bs for convenience + */ private BS getSelectionAtoms(JmolList<Object> molecules, int istate, BS bs) { if (molecules != null) for (int j = molecules.size(); --j >= 0;) @@ -383,9 +439,16 @@ return bs; } + /** + * Collect all the atoms specified by an object state into a bit set. + * + * @param obj + * @param istate 0 for "all states" + * @param bs + */ private void selectAllAtoms(JmolList<Object> obj, int istate, BS bs) { String name = (String) obj.get(0); - setObject(name, istate); + setSceneObject(name, istate); JmolList<Object> atomList = listAt(obj, 1); int k0 = (istate == 0 ? 1 : istate); int k1 = (istate == 0 ? stateCount : istate); @@ -397,6 +460,12 @@ } } + /** + * Hide everything, then just make visible the sets of + * atoms specified in the visibility (i.e. "activity") list within scene_dict. + * + * @param vis + */ @SuppressWarnings("unchecked") private void generateVisibilities(Map<String, Object> vis) { if (vis == null) @@ -426,13 +495,13 @@ String name = e.getKey(); if (name.equals("all")) continue; - setObject(name, thisState); + setSceneObject(name, thisState); if (objectHidden) continue; JmolList<Object> list = (JmolList<Object>) e.getValue(); int tok = (objectHidden ? T.hide : T.display); bs = null; - String info = objectSelectionName; + String info = objectJmolName; switch (objectType) { case 0: // doesn't have selected state case PyMOL.OBJECT_GROUP: @@ -457,26 +526,15 @@ // might need to set color here for these? break; } - //addJmolObject(tok, null, objectNameID); addJmolObject(tok, bs, info); } } - private void setObject(String name, int istate) { - objectName = name; - objectType = getObjectType(name); - objectSelectionName = getSelectionName(name); - objectNameID = (istate == 0 && objectType != 0 ? getObjectID(name) : objectSelectionName + "_" - + istate); - objectAtoms = htObjectAtoms.get(name); - objectSettings = htObjectSettings.get(name); - String groupName = htObjectGroups.get(objectName); - objectHidden = (htHiddenObjects.containsKey(name) || groupName != null - && !groups.get(groupName).visible); - stateSettings = htStateSettings.get(objectName+"_" + istate); - getObjectSettings(); - } - + /** + * Create all Jmol shape objects. + * + * @param reps + */ @SuppressWarnings("unchecked") private void generateShapes(Object[] reps) { if (reps == null) @@ -485,8 +543,7 @@ // through all molecules... // for (int m = moleculeNames.size(); --m >= 0;) { for (int m = 0; m < moleculeNames.size(); m++) { - setObject(moleculeNames.get(m), thisState); - getObjectSettings(); + setSceneObject(moleculeNames.get(m), thisState); if (objectHidden) continue; BS[] molReps = new BS[PyMOL.REP_JMOL_MAX]; @@ -531,7 +588,7 @@ return getColorPt(c.get(2)); } - void setObjects(String mepList, boolean doCache, int baseModelIndex, + void setReaderObjects(String mepList, boolean doCache, int baseModelIndex, int baseAtomIndex) { this.baseModelIndex = baseModelIndex; this.baseAtomIndex = baseAtomIndex; @@ -545,7 +602,11 @@ } } + /** + * Finally, we turn each JmolObject into its Jmol equivalent. + */ private void finalizeObjects() { + viewer.setStringProperty("defaults", "PyMOL"); for (int i = 0; i < jmolObjects.size(); i++) { try { JmolObject obj = jmolObjects.get(i); @@ -553,18 +614,19 @@ obj.finalizeObject(this, viewer.modelSet, mepList, doCache); } catch (Exception e) { System.out.println(e); - e.printStackTrace(); + if (!viewer.isApplet()) + e.printStackTrace(); } } finalizeUniqueBonds(); jmolObjects.clear(); } - JmolObject getJmolObject(int id, BS bsAtoms, Object info) { + private JmolObject getJmolObject(int id, BS bsAtoms, Object info) { return new JmolObject(id, objectNameID, bsAtoms, info); } - JmolObject addJmolObject(int id, BS bsAtoms, Object info) { + private JmolObject addJmolObject(int id, BS bsAtoms, Object info) { return addObject(getJmolObject(id, bsAtoms, info)); } @@ -575,7 +637,7 @@ * @param isViewObj * @return 22-element array */ - float[] getPymolView(JmolList<Object> view, boolean isViewObj) { + private float[] getPymolView(JmolList<Object> view, boolean isViewObj) { float[] pymolView = new float[21]; boolean depthCue = booleanSetting(PyMOL.depth_cue); // 84 boolean fog = booleanSetting(PyMOL.fog); // 88 @@ -623,7 +685,7 @@ } /** - * Create a heirarchical list of named groups as generally seen on the PyMOL + * Create a hierarchical list of named groups as generally seen on the PyMOL * app's right-hand object menu. * * @param object @@ -661,19 +723,15 @@ /** * Create group JmolObjects, and set hierarchical visibilities */ - void finalizeEverything() { - viewer.setStringProperty("measurementUnits", "ANGSTROMS"); - viewer.setBooleanProperty("zoomHeight", true); + void finalizeVisibility() { setGroupVisibilities(); - if (groups != null) { + if (groups != null) for (int i = jmolObjects.size(); --i >= 0;) { JmolObject obj = jmolObjects.get(i); - if (obj.objectNameID != null - && occludedObjects.containsKey(obj.objectNameID)) + if (obj.jmolName != null + && occludedObjects.containsKey(obj.jmolName)) obj.visible = false; } - addJmolObject(T.group, null, groups); - } if (!bsHidden.isEmpty()) addJmolObject(T.hidden, bsHidden, null); } @@ -701,13 +759,20 @@ } private void defineAtoms(String name, BS bs) { - htDefinedAtoms.put(getSelectionName(name), bs); + htDefinedAtoms.put(getJmolName(name), bs); } - private static String getSelectionName(String name) { + private static String getJmolName(String name) { return "__" + fixName(name); } + /** + * create all objects for a given molecule or scene + * @param reps + * @param allowSurface + * @param atomCount0 > 0 for a molecule; -1 for a scene + * @param atomCount + */ void createShapeObjects(BS[] reps, boolean allowSurface, int atomCount0, int atomCount) { if (atomCount >= 0) { @@ -721,8 +786,7 @@ colixes[i] = (short) atomColorList.get(i).intValue(); jo.setColors(colixes, 0); jo.setSize(0); - jo = addJmolObject(JC.SHAPE_STICKS, objectAtoms, - Float.valueOf(floatSetting(PyMOL.valence))); + jo = addJmolObject(JC.SHAPE_STICKS, objectAtoms, null); jo.setSize(0); } createShapeObject(PyMOL.REP_LINES, reps[PyMOL.REP_LINES]); @@ -817,6 +881,7 @@ } JmolList<Object> getObjectSetting(int i) { + // why label_position only? return objectSettings.get(Integer.valueOf(i)); } @@ -913,9 +978,7 @@ color = (int) floatSetting(PyMOL.dash_color); int c = PyMOL.getRGB(color); short colix = C.getColix(c); - int clabel = (int) floatSetting(PyMOL.label_color); - if (clabel < 0) - clabel = color; + int clabel = (labelColor < 0 ? color : labelColor); if (isNew) { mdList = new MeasurementData[n]; htMeasures.put(objectName, mdList); @@ -1024,11 +1087,11 @@ BS setAtomMap(int[] atomMap, int atomCount0) { htAtomMap.put(objectNameID, atomMap); - BS bsAtoms = htDefinedAtoms.get(objectSelectionName); + BS bsAtoms = htDefinedAtoms.get(objectJmolName); if (bsAtoms == null) { bsAtoms = BS.newN(atomCount0 + atomMap.length); Logger.info("PyMOL molecule " + objectName); - htDefinedAtoms.put(objectSelectionName, bsAtoms); + htDefinedAtoms.put(objectJmolName, bsAtoms); htObjectAtoms.put(objectName, bsAtoms); moleculeNames.addLast(objectName); } @@ -1281,20 +1344,20 @@ if (bs.isEmpty()) return; jo = addJmolObject(JC.SHAPE_STARS, bs, null); - jo.rd = new RadiusData(null, floatSetting(PyMOL.nonbonded_size) / 2, + jo.rd = new RadiusData(null, nonbondedSize / 2, RadiusData.EnumType.FACTOR, EnumVdw.AUTO); break; case PyMOL.REP_NBSPHERES: case PyMOL.REP_SPHERES: jo = addJmolObject(JC.SHAPE_BALLS, bs, null); - f = floatSetting(PyMOL.sphere_color); + f = sphereColor; if (f != -1) jo.argb = PyMOL.getRGB((int) f); jo.translucency = sphereTranslucency; break; case PyMOL.REP_DOTS: jo = addJmolObject(JC.SHAPE_DOTS, bs, null); - f = floatSetting(PyMOL.sphere_scale); + f = sphereScale; jo.rd = new RadiusData(null, f, RadiusData.EnumType.FACTOR, EnumVdw.AUTO); break; case PyMOL.REP_CARTOON: @@ -1307,7 +1370,7 @@ case PyMOL.REP_MESH: // = 8; jo = addJmolObject(T.isosurface, bs, null); jo.setSize(floatSetting(PyMOL.solvent_radius)); - jo.translucency = floatSetting(PyMOL.transparency); + jo.translucency = transparency; break; case PyMOL.REP_SURFACE: // = 2; float withinDistance = floatSetting(PyMOL.surface_carve_cutoff); @@ -1316,7 +1379,7 @@ (surfaceMode == 3 || surfaceMode == 4) ? " only" : "", bsCarve, Float.valueOf(withinDistance)}); jo.setSize(floatSetting(PyMOL.solvent_radius) * (solventAccessible ? -1 : 1)); - jo.translucency = floatSetting(PyMOL.transparency); + jo.translucency = transparency; if (surfaceColor >= 0) jo.argb = PyMOL.getRGB(surfaceColor); break; @@ -1504,7 +1567,7 @@ f = sphereScale; break; case PyMOL.nonbonded_size: - f = nonBondedSize; + f = nonbondedSize; break; default: return 0; @@ -1583,12 +1646,12 @@ public void addMesh(int tok, JmolList<Object> obj, String objName, boolean isMep) { JmolObject jo = addJmolObject(tok, null, obj); - setObject(objName, -1); + setSceneObject(objName, -1); if (!isMep) { - jo.setSize(floatSetting(PyMOL.mesh_width)); + jo.setSize(meshWidth); jo.argb = PyMOL.getRGB(intAt(listAt(obj, 0), 2)); } - jo.translucency = floatSetting(PyMOL.transparency); + jo.translucency = transparency; } public void addIsosurface(String objectName) { Modified: trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollectionReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollectionReader.java 2013-06-06 20:56:00 UTC (rev 18300) +++ trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollectionReader.java 2013-06-06 20:59:04 UTC (rev 18301) @@ -238,13 +238,9 @@ } finalizeReader(); } catch (Throwable e) { - System.out.println(e); - /** - * @j2sNative - */ - { - e.printStackTrace(); - } + Logger.info("Reader error: " + e); + if (!viewer.isApplet()) + e.printStackTrace(); setError(e); } if (reader != null) Modified: trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java =================================================================== --- trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java 2013-06-06 20:56:00 UTC (rev 18300) +++ trunk/Jmol/src/org/jmol/modelsetbio/BioModel.java 2013-06-06 20:59:04 UTC (rev 18301) @@ -94,7 +94,6 @@ String structureID, int serialID, int strandCount, char startChainID, int startSeqcode, char endChainID, int endSeqcode, int istart, int iend, BS bsAssigned) { - System.out.println("biomodel " + type + " " + structureID + " " + serialID + " " + istart + " " + iend); for (int i = bioPolymerCount; --i >= 0; ) bioPolymers[i].addStructure(type, structureID, serialID, strandCount, startChainID, startSeqcode, endChainID, endSeqcode, istart, iend, bsAssigned); Modified: trunk/Jmol/src/org/jmol/render/RepaintManager.java =================================================================== --- trunk/Jmol/src/org/jmol/render/RepaintManager.java 2013-06-06 20:56:00 UTC (rev 18300) +++ trunk/Jmol/src/org/jmol/render/RepaintManager.java 2013-06-06 20:59:04 UTC (rev 18301) @@ -215,8 +215,9 @@ } g3d.renderAllStrings(null); } catch (Exception e) { - e.printStackTrace(); - Logger.error("rendering error? "); + if (!viewer.isApplet()) + e.printStackTrace(); + Logger.error("rendering error? " + e); } } Modified: trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2013-06-06 20:56:00 UTC (rev 18300) +++ trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2013-06-06 20:59:04 UTC (rev 18301) @@ -707,8 +707,9 @@ } catch (Exception ex) { viewer.setStringProperty("_errormessage", "" + ex); if (e.thisContext == null) { - Logger.error("Error evaluating context"); - ex.printStackTrace(); + Logger.error("Error evaluating context " + ex); + if (!viewer.isApplet()) + ex.printStackTrace(); } return false; } Modified: trunk/Jmol/src/org/jmol/script/T.java =================================================================== --- trunk/Jmol/src/org/jmol/script/T.java 2013-06-06 20:56:00 UTC (rev 18300) +++ trunk/Jmol/src/org/jmol/script/T.java 2013-06-06 20:59:04 UTC (rev 18301) @@ -328,7 +328,7 @@ final static int minimize = scriptCommand | 30; //final static int model see mathfunc //final static int measure see mathfunc - final static int move = scriptCommand | 32; + public final static int move = scriptCommand | 32; public final static int moveto = scriptCommand | 34; public final static int navigate = scriptCommand | 35; //final static int quaternion see mathfunc Modified: trunk/Jmol/src/org/jmol/smiles/InvalidSmilesException.java =================================================================== --- trunk/Jmol/src/org/jmol/smiles/InvalidSmilesException.java 2013-06-06 20:56:00 UTC (rev 18300) +++ trunk/Jmol/src/org/jmol/smiles/InvalidSmilesException.java 2013-06-06 20:59:04 UTC (rev 18301) @@ -54,7 +54,7 @@ public InvalidSmilesException(String message) { super(message); lastError = message; - printStackTrace(); + //printStackTrace(); } /** Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-06-06 20:56:00 UTC (rev 18300) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-06-06 20:59:04 UTC (rev 18301) @@ -15,6 +15,10 @@ ___JmolVersion="13.1.16_a" +new feature: set defaults PyMOL + -- zoomHeight TRUE + -- measurementUnits ANGSTROMS + TODO: PyMOL uniqueAtomSettings should override scene color settings TODO: PyMOL uniqueAtomSettings for all atom settings @@ -166,6 +170,7 @@ code: Text.java, Object2d.java moved from shapes to modelset +bug fix: COMPARE move of group saved in state may not be correct when restored bug fix: write command doesn't accept parameter sequence IMAGE PNGJ ... (broken in 13.1.14) bug fix: load APPEND with PDB file loses structure (broken in 13.1.15) bug fix: restore command broken Modified: trunk/Jmol/src/org/jmol/viewer/StateManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/StateManager.java 2013-06-06 20:56:00 UTC (rev 18300) +++ trunk/Jmol/src/org/jmol/viewer/StateManager.java 2013-06-06 20:59:04 UTC (rev 18301) @@ -180,6 +180,12 @@ viewer.setDefaultVdw("Rasmol"); } + public void setPyMOLDefaults() { + setCommonDefaults(); + viewer.setStringProperty("measurementUnits", "ANGSTROMS"); + viewer.setBooleanProperty("zoomHeight", true); + } + private static Object getNoCase(Map<String, Object> saved, String name) { for (Entry<String, Object> e : saved.entrySet()) if (e.getKey().equalsIgnoreCase(name)) @@ -1514,6 +1520,7 @@ return sv; } + ///////// state serialization } Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2013-06-06 20:56:00 UTC (rev 18300) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2013-06-06 20:59:04 UTC (rev 18301) @@ -3277,6 +3277,8 @@ // atom coordinates may be moved here // but this is not included as an atomMovedCallback modelSet.setAtomData(type, name, coordinateData, isDefault); + if (type == AtomCollection.TAINT_COORD) + checkCoordinatesChanged(); refreshMeasures(true); } @@ -6006,7 +6008,7 @@ global.helpPath = value; break; case T.defaults: - if (!value.equalsIgnoreCase("RasMol")) + if (!value.equalsIgnoreCase("RasMol") && !value.equalsIgnoreCase("PyMOL")) value = "Jmol"; setDefaultsType(value); break; @@ -7475,6 +7477,10 @@ stateManager.setRasMolDefaults(); return; } + if (type.equalsIgnoreCase("PyMOL")) { + stateManager.setPyMOLDefaults(); + return; + } setDefaults(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. A cloud service to automate IT design, transition and operations 2. Dashboards that offer high-level views of enterprise services 3. A single system of record for all IT processes http://p.sf.net/sfu/servicenow-d2d-j _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits