From: <ha...@us...> - 2008-03-01 20:44:39
|
Revision: 9041 http://jmol.svn.sourceforge.net/jmol/?rev=9041&view=rev Author: hansonr Date: 2008-03-01 12:44:34 -0800 (Sat, 01 Mar 2008) Log Message: ----------- version=11.5.12_dev # new feature: three optional defaults for Van der Waals radii: # # set defaultVDW jmol # set defaultVDW rasmol # set defaultVDW babel # # For full state compatibility, these commands should be given prior to # model loading, as they affect all calculations involving Van der Waals # radii -- except default zoom. # # see src/org/jmol/_documents/vdw_comparison.xls Modified Paths: -------------- trunk/Jmol/src/org/jmol/modelset/AtomCollection.java trunk/Jmol/src/org/jmol/modelset/ModelCollection.java trunk/Jmol/src/org/jmol/popup/PopupResourceBundle.java trunk/Jmol/src/org/jmol/viewer/Eval.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/JmolConstants.java trunk/Jmol/src/org/jmol/viewer/Token.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/modelset/AtomCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/AtomCollection.java 2008-03-01 19:14:33 UTC (rev 9040) +++ trunk/Jmol/src/org/jmol/modelset/AtomCollection.java 2008-03-01 20:44:34 UTC (rev 9041) @@ -260,14 +260,18 @@ for (int i = atomCount; --i >= 0;) { Atom atom = atoms[i]; float distAtom = center.distance(atom); - float radiusVdw = atom.getVanderwaalsRadiusFloat(); - float outerVdw = distAtom + radiusVdw; + float outerVdw = distAtom + getRadiusVdwJmol(atom); if (outerVdw > maxRadius) maxRadius = outerVdw; } return (maxRadius == 0 ? 10 : maxRadius); } + protected float getRadiusVdwJmol(Atom atom) { + return JmolConstants.getVanderwaalsMar(atom.getElementNumber(), + JmolConstants.VDW_JMOL) / 1000f; + } + // the maximum BondingRadius seen in this set of atoms // used in autobonding protected float maxBondingRadius = Float.MIN_VALUE; Modified: trunk/Jmol/src/org/jmol/modelset/ModelCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelCollection.java 2008-03-01 19:14:33 UTC (rev 9040) +++ trunk/Jmol/src/org/jmol/modelset/ModelCollection.java 2008-03-01 20:44:34 UTC (rev 9041) @@ -348,8 +348,7 @@ if (bs.get(i)) { Atom atom = atoms[i]; float distAtom = center.distance(atom); - float radiusVdw = atom.getVanderwaalsRadiusFloat(); - float outerVdw = distAtom + radiusVdw; + float outerVdw = distAtom + getRadiusVdwJmol(atom); if (outerVdw > maxRadius) maxRadius = outerVdw; } Modified: trunk/Jmol/src/org/jmol/popup/PopupResourceBundle.java =================================================================== --- trunk/Jmol/src/org/jmol/popup/PopupResourceBundle.java 2008-03-01 19:14:33 UTC (rev 9040) +++ trunk/Jmol/src/org/jmol/popup/PopupResourceBundle.java 2008-03-01 20:44:34 UTC (rev 9041) @@ -710,7 +710,7 @@ "structure#PDB", GT._("Secondary Structure"), "chain#PDB", GT._("Chain"), "group#PDB", GT._("Group"), - "monomer#PDB", "Monomer", + "monomer#PDB", GT._("Monomer"), "shapely#PDB", "Shapely", "none", GT._("Inherit"), Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Eval.java 2008-03-01 19:14:33 UTC (rev 9040) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java 2008-03-01 20:44:34 UTC (rev 9041) @@ -6811,6 +6811,19 @@ setMeasurementUnits(stringSetting(2, isJmolSet)); return true; } + if (key.equalsIgnoreCase("defaultVDW")) { + String val; + if ((theTok = tokAt(2)) == Token.jmol || theTok == Token.rasmol || theTok == Token.babel) { + val = parameterAsString(2).toLowerCase(); + checkLength3(); + } else { + val = stringSetting(2, false).toLowerCase(); + } + if (!Parser.isOneOf(val, "jmol;rasmol;babel")) + invalidArgument(); + setStringProperty(key, val); + return true; + } if (Parser.isOneOf(lcKey, "defaults;defaultcolorscheme")) { String val; if ((theTok = tokAt(2)) == Token.jmol || theTok == Token.rasmol) { Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2008-03-01 19:14:33 UTC (rev 9040) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2008-03-01 20:44:34 UTC (rev 9041) @@ -1,16 +1,16 @@ version=11.5.12_dev -# new feature: three optional defaults for default Van der Waals radii: +# new feature: three optional defaults for Van der Waals radii: # -# set defaultVDW "jmol" -# set defaultVDW "rasmol" -# set defaultVDW "babel" +# set defaultVDW jmol +# set defaultVDW rasmol +# set defaultVDW babel # # For full state compatibility, these commands should be given prior to # model loading, as they affect all calculations involving Van der Waals -# radii -- including default zoom. +# radii -- except default zoom. # -# see src/_documents/vdw_comparison.xls +# see src/org/jmol/_documents/vdw_comparison.xls # ----------------------------------------------------------------------------- Modified: trunk/Jmol/src/org/jmol/viewer/JmolConstants.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2008-03-01 19:14:33 UTC (rev 9040) +++ trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2008-03-01 20:44:34 UTC (rev 9041) @@ -870,7 +870,17 @@ public final static int VDW_BABEL = 1; // OpenBabel-2.1.1 public final static int VDW_RASMOL = 2; // OpenRasmol-2.7.2.1.1 public final static int VDW_RESERVED = 3; + final static String[] vdwLabels = { + "Jmol", "Babel", "Rasmol", "Reserved" + }; + public static int getVdwType(String label) { + for (int i = 0; i < vdwLabels.length; i++) + if (vdwLabels[i].equalsIgnoreCase(label)) + return i; + return VDW_JMOL; + } + public static int getVanderwaalsMar(int i, int scale) { return vanderwaalsMars[(i << 2) + scale]; } @@ -881,8 +891,10 @@ * Used for spacefill rendering of atoms. * Values taken from OpenBabel. * @see <a href="http://openbabel.sourceforge.net">openbabel.sourceforge.net</a> + * @see <a href="http://jmol.svn.sourceforge.net/viewvc/jmol/trunk/Jmol/src/org/jmol/_documents/vdw_comparison.xls">vdw_comparison.xls</a> */ public final static short[] vanderwaalsMars = { + //Jmol,openBabel,openRasmol,reserved 1000,1000,1000,0, // XX 0 1200,1200,1100,0, // H 1 1400,1400,2200,0, // He 2 Modified: trunk/Jmol/src/org/jmol/viewer/Token.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Token.java 2008-03-01 19:14:33 UTC (rev 9040) +++ trunk/Jmol/src/org/jmol/viewer/Token.java 2008-03-01 20:44:34 UTC (rev 9041) @@ -857,6 +857,7 @@ final static int normal = misc | 4; final static int rasmol = misc | 5; final static int axisangle = misc | 6; + final static int babel = misc | 7; final static int clear = misc | 8; final static int mep = misc | 9; final static int torsion = misc | 10; @@ -1256,6 +1257,7 @@ "inherit", null, "normal", new Token(normal), "rasmol", new Token(rasmol), + "babel", new Token(babel), "torsion", new Token(torsion), "coord", new Token(coord), "coords", null, Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2008-03-01 19:14:33 UTC (rev 9040) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2008-03-01 20:44:34 UTC (rev 9041) @@ -6394,24 +6394,12 @@ } void setDefaultVdw(String mode) { - if (mode.equalsIgnoreCase("Babel")) - defaultVdw = JmolConstants.VDW_BABEL; - else if (mode.equalsIgnoreCase("RasMol")) - defaultVdw = JmolConstants.VDW_RASMOL; - else - defaultVdw = JmolConstants.VDW_JMOL; + defaultVdw = JmolConstants.getVdwType(mode); global.setParameterValue("defaultVDW", getDefaultVdw()); } String getDefaultVdw() { - switch(defaultVdw) { - case JmolConstants.VDW_BABEL: - return "Babel"; - case JmolConstants.VDW_RASMOL: - return "Rasmol"; - default: - return "Jmol"; - } + return JmolConstants.vdwLabels[defaultVdw]; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |