From: <ha...@us...> - 2006-05-03 07:12:47
|
Revision: 5055 Author: hansonr Date: 2006-05-03 00:12:41 -0700 (Wed, 03 May 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=5055&view=rev Log Message: ----------- bob200603 -adding in other file readers -- PDB, MOL -needs testing with SHELX and CML Modified Paths: -------------- branches/bob200603/Jmol/src/org/jmol/viewer/ColorManager.java branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java branches/bob200603/Jmol/src/org/jmol/viewer/Mmset.java branches/bob200603/Jmol/src/org/jmol/viewer/UccageRenderer.java Modified: branches/bob200603/Jmol/src/org/jmol/viewer/ColorManager.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/ColorManager.java 2006-05-03 05:35:31 UTC (rev 5054) +++ branches/bob200603/Jmol/src/org/jmol/viewer/ColorManager.java 2006-05-03 07:12:41 UTC (rev 5055) @@ -200,11 +200,10 @@ } else if ("molecule" == palette) { // viewer.calcSelectedMoleculesCount() must be called first ... Frame frame2 = viewer.getFrame(); - index = quantize(frame2.getMoleculeIndex(atom.atomIndex), - frame2.getLastMoleculeIndexInModel(atom.modelIndex), - frame2.getFirstMoleculeIndexInModel(atom.modelIndex), - JmolConstants.argbsRoygbScale.length); - index = JmolConstants.argbsRoygbScale.length - 1 - index; + int i = frame2.getMoleculeIndex(atom.atomIndex); + int j = frame2.getFirstMoleculeIndexInModel(atom.modelIndex); + int k = frame2.getLastMoleculeIndexInModel(atom.modelIndex); + index = quantize(i, j, k, JmolConstants.argbsRoygbScale.length); argb = JmolConstants.argbsRoygbScale[index]; } else { System.out.println("ColorManager.getColixAtomPalette:" + Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java 2006-05-03 05:35:31 UTC (rev 5054) +++ branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java 2006-05-03 07:12:41 UTC (rev 5055) @@ -1538,12 +1538,12 @@ * */ - System.out.println("dounitc" + someModelsHaveUnitcells + " " - + someModelsHaveSymmetry + " " + someModelsHaveFractionalCoordinates); + //System.out.println("dounitc" + someModelsHaveUnitcells + " " + // + someModelsHaveSymmetry + " " + someModelsHaveFractionalCoordinates); int modelCount = getModelCount(); if (someModelsHaveUnitcells) { + boolean doPdbScale = (modelCount == 1); cellInfo = new CellInfo[modelCount]; - boolean doPdbScale = (modelCount == 1); for (int i = 0; i < modelCount; i++) cellInfo[i] = new CellInfo(i, doPdbScale); } @@ -1553,6 +1553,11 @@ "presymmetryAtomIndex"), mmset.getModelAuxiliaryInfoInt(i, "presymmetryAtomCount")); } + } else { + int ipt = 0; + for (int i = 0; i < modelCount; i++) { + ipt = mmset.setSymmetryAtomInfo(i, ipt, getAtomCountInModel(i)); + } } if (someModelsHaveFractionalCoordinates) { for (int i = atomCount; --i >= 0;) { @@ -1573,6 +1578,8 @@ } void calcUnitCellMinMax(Point3f pointMin, Point3f pointMax) { + if (!someModelsHaveUnitcells) + return; int modelCount = getModelCount(); for (int i = 0; i < modelCount; i++) { if (!cellInfo[i].coordinatesAreFractional) @@ -2102,6 +2109,7 @@ } void getMolecules() { + System.out.println("molCount getMolecules" + moleculeCount); if (moleculeCount > 0) return; moleculeCount = 0; @@ -2113,16 +2121,20 @@ for (int i = 0; i < atomCount; i++) if (!atomlist.get(i) && !bs.get(i)) { bs = getMoleculeBitSet(i); + //System.out.println(bs); atomlist.or(bs); if (moleculeCount == molecules.length) molecules = (BitSet[]) Util.setLength(molecules, moleculeCount * 2); molecules[moleculeCount] = new BitSet(); molecules[moleculeCount].xor(bs); + //System.out.println("molecules["+moleculeCount+"]" + molecules[moleculeCount]); modelIndex = atoms[i].modelIndex; if (modelIndex != thisModelIndex) { + //System.out.println("models "+modelIndex +" " + moleculeCount + " first"); mmset.getModel(modelIndex).firstMolecule = moleculeCount; thisModelIndex = modelIndex; } + //System.out.println("models "+thisModelIndex +" " + moleculeCount + " last"); mmset.getModel(thisModelIndex).lastMolecule = moleculeCount; moleculeCount++; } @@ -2143,10 +2155,14 @@ } int getFirstMoleculeIndexInModel(int modelIndex) { + if (moleculeCount == 0) + getMolecules(); return mmset.getModel(modelIndex).firstMolecule; } int getLastMoleculeIndexInModel(int modelIndex) { + if (moleculeCount == 0) + getMolecules(); return mmset.getModel(modelIndex).lastMolecule; } @@ -2159,10 +2175,13 @@ if (atom.bonds == null) return; for (int i = atom.bonds.length; --i >= 0;) { - if (atom.bonds[i].atom1 == atom) { - getCovalentlyConnectedBitSet(atom.bonds[i].atom2, bs, bsToTest); + Bond bond = atom.bonds[i]; + if ((bond.order & JmolConstants.BOND_HYDROGEN_MASK) != 0) + continue; + if (bond.atom1 == atom) { + getCovalentlyConnectedBitSet(bond.atom2, bs, bsToTest); } else { - getCovalentlyConnectedBitSet(atom.bonds[i].atom1, bs, bsToTest); + getCovalentlyConnectedBitSet(bond.atom1, bs, bsToTest); } } } Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Mmset.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/Mmset.java 2006-05-03 05:35:31 UTC (rev 5054) +++ branches/bob200603/Jmol/src/org/jmol/viewer/Mmset.java 2006-05-03 07:12:41 UTC (rev 5055) @@ -138,9 +138,9 @@ modelCount); } - void setSymmetryAtomInfo(int modelIndex, int atomIndex, int atomCount) { + int setSymmetryAtomInfo(int modelIndex, int atomIndex, int atomCount) { models[modelIndex].preSymmetryAtomIndex = atomIndex; - models[modelIndex].preSymmetryAtomCount = atomCount; + return models[modelIndex].preSymmetryAtomCount = atomCount; } int getPreSymmetryAtomIndex(int modelIndex) { Modified: branches/bob200603/Jmol/src/org/jmol/viewer/UccageRenderer.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/UccageRenderer.java 2006-05-03 05:35:31 UTC (rev 5054) +++ branches/bob200603/Jmol/src/org/jmol/viewer/UccageRenderer.java 2006-05-03 07:12:41 UTC (rev 5055) @@ -56,6 +56,8 @@ } void render1(int modelIndex, short mad, short colix) { + if (!frame.someModelsHaveUnitcells) + return; Frame.CellInfo cellInfo = frame.cellInfo[modelIndex]; if (!cellInfo.hasUnitcell) return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |