From: <ha...@us...> - 2013-04-16 02:29:57
|
Revision: 18111 http://sourceforge.net/p/jmol/code/18111 Author: hansonr Date: 2013-04-16 02:29:53 +0000 (Tue, 16 Apr 2013) Log Message: ----------- ___JmolVersion="13.1.15_dev_2013.04.15a" Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/pymol/ModelSettings.java trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/adapter/readers/pymol/ModelSettings.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/pymol/ModelSettings.java 2013-04-14 23:18:39 UTC (rev 18110) +++ trunk/Jmol/src/org/jmol/adapter/readers/pymol/ModelSettings.java 2013-04-16 02:29:53 UTC (rev 18111) @@ -125,6 +125,7 @@ public void createShape(ModelSet m, BS bsCarb) { ShapeManager sm = m.shapeManager; int modelIndex = getModelIndex(m); + Atom[] atoms; switch (id) { case T.movie: sm.viewer.setMovie((Map<String, Object>) info); @@ -202,7 +203,7 @@ id = JC.SHAPE_TRACE; float[] data = new float[bsAtoms.length()]; rd = new RadiusData(data, 0, RadiusData.EnumType.ABSOLUTE, EnumVdw.AUTO); - Atom[] atoms = sm.viewer.modelSet.atoms; + atoms = sm.viewer.modelSet.atoms; double sum = 0.0, sumsq = 0.0; @@ -309,7 +310,7 @@ public void setColors(short[] colixes, float translucency) { this.colixes = colixes; - this.colors = new Object[] {colixes, Float.valueOf(translucency) }; + colors = new Object[] {colixes, Float.valueOf(translucency) }; } public void setSize(float size) { Modified: trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java 2013-04-14 23:18:39 UTC (rev 18110) +++ trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java 2013-04-16 02:29:53 UTC (rev 18111) @@ -29,6 +29,7 @@ import java.util.Map; +import jspecview.util.ArrayUtil; import jspecview.util.TextFormat; import org.jmol.adapter.readers.cifpdb.PdbReader; @@ -89,7 +90,7 @@ private Map<String, int[]> htAtomMap = new Hashtable<String, int[]>(); private Map<String, BS> ssMapSeq = new Hashtable<String, BS>(); private Map<String, BS> ssMapAtom = new Hashtable<String, BS>(); - private JmolList<Integer> colixList = new JmolList<Integer>(); + private JmolList<Integer> atomColorList = new JmolList<Integer>(); private JmolList<String> labels = new JmolList<String>(); private JmolList<ModelSettings> modelSettings = new JmolList<ModelSettings>(); @@ -586,8 +587,8 @@ BoxInfo.addPointXYZ(x, y, z, xyzMin, xyzMax, 0); } } - processStructures(atomCount0); - setBranchShapes( BSUtil.newBitSet2(atomCount0, atomCount)); + processStructures(); + setBranchShapes(); } else { ns = 1; // I guess I don't understand what the second set is for in each of these. lstStates.clear(); @@ -616,8 +617,8 @@ if (bsState != null) { bsAtoms.or(bsState); } - processStructures(atomCount0); - setBranchShapes(BSUtil.newBitSet2(atomCount0, atomCount)); + processStructures(); + setBranchShapes(); } } setBonds(bonds); @@ -892,12 +893,10 @@ //System.out.println(atom.atomName + " " + atom.group3 + " " + Integer.toHexString(atom.flags)); bsNoSurface.set(atomCount); } - int colorIndex = getInt(a, 21); float translucency = getUniqueFloat(atom.uniqueID, PyMOL.sphere_transparency, sphereTranslucency); - colixList.addLast(Integer.valueOf(C.getColixTranslucent3(C - .getColixO(Integer.valueOf(PyMOL.getRGB(colorIndex))), - translucency > 0, translucency))); + int atomColor = getInt(a, 21); + atomColorList.addLast(getColix(atomColor, translucency)); bsHidden.setBitTo(atomCount, isHidden); bsModelAtoms.set(atomCount); if (bsState != null) @@ -919,6 +918,12 @@ return true; } + private Integer getColix(int colorIndex, float translucency) { + return Integer.valueOf(C.getColixTranslucent3(C + .getColixO(Integer.valueOf(PyMOL.getRGB(colorIndex))), + translucency > 0, translucency)); + } + private BS getBsReps(JmolList<Object> list) { BS bsReps = new BS(); for (int i = 0; i < PyMOL.REP_MAX; i++) @@ -935,20 +940,20 @@ protected void setAdditionalAtomParameters(Atom atom) { } - private void processStructures(int i0) { + private void processStructures() { if (atomSetCollection.bsStructuredModels == null) atomSetCollection.bsStructuredModels = new BS(); atomSetCollection.bsStructuredModels.set(Math.max(atomSetCollection .getCurrentAtomSetIndex(), 0)); - processSS(i0, "H", ssMapAtom.get("H"), EnumStructure.HELIX, 0); - processSS(i0, "S", ssMapAtom.get("S"), EnumStructure.SHEET, 1); - processSS(i0, "L", ssMapAtom.get("L"), EnumStructure.TURN, 0); - processSS(i0, " ", ssMapAtom.get(" "), EnumStructure.NONE, 0); + processSS("H", ssMapAtom.get("H"), EnumStructure.HELIX, 0); + processSS("S", ssMapAtom.get("S"), EnumStructure.SHEET, 1); + processSS("L", ssMapAtom.get("L"), EnumStructure.TURN, 0); + processSS(" ", ssMapAtom.get(" "), EnumStructure.NONE, 0); ssMapSeq = new Hashtable<String, BS>(); } - private void processSS(int atomCount0, String ssType, BS bsAtom, + private void processSS(String ssType, BS bsAtom, EnumStructure type, int strandCount) { if (ssMapSeq.get(ssType) == null) return; @@ -1086,13 +1091,12 @@ private final static int REP_JMOL_STARS = 15; private final static int REP_JMOL_MAX = 16; - private void setBranchShapes(BS bs) { + private void setBranchShapes() { if (isStateScript) return; + BS bs = BSUtil.newBitSet2(atomCount0, atomCount); ModelSettings ms = new ModelSettings(JC.SHAPE_BALLS, bs, null); - colixes = new short[colixList.size()]; - for (int i = colixes.length; --i >= 0;) - colixes[i] = (short) colixList.get(i).intValue(); + colixes = setColors(colixes, atomColorList); ms.setSize(0); ms.setColors(colixes, 0); modelSettings.addLast(ms); @@ -1104,14 +1108,24 @@ reps[REP_JMOL_TRACE].and(reps[PyMOL.REP_CARTOON]); reps[PyMOL.REP_CARTOON].andNot(reps[REP_JMOL_TRACE]); //reps[REP_JMOL_PUTTY].and(reps[REP_CARTOON]); - // reps[REP_CARTOON].andNot(reps[REP_JMOL_PUTTY]); + // reps[REP_CARTOON].andNot(reps[REP_JMOL_PUTTY]); for (int i = 0; i < REP_JMOL_MAX; i++) setShape(i); setSurface(); ssMapAtom = new Hashtable<String, BS>(); } + + private short[] setColors(short[] colixes, + JmolList<Integer> colorList) { + if (colixes == null) + colixes = new short[atomCount]; + else + colixes = ArrayUtil.ensureLength(colixes, atomCount); + for (int i = atomCount; --i >= atomCount0;) + colixes[i] = (short) colorList.get(i).intValue(); + return colixes; + } - private void setShape(int shapeID) { // add more to implement BS bs = reps[shapeID]; Modified: trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java 2013-04-14 23:18:39 UTC (rev 18110) +++ trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java 2013-04-16 02:29:53 UTC (rev 18111) @@ -449,7 +449,8 @@ } void finish(ModelSet modelSet, int baseModelIndex, int baseAtomIndex) { - reader.finalizeModelSet(modelSet, baseModelIndex, baseAtomIndex); + if (reader != null) + reader.finalizeModelSet(modelSet, baseModelIndex, baseAtomIndex); atoms = null; atomSetAtomCounts = new int[16]; atomSetAuxiliaryInfo = new Hashtable[16]; Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-04-14 23:18:39 UTC (rev 18110) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-04-16 02:29:53 UTC (rev 18111) @@ -9,7 +9,7 @@ # The quotes above look odd for a parameter file, but they are # important for the JavaScript version of Jmol. -___JmolVersion="13.1.15_dev_2013.04.14a" +___JmolVersion="13.1.15_dev_2013.04.15a" TODO: PyMOL movies, electron density, CGO This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |