From: <ha...@us...> - 2006-09-20 08:53:12
|
Revision: 5618 http://svn.sourceforge.net/jmol/?rev=5618&view=rev Author: hansonr Date: 2006-09-20 01:53:04 -0700 (Wed, 20 Sep 2006) Log Message: ----------- set forceAutoBond (solves Eric Martz's problem with PDB files having some bonds present. preliminary work for calculate structure, but it doesn't work because there is no simple way to redefine polymers after doing connection changes. Modified Paths: -------------- trunk/Jmol/src/org/jmol/viewer/AlphaPolymer.java trunk/Jmol/src/org/jmol/viewer/Eval.java trunk/Jmol/src/org/jmol/viewer/Frame.java trunk/Jmol/src/org/jmol/viewer/ModelManager.java trunk/Jmol/src/org/jmol/viewer/Polymer.java trunk/Jmol/src/org/jmol/viewer/StateManager.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/viewer/AlphaPolymer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/AlphaPolymer.java 2006-09-20 06:36:18 UTC (rev 5617) +++ trunk/Jmol/src/org/jmol/viewer/AlphaPolymer.java 2006-09-20 08:53:04 UTC (rev 5618) @@ -98,7 +98,6 @@ byte[] tags = calculateRunsFourOrMore(codes); extendRuns(tags); searchForTurns(codes, angles, tags); - addStructuresFromTags(tags); } Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Eval.java 2006-09-20 06:36:18 UTC (rev 5617) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java 2006-09-20 08:53:04 UTC (rev 5618) @@ -3117,6 +3117,9 @@ case Token.hbond: viewer.autoHbond(); return; + case Token.structure: // NOT WORKING YET - use set forceAutoBond instead + viewer.calculateStructures(); + return; } } Modified: trunk/Jmol/src/org/jmol/viewer/Frame.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Frame.java 2006-09-20 06:36:18 UTC (rev 5617) +++ trunk/Jmol/src/org/jmol/viewer/Frame.java 2006-09-20 08:53:04 UTC (rev 5618) @@ -597,6 +597,16 @@ } } + void clearPolymers() { + for (int i = 0; i < groupCount; ++i) { + Group group = groups[i]; + if (group instanceof Monomer) { + Monomer monomer = (Monomer) group; + if (monomer.polymer != null) + monomer.polymer = null; + } + } + } //////////////////////////////////////////////////////////////// FrameExportJmolAdapter exportJmolAdapter; @@ -645,7 +655,7 @@ hackAtomSerialNumbersForAnimations(); if (!structuresDefined) - calculateStructures(); + calculateStructures(false); //////////////////////////////////////////////////////////////// // find things for the popup menus @@ -654,7 +664,11 @@ mmset.freeze(); } - void calculateStructures() { + void calculateStructures(boolean rebuildPolymers) { + if (rebuildPolymers) { + clearPolymers(); + buildPolymers(); + } mmset.calculateStructures(); } @@ -1385,10 +1399,10 @@ //////////////////////////////////////////////////////////////// void doAutobond() { // perform bonding if necessary - if (viewer.getAutoBond() && getModelSetProperty("noautobond") == null) { - if ((bondCount == 0) || isMultiFile - || (isPDB && (bondCount < (atomCount / 2)))) - autoBond(null, null); + boolean doBond = (bondCount == 0 || isMultiFile || isPDB && bondCount < atomCount / 2); + if (viewer.getForceAutoBond() || doBond && viewer.getAutoBond() + && getModelSetProperty("noautobond") == null) { + autoBond(null, null); } } Modified: trunk/Jmol/src/org/jmol/viewer/ModelManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/ModelManager.java 2006-09-20 06:36:18 UTC (rev 5617) +++ trunk/Jmol/src/org/jmol/viewer/ModelManager.java 2006-09-20 08:53:04 UTC (rev 5618) @@ -1643,5 +1643,10 @@ return false; return frame.getSelectionHaloEnabled(); } - + + void calculateStructures() { + if (frame == null) + return; + frame.calculateStructures(true); + } } Modified: trunk/Jmol/src/org/jmol/viewer/Polymer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Polymer.java 2006-09-20 06:36:18 UTC (rev 5617) +++ trunk/Jmol/src/org/jmol/viewer/Polymer.java 2006-09-20 08:53:04 UTC (rev 5618) @@ -124,7 +124,7 @@ } static Monomer[] getCarbohydrateMonomers(Group[] groups, int firstGroupIndex) { - CarbohydrateMonomer previous = null; + //CarbohydrateMonomer previous = null; int count = 0; for (int i = firstGroupIndex; i < groups.length; ++i, ++count) { Group group = groups[i]; @@ -136,7 +136,7 @@ //ignoring how these are connected for now //if (current.isConnectedAfter(previous)) //break; - previous = current; + //previous = current; } if (count == 0) Modified: trunk/Jmol/src/org/jmol/viewer/StateManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/StateManager.java 2006-09-20 06:36:18 UTC (rev 5617) +++ trunk/Jmol/src/org/jmol/viewer/StateManager.java 2006-09-20 08:53:04 UTC (rev 5618) @@ -204,6 +204,8 @@ //file loading + boolean forceAutoBond; + char inlineNewlineChar = '|'; String defaultLoadScript = ""; Point3f ptDefaultLattice = new Point3f(); Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2006-09-20 06:36:18 UTC (rev 5617) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2006-09-20 08:53:04 UTC (rev 5618) @@ -1133,6 +1133,11 @@ // delegated to ModelManager // /////////////////////////////////////////////////////////////// + + public void calculateStructures() { + modelManager.calculateStructures(); + } + public void openClientFile(String fullPathName, String fileName, Object clientFile) { // maybe there needs to be a call to clear() @@ -2632,6 +2637,10 @@ setDisablePopupMenu(value); return; } + if (key.equalsIgnoreCase("forceAutoBond")) { + setForceAutoBond(value); + return; + } Logger.error("viewer.setBooleanProperty(" + key + "," + value + ") - unrecognized SET option"); scriptStatus("Script ERROR: unrecognized SET option: set " + key); @@ -2898,6 +2907,15 @@ return global.disablePopupMenu; } + void setForceAutoBond(boolean forceAutoBond) { + global.forceAutoBond = forceAutoBond; + } + + boolean getForceAutoBond() { + return global.forceAutoBond; + } + + // /////////////////////////////////////////////////////////////// // Frame // /////////////////////////////////////////////////////////////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |