Revision: 5127
Author:   hansonr
Date:     2006-05-16 09:57:38 -0700 (Tue, 16 May 2006)
ViewCVS:  http://svn.sourceforge.net/jmol/?rev=5127&view=rev

Log Message:
-----------
bob200603  altloc total flexibility with conformation

-introduces "designer" conformations

load alt/1vwh.cif;color altloc;restrict none;select *;cartoon on
conformation 1 #from altloc = A
conformation 2 #from altloc = B
select 59-64 and (*%,*%A) or 65-70 and (*%,*%B);conformation
# a conformation derived from a mixed set of altlocs.

-multiple file load now working for PDB files

# note that when multiple files are loaded, 1000 is added to each model number 
so as to designate which model in which file
load "1vwh" "alt/1vwh.cif" "alt/1vwh.cif";color altloc;restrict none;select 
*;cartoon on
model 1001;conformation 1
model 2001;conformation 2
model 0 #display both conformations together

-PDB model numbers in multiple file add 1000 for each file.
 so 1001 is file 1, model 1
    1002 is file 1, model 2
    2003 is file 2, model 3
 etc.

see http://www.stolaf.edu/people/hansonr/jmol/test/proto/altloc.htm

Modified Paths:
--------------
    branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java
    branches/bob200603/Jmol/src/org/jmol/adapter/smarter/CifReader.java
    branches/bob200603/Jmol/src/org/jmol/adapter/smarter/PdbReader.java
    branches/bob200603/Jmol/src/org/jmol/adapter/smarter/SmarterJmolAdapter.java
    branches/bob200603/Jmol/src/org/jmol/adapter/smarter/Structure.java
    branches/bob200603/Jmol/src/org/jmol/api/JmolAdapter.java
    branches/bob200603/Jmol/src/org/jmol/viewer/Atom.java
    branches/bob200603/Jmol/src/org/jmol/viewer/Eval.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/Model.java
    branches/bob200603/Jmol/src/org/jmol/viewer/ModelManager.java
    branches/bob200603/Jmol/src/org/jmol/viewer/Token.java
    branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java
Modified: 
branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java 
2006-05-16 03:01:48 UTC (rev 5126)
+++ branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java 
2006-05-16 16:57:38 UTC (rev 5127)
@@ -67,8 +67,6 @@
   float[] pdbScaleMatrix;
   float[] pdbScaleTranslate;
 
-  String[] pdbStructureRecords;
-
   AtomSetCollection(String fileTypeName) {
     this.fileTypeName = fileTypeName;
     // set the default PATH properties as defined in the SmarterJmolAdapter
@@ -85,17 +83,20 @@
    */
   AtomSetCollection(AtomSetCollection[] array) {
     this("Array");
+    setAtomSetCollectionAuxiliaryInfo("isMultiFile", Boolean.TRUE);
     for (int i = 0; i < array.length; i++) {
-      appendAtomSetCollection(array[i]);
+      appendAtomSetCollection(i, array[i]);
     }
   }
 
   /**
    * Appends an AtomSetCollection
    * 
+   * @param collectionIndex collection index for new model number
    * @param collection AtomSetCollection to append
    */
-  protected void appendAtomSetCollection(AtomSetCollection collection) {
+  protected void appendAtomSetCollection(int collectionIndex,
+                                         AtomSetCollection collection) {
     // Initialisations
     int existingAtomsCount = atomCount;
 
@@ -116,16 +117,29 @@
         newCloneAtom(collection.atoms[clonedAtoms]);
         clonedAtoms++;
       }
+
+      // auxiliary info
+      atomSetAuxiliaryInfo[currentAtomSetIndex] = 
collection.atomSetAuxiliaryInfo[atomSetNum];
+
+      //Structures: We must incorporate any global structures (modelIndex == 
-1) into this model
+      //explicitly. Whew! This is because some cif _data structures have 
multiple PDB models (1skt)
+      for (int i = 0; i < collection.structureCount; i++)
+        if (collection.structures[i].modelIndex == atomSetNum
+            || collection.structures[i].modelIndex == -1)
+          addStructure(collection.structures[i]);
+
+      // names and numbers
+      atomSetNames[currentAtomSetIndex] = collection.atomSetNames[atomSetNum];
+      atomSetNumbers[currentAtomSetIndex] = ((collectionIndex + 1) * 1000)
+          + collection.atomSetNumbers[atomSetNum];
     }
-
     // Clone bonds
     for (int bondNum = 0; bondNum < collection.bondCount; bondNum++) {
       Bond bond = collection.bonds[bondNum];
-      addNewBond(
-          bond.atomIndex1 + existingAtomsCount,
-          bond.atomIndex2 + existingAtomsCount,
-          bond.order);
+      addNewBond(bond.atomIndex1 + existingAtomsCount, bond.atomIndex2
+          + existingAtomsCount, bond.order);
     }
+
   }
 
   protected void finalize() {
@@ -137,7 +151,6 @@
     atoms = null;
     bonds = null;
     notionalUnitcell = pdbScaleMatrix = pdbScaleTranslate = null;
-    pdbStructureRecords = null;
     symmetries = null;
   }
 
@@ -304,6 +317,8 @@
     if (structureCount == structures.length)
       structures = (Structure[])AtomSetCollectionReader.setLength(structures,
                                                       structureCount + 32);
+    structure.modelIndex = currentAtomSetIndex;
+    System.out.println("AtomSetColl. addStructure " + structureCount+" 
:"+structure.modelIndex+" "+structure.structureType+" 
"+structure.startSequenceNumber);
     structures[structureCount++] = structure;
   }
 

Modified: branches/bob200603/Jmol/src/org/jmol/adapter/smarter/CifReader.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/adapter/smarter/CifReader.java 
2006-05-16 03:01:48 UTC (rev 5126)
+++ branches/bob200603/Jmol/src/org/jmol/adapter/smarter/CifReader.java 
2006-05-16 16:57:38 UTC (rev 5127)
@@ -41,7 +41,6 @@
 
   int desiredModelNumber;
   int modelNumber = 0;
-
   boolean normalize = true;
   boolean iHaveAppliedSymmetry = false;
   BufferedReader reader;
@@ -156,6 +155,8 @@
     thisDataSetName = (line.length() < 6 ? "" : line.substring(5).trim());
     if (thisDataSetName.length() > 0) {
       if (atomSetCollection.currentAtomSetIndex >= 0) {
+        // note that there can be problems with multi-data mmCIF sets each with
+        // multiple models; and we could be loading multiple files!
         atomSetCollection.newAtomSet();
         atomSetCollection.setCollectionName("<collection of "
             + (atomSetCollection.currentAtomSetIndex + 1) + " models>");
@@ -328,6 +329,7 @@
   void processAtomSiteLoopBlock() throws Exception {
     //    logger.log("processAtomSiteLoopBlock()-------------------------");
     int currentModelNO = -1;
+    boolean isPDB = false;
     int[] fieldTypes = new int[100]; // should be enough
     boolean[] atomPropertyReferenced = new boolean[ATOM_PROPERTY_MAX];
     int fieldCount = parseLoopParameters(atomFields, atomFieldMap, fieldTypes,
@@ -447,6 +449,7 @@
             altLocIds += alternateLocationID;
           break;
         case GROUP_PDB:
+          isPDB = true;
           if ("HETATM".equals(field))
             atom.isHetero = true;
           break;
@@ -474,6 +477,8 @@
         atomSetCollection.addAtomWithMappedName(atom);
       }
     }
+    if (isPDB)
+      atomSetCollection.setAtomSetAuxiliaryInfo("isPDB", new Boolean(isPDB));
   }
 
   void disableField(int fieldCount, int[] fieldTypes, int fieldIndex) {

Modified: branches/bob200603/Jmol/src/org/jmol/adapter/smarter/PdbReader.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/adapter/smarter/PdbReader.java 
2006-05-16 03:01:48 UTC (rev 5126)
+++ branches/bob200603/Jmol/src/org/jmol/adapter/smarter/PdbReader.java 
2006-05-16 16:57:38 UTC (rev 5127)
@@ -40,7 +40,6 @@
   String spaceGroup;
   float[] notionalUnitcell = new float[6];
   String altLocIds = "";
-
   final Hashtable htFormul = new Hashtable();
 
   String currentGroup3;
@@ -49,8 +48,8 @@
   AtomSetCollection readAtomSetCollection(BufferedReader reader) throws 
Exception {
 
     atomSetCollection = new AtomSetCollection("pdb");
+    atomSetCollection.setAtomSetCollectionAuxiliaryInfo("isPDB", Boolean.TRUE);
 
-    atomSetCollection.pdbStructureRecords = new String[32];
     initialize();
     while ((line = reader.readLine()) != null) {
       lineLength = line.length();
@@ -347,7 +346,8 @@
 
     // this should probably call Structure.validateAndAllocate
     // in order to check validity of parameters
-    Structure structure = new Structure(structureType, startChainID,
+    // 0 here is just a placeholder; actual model number is set in 
addStructure()
+    Structure structure = new Structure(0, structureType, startChainID,
                                         startSequenceNumber,
                                         startInsertionCode, endChainID,
                                         endSequenceNumber, endInsertionCode);

Modified: 
branches/bob200603/Jmol/src/org/jmol/adapter/smarter/SmarterJmolAdapter.java
===================================================================
--- 
branches/bob200603/Jmol/src/org/jmol/adapter/smarter/SmarterJmolAdapter.java    
    2006-05-16 03:01:48 UTC (rev 5126)
+++ 
branches/bob200603/Jmol/src/org/jmol/adapter/smarter/SmarterJmolAdapter.java    
    2006-05-16 16:57:38 UTC (rev 5127)
@@ -332,6 +332,9 @@
       return true;
     }
 
+    public int getModelIndex() {
+      return structure.modelIndex;
+    }
     public String getStructureType() {
       return structure.structureType;
     }

Modified: branches/bob200603/Jmol/src/org/jmol/adapter/smarter/Structure.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/adapter/smarter/Structure.java 
2006-05-16 03:01:48 UTC (rev 5126)
+++ branches/bob200603/Jmol/src/org/jmol/adapter/smarter/Structure.java 
2006-05-16 16:57:38 UTC (rev 5127)
@@ -31,12 +31,14 @@
   char endChainID;
   int endSequenceNumber;
   char endInsertionCode;
+  int modelIndex;
 
   Structure() { }
 
-  Structure(String structureType,
+  Structure(int modelIndex, String structureType,
             char startChainID, int startSequenceNumber, char 
startInsertionCode,
             char endChainID, int endSequenceNumber, char endInsertionCode) {
+    this.modelIndex = modelIndex;
     this.structureType = structureType;
     this.startChainID = startChainID;
     this.startSequenceNumber = startSequenceNumber;

Modified: branches/bob200603/Jmol/src/org/jmol/api/JmolAdapter.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/api/JmolAdapter.java   2006-05-16 
03:01:48 UTC (rev 5126)
+++ branches/bob200603/Jmol/src/org/jmol/api/JmolAdapter.java   2006-05-16 
16:57:38 UTC (rev 5127)
@@ -431,6 +431,7 @@
 
   public abstract class StructureIterator {
     public abstract boolean hasNext();
+    public abstract int getModelIndex();
     public abstract String getStructureType();
     public abstract char getStartChainID();
     public abstract int getStartSequenceNumber();

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Atom.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Atom.java       2006-05-16 
03:01:48 UTC (rev 5126)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Atom.java       2006-05-16 
16:57:38 UTC (rev 5127)
@@ -759,8 +759,9 @@
   int getModelTagNumber() {
     if (group == null)
       return 0;
-    if (group.chain.frame.isPDB) {
+    if (group.chain.model.isPDB) { 
       try {
+        System.out.println("Atom.getModelTagNumber");
         return Integer.parseInt(group.chain.model.modelTag);
       } finally {}
     }  

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java       2006-05-16 
03:01:48 UTC (rev 5126)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java       2006-05-16 
16:57:38 UTC (rev 5127)
@@ -2277,8 +2277,13 @@
   }
 
   void conformation() throws ScriptException {
-    checkLength2();
-    BitSet bsConformations = viewer.setConformation(intParameter(1) - 1);
+    BitSet bsConformations;
+    if (statementLength == 1) {
+      bsConformations = viewer.setConformation();
+    } else {
+      checkLength2();
+      bsConformations = viewer.setConformation(intParameter(1) - 1);
+    }
     boolean addHbonds = viewer.hbondsAreVisible();
     viewer.setShapeSize(JmolConstants.SHAPE_HSTICKS, 0, bsConformations);
     if (addHbonds)

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java      2006-05-16 
03:01:48 UTC (rev 5126)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java      2006-05-16 
16:57:38 UTC (rev 5127)
@@ -49,6 +49,7 @@
   // if (modelSetTypeName == "xyz")
   final String modelSetTypeName;
   final boolean isPDB;
+  final boolean isMultiFile;
   final Mmset mmset;
   final Graphics3D g3d;
   // the maximum BondingRadius seen in this set of atoms
@@ -185,13 +186,11 @@
     // NOTE: these strings are interned and are lower case
     // therefore, we can do == comparisions against string constants
     // if (modelSetTypeName == "xyz") { }
-    this.modelSetTypeName = fileTypeName.toLowerCase().intern();
-    this.isPDB = (this.modelSetTypeName == "pdb")
-        || (this.modelSetTypeName == "array");
+    modelSetTypeName = fileTypeName.toLowerCase().intern();
 
     mmset = new Mmset(this);
-    this.frameRenderer = viewer.getFrameRenderer();
-    this.g3d = viewer.getGraphics3D();
+    frameRenderer = viewer.getFrameRenderer();
+    g3d = viewer.getGraphics3D();
 
     loadShape(JmolConstants.SHAPE_BALLS);
     loadShape(JmolConstants.SHAPE_STICKS);
@@ -210,6 +209,9 @@
      * need to be transformed to fit in the crystal cell
      ****************************************************************/
 
+    isMultiFile = mmset.getModelSetAuxiliaryInfoBoolean("isMultiFile");
+    isPDB = mmset.getModelSetAuxiliaryInfoBoolean("isPDB");
+
     //THESE TWO LINES ARE INCORRECT -- ASSUMES SINGLE-MODEL FILE --
     //these are only used to generate a unit cell, not fractional coord.
     //they should be incorporated into modelAuxiliaryInfo
@@ -239,8 +241,10 @@
       Properties modelProperties = adapter.getAtomSetProperties(clientFile, i);
       Hashtable modelAuxiliaryInfo = adapter.getAtomSetAuxiliaryInfo(
           clientFile, i);
+      boolean isPDBModel = (isPDB || mmset.getModelAuxiliaryInfoBoolean(i,
+          "isPDB"));
       setModelNameNumberProperties(i, modelName, modelNumber, modelProperties,
-          modelAuxiliaryInfo);
+          modelAuxiliaryInfo, isPDBModel);
     }
 
     for (JmolAdapter.AtomIterator iterAtom = adapter
@@ -275,7 +279,7 @@
 
         }
     }
-    
+
     // define turns LAST. (pulled by the iterator first)
     // so that if they overlap they get overwritten:
 
@@ -284,22 +288,24 @@
     if (iterStructure != null)
       while (iterStructure.hasNext()) {
         if (!iterStructure.getStructureType().equals("turn"))
-          defineStructure(iterStructure.getStructureType(), iterStructure
-              .getStartChainID(), iterStructure.getStartSequenceNumber(),
-              iterStructure.getStartInsertionCode(), iterStructure
-                  .getEndChainID(), iterStructure.getEndSequenceNumber(),
-              iterStructure.getEndInsertionCode());
+          defineStructure(iterStructure.getModelIndex(), iterStructure
+              .getStructureType(), iterStructure.getStartChainID(),
+              iterStructure.getStartSequenceNumber(), iterStructure
+                  .getStartInsertionCode(), iterStructure.getEndChainID(),
+              iterStructure.getEndSequenceNumber(), iterStructure
+                  .getEndInsertionCode());
       }
 
     iterStructure = adapter.getStructureIterator(clientFile);
     if (iterStructure != null)
       while (iterStructure.hasNext()) {
         if (iterStructure.getStructureType().equals("turn"))
-          defineStructure(iterStructure.getStructureType(), iterStructure
-              .getStartChainID(), iterStructure.getStartSequenceNumber(),
-              iterStructure.getStartInsertionCode(), iterStructure
-                  .getEndChainID(), iterStructure.getEndSequenceNumber(),
-              iterStructure.getEndInsertionCode());
+          defineStructure(iterStructure.getModelIndex(), iterStructure
+              .getStructureType(), iterStructure.getStartChainID(),
+              iterStructure.getStartSequenceNumber(), iterStructure
+                  .getStartInsertionCode(), iterStructure.getEndChainID(),
+              iterStructure.getEndSequenceNumber(), iterStructure
+                  .getEndInsertionCode());
       }
 
     doUnitcellStuff();
@@ -685,7 +691,7 @@
     }
   }
 
-  void defineStructure(String structureType, char startChainID,
+  void defineStructure(int modelIndex, String structureType, char startChainID,
                        int startSequenceNumber, char startInsertionCode,
                        char endChainID, int endSequenceNumber,
                        char endInsertionCode) {
@@ -695,7 +701,7 @@
         + " startchainid" + startChainID + " statseq" + startSequenceNumber
         + " endchain" + endChainID + " endseq" + endSequenceNumber);
     */
-    mmset.defineStructure(structureType, startChainID, startSequenceNumber,
+    mmset.defineStructure(modelIndex, structureType, startChainID, 
startSequenceNumber,
         startInsertionCode, endChainID, endSequenceNumber, endInsertionCode);
   }
 
@@ -813,9 +819,10 @@
   void setModelNameNumberProperties(int modelIndex, String modelName,
                                     int modelNumber,
                                     Properties modelProperties,
-                                    Hashtable modelAuxiliaryInfo) {
+                                    Hashtable modelAuxiliaryInfo,
+                                    boolean isPDB) {
     mmset.setModelNameNumberProperties(modelIndex, modelName, modelNumber,
-        modelProperties, modelAuxiliaryInfo);
+        modelProperties, modelAuxiliaryInfo, isPDB);
   }
 
   ////////////////////////////////////////////////////////////////
@@ -1362,9 +1369,11 @@
   ////////////////////////////////////////////////////////////////
   void doAutobond() {
     // perform bonding if necessary
-
+    // to do this right, we would do it PER MODEL in the PDB, but it's not 
clear
+    // how to specify that. For now -- if multifile, then just rebond.
     if (viewer.getAutoBond() && getModelSetProperty("noautobond") == null) {
-      if ((bondCount == 0) || (isPDB && (bondCount < (atomCount / 2))))
+      if ((bondCount == 0) || isMultiFile
+          || (isPDB && (bondCount < (atomCount / 2))))
         rebond(false);
     }
   }

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Mmset.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Mmset.java      2006-05-16 
03:01:48 UTC (rev 5126)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Mmset.java      2006-05-16 
16:57:38 UTC (rev 5127)
@@ -50,7 +50,7 @@
     this.frame = frame;
   }
 
-  void defineStructure(String structureType, char startChainID,
+  void defineStructure(int modelIndex, String structureType, char startChainID,
                        int startSequenceNumber, char startInsertionCode,
                        char endChainID, int endSequenceNumber,
                        char endInsertionCode) {
@@ -63,7 +63,7 @@
     if (structureCount == structures.length)
       structures = (Structure[]) Util
           .setLength(structures, structureCount + 10);
-    structures[structureCount++] = new Structure(structureType, startChainID,
+    structures[structureCount++] = new Structure(modelIndex, structureType, 
startChainID,
         Group.getSeqcode(startSequenceNumber, startInsertionCode), endChainID,
         Group.getSeqcode(endSequenceNumber, endInsertionCode));
   }
@@ -220,7 +220,8 @@
   void setModelNameNumberProperties(int modelIndex, String modelName,
                                     int modelNumber,
                                     Properties modelProperties,
-                                    Hashtable modelAuxiliaryInfo) {
+                                    Hashtable modelAuxiliaryInfo,
+                                    boolean isPDB) {
     modelNames[modelIndex] = modelName;
     modelNumbers[modelIndex] = modelNumber;
     this.modelProperties[modelIndex] = modelProperties;
@@ -228,17 +229,24 @@
     models[modelIndex] = new Model(this, modelIndex, modelName);
     String altLocs = (String) getModelAuxiliaryInfo(modelIndex, "altLocs");
     models[modelIndex].setNAltLocs(altLocs == null ? 0 : altLocs.length());
+    models[modelIndex].isPDB = isPDB;
   }
 
   int getAltLocCountInModel(int modelIndex) {
     return models[modelIndex].nAltLocs;
   }
   private void propogateSecondaryStructure() {
+    // issue arises with multiple file loading and multi-_data  mmCIF files
+    // that structural information may be model-specific
+    
     for (int i = structureCount; --i >= 0;) {
       Structure structure = structures[i];
+      System.out.println("Mmset.propogate " +structure.modelIndex+" 
"+structure.type +" "+ structure.startChainID +" "+ structure.startSeqcode + " 
"+structure.endSeqcode);
       for (int j = modelCount; --j >= 0;)
-        models[j].addSecondaryStructure(structure.type, structure.startChainID,
-            structure.startSeqcode, structure.endChainID, 
structure.endSeqcode);
+        if (structure.modelIndex == j || structure.modelIndex == -1)
+          models[j].addSecondaryStructure(structure.type,
+              structure.startChainID, structure.startSeqcode,
+              structure.endChainID, structure.endSeqcode);
     }
   }
 
@@ -314,9 +322,11 @@
     int startSeqcode;
     char endChainID;
     int endSeqcode;
+    int modelIndex;
 
-    Structure(String typeName, char startChainID, int startSeqcode,
+    Structure(int modelIndex, String typeName, char startChainID, int 
startSeqcode,
         char endChainID, int endSeqcode) {
+      this.modelIndex = modelIndex;
       this.typeName = typeName;
       this.startChainID = startChainID;
       this.startSeqcode = startSeqcode;

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Model.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Model.java      2006-05-16 
03:01:48 UTC (rev 5126)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Model.java      2006-05-16 
16:57:38 UTC (rev 5127)
@@ -34,7 +34,7 @@
   int firstMolecule;
   int moleculeCount;
   int nAltLocs;
-  
+  boolean isPDB = false;
   private int chainCount = 0;
   private Chain[] chains = new Chain[8];
 
@@ -68,7 +68,7 @@
   void addSecondaryStructure(byte type,
                              char startChainID, int startSeqcode,
                              char endChainID, int endSeqcode) {
-    //System.out.println("MODEL addSecondary (from file) " + type);
+    System.out.println("MODEL addSecondary (from file) " + modelIndex+" "+type 
+ startChainID + " "+startSeqcode + " " + endSeqcode);
     for (int i = polymerCount; --i >= 0; ) {
       Polymer polymer = polymers[i];
       polymer.addSecondaryStructure(type, startChainID, startSeqcode,

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/ModelManager.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/ModelManager.java       
2006-05-16 03:01:48 UTC (rev 5126)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/ModelManager.java       
2006-05-16 16:57:38 UTC (rev 5127)
@@ -145,6 +145,10 @@
     return frame == null ? false : frame.isPDB;
   }
 
+  boolean isPDB(int modelIndex) {
+    return frame == null ? false : frame.mmset.getModel(modelIndex).isPDB;
+  }
+
   int getModelCount() {
     return (frame == null) ? 0 : frame.getModelCount();
   }
@@ -922,12 +926,11 @@
   }
 
   Vector getAllAtomInfo(BitSet bs) {
-    boolean isPDB = frame.isPDB;
     Vector V = new Vector();
     int atomCount = viewer.getAtomCount();
     for (int i = 0; i < atomCount; i++) 
-      if (bs.get(i)) 
-        V.add(getAtomInfo(i, isPDB));
+      if (bs.get(i))
+        V.add(getAtomInfoLong(i));
     return V;
   }
 
@@ -942,7 +945,7 @@
     info.put("sym", getElementSymbol(i));
   }
   
-  Hashtable getAtomInfo(int i, boolean isPDB) {
+  Hashtable getAtomInfoLong(int i) {
     Atom atom = frame.getAtomAt(i);
     Hashtable info = new Hashtable();
     getAtomIdentityInfo(i, info);
@@ -969,8 +972,7 @@
       info.put("translucent", new Boolean(isTranslucent));
     info.put("formalCharge", new Integer(atom.getFormalCharge()));
     info.put("partialCharge", new Float(atom.getPartialCharge()));
-    
-    if (isPDB) {
+    if (isPDB(atom.modelIndex)) {
       info.put("resname", atom.getGroup3());
       info.put("resno", atom.getSeqcodeString());
       char chainID = atom.getChainID();
@@ -1374,6 +1376,11 @@
     frame.recalculateStructure(bsSelected);
   }
 
+  BitSet setConformation(int modelIndex, BitSet bsConformation) {
+    frame.setConformation(modelIndex, bsConformation);
+    return bsConformation;
+  }
+  
   BitSet setConformation(int modelIndex, int conformationIndex) {
     if (frame == null)
       return null;
@@ -1384,12 +1391,14 @@
         continue;
       String altLocs = frame.getAltLocListInModel(i);
       BitSet bsConformation = getModelAtomBitSet(i);
+      System.out.println("\nmodelmanager.setconf. a "+i+" "+bsConformation);
       if (conformationIndex >= 0)
         for (int c = frame.getAltLocCountInModel(i); --c >= 0;)
           if (c != conformationIndex)
             bsConformation.andNot(frame.getSpecAlternate(altLocs.substring(c,
                 c + 1)));
       if (bsConformation.length() > 0) {
+        System.out.println("modelmanager.setconf. b "+i+" "+bsConformation);
         frame.setConformation(i, bsConformation);
         bsResult.or(bsConformation);
       }

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Token.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Token.java      2006-05-16 
03:01:48 UTC (rev 5126)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Token.java      2006-05-16 
16:57:38 UTC (rev 5127)
@@ -536,7 +536,7 @@
     "centerat",          new Token(centerAt, varArgCount, "centerat"),
     "isosurface",        new Token(isosurface,varArgCount,"isosurface"),
     "getproperty",       new Token(getproperty,varArgCount, "getproperty"),
-    "conformation",      new Token(conformation,         1, "conformation"),
+    "conformation",      new Token(conformation,varArgCount, "conformation"),
 
     // setparams
     "ambient",      new Token(ambient,         "ambient"),

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java     2006-05-16 
03:01:48 UTC (rev 5126)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java     2006-05-16 
16:57:38 UTC (rev 5127)
@@ -1628,6 +1628,13 @@
     return modelManager.getAllStateInfo(bs);
   }
 
+  public BitSet setConformation() {
+    // user has selected some atoms, now this sets that as a conformation
+    // with the effect of rewriting the cartoons to match
+    
+    return modelManager.setConformation(getDisplayModelIndex(), 
getSelectionSet());
+  }
+
   public BitSet setConformation(int conformationIndex) {
     return modelManager.setConformation(getDisplayModelIndex(), 
conformationIndex);
   }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jmol-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to