1 package org.jmol.viewer; 2 3 import java.util.Hashtable; 4 import java.util.Iterator; 5 import java.util.Map; 6 7 import javajs.util.DF; 8 import javajs.util.P3; 9 import javajs.util.PT; 10 import javajs.util.SB; 11 12 import org.jmol.c.CBK; 13 import org.jmol.c.STR; 14 import org.jmol.script.SV; 15 import org.jmol.script.T; 16 import org.jmol.util.Elements; 17 import org.jmol.util.Escape; 18 import org.jmol.util.Logger; 19 20 public class GlobalSettings { 21 22 private final Viewer vwr; 23 24 Map<String, Object> htNonbooleanParameterValues; 25 Map<String, Boolean> htBooleanParameterFlags; 26 Map<String, Boolean> htPropertyFlagsRemoved; 27 Map<String, SV> htUserVariables = new Hashtable<String, SV>(); 28 29 30 /* 31 * Mostly these are just saved and restored directly from Viewer. 32 * They are collected here for reference and to ensure that no 33 * methods are written that bypass vwr's get/set methods. 34 * 35 * Because these are not Frame variables, they (mostly) should persist past 36 * a new file loading. There is some question in my mind whether all 37 * should be in this category. 38 * 39 */ 40 GlobalSettings(Viewer vwr, GlobalSettings g, boolean clearUserVariables)41 GlobalSettings(Viewer vwr, GlobalSettings g, boolean clearUserVariables) { 42 this.vwr = vwr; 43 htNonbooleanParameterValues = new Hashtable<String, Object>(); 44 htBooleanParameterFlags = new Hashtable<String, Boolean>(); 45 htPropertyFlagsRemoved = new Hashtable<String, Boolean>(); 46 47 loadFormat = pdbLoadFormat = JC.databases.get("pdb"); 48 pdbLoadLigandFormat = JC.databases.get("ligand"); 49 nmrUrlFormat = JC.databases.get("nmr"); 50 nmrPredictFormat = JC.databases.get("nmrdb"); 51 pubChemFormat = JC.databases.get("pubchem"); 52 resolverResolver = JC.databases.get("resolverresolver"); 53 macroDirectory = JC.defaultMacroDirectory; 54 55 if (g != null) { 56 //persistent values not reset with the "initialize" command 57 if (!clearUserVariables) { 58 setO("_pngjFile", g.getParameter("_pngjFile", false)); 59 htUserVariables = g.htUserVariables; // 12.3.7, 12.2.7 60 } 61 62 63 debugScript = g.debugScript; 64 disablePopupMenu = g.disablePopupMenu; 65 messageStyleChime = g.messageStyleChime; 66 defaultDirectory = g.defaultDirectory; 67 autoplayMovie = g.autoplayMovie; 68 allowAudio = g.allowAudio; 69 allowGestures = g.allowGestures; 70 allowModelkit = g.allowModelkit; 71 allowMultiTouch = g.allowMultiTouch; 72 allowKeyStrokes = g.allowKeyStrokes; 73 legacyAutoBonding = g.legacyAutoBonding; 74 legacyHAddition = g.legacyHAddition; 75 legacyJavaFloat = g.legacyJavaFloat; 76 bondingVersion = g.bondingVersion; 77 platformSpeed = g.platformSpeed; 78 useScriptQueue = g.useScriptQueue; 79 //useArcBall = g.useArcBall; 80 showTiming = g.showTiming; 81 wireframeRotation = g.wireframeRotation; 82 testFlag1 = g.testFlag1; 83 testFlag2 = g.testFlag2; 84 testFlag3 = g.testFlag3; 85 testFlag4 = g.testFlag4; 86 87 nihResolverFormat = g.nihResolverFormat; 88 } 89 if (nihResolverFormat == null) 90 nihResolverFormat = JC.databases.get("nci"); 91 setCIR(nihResolverFormat); 92 // beyond these six, they are just in the form load =xxx/id 93 94 for (CBK item : CBK.values()) 95 resetValue(item.name() + "Callback", g); 96 97 // These next are just placeholders so that the math processor 98 // knows they are Jmol variables. They are held by other managers. 99 // This is NOT recommended, because it is easy to forget they are 100 // here and then not reset them properly. Basically it means that 101 // the other manager must ensure that the value changed there is 102 // updated here, AND when an initialization occurs, they remain in 103 // sync. This is difficult to manage and should be changed. 104 // The good news is that this manager is initialized FIRST, so 105 // we really just have to make sure that all these values are definitely 106 // also initialized within the managers. 107 108 setF("cameraDepth", TransformManager.DEFAULT_CAMERA_DEPTH); 109 setI("contextDepthMax", 100); // maintained by ScriptEval 110 setI("depth", 0); // maintained by TransformManager 111 setF("gestureSwipeFactor", ActionManager.DEFAULT_GESTURE_SWIPE_FACTOR); 112 setB("hideNotSelected", false); //maintained by the selectionManager 113 setI("historyLevel", 0); // maintained by ScriptEval 114 setO("hoverLabel", ""); // maintained by the Hover shape 115 setB("isKiosk", vwr.isKiosk()); // maintained by Viewer 116 setO("logFile", vwr.getLogFileName()); // maintained by Viewer 117 setI("logLevel", Logger.getLogLevel()); 118 setF("mouseWheelFactor", ActionManager.DEFAULT_MOUSE_WHEEL_FACTOR); 119 setF("mouseDragFactor", ActionManager.DEFAULT_MOUSE_DRAG_FACTOR); 120 setI("navFps", TransformManager.DEFAULT_NAV_FPS); 121 setI("navigationDepth", 0); // maintained by TransformManager 122 setI("navigationSlab", 0); // maintained by TransformManager 123 setI("navX", 0); // maintained by TransformManager 124 setI("navY", 0); // maintained by TransformManager 125 setI("navZ", 0); // maintained by TransformManager 126 setO("pathForAllFiles", ""); 127 setB("perspectiveDepth", TransformManager.DEFAULT_PERSPECTIVE_DEPTH); 128 setI("perspectiveModel", TransformManager.DEFAULT_PERSPECTIVE_MODEL); 129 setO("picking", "identify"); // maintained by ActionManager 130 setO("pickingStyle", "toggle"); // maintained by ActionManager 131 setB("refreshing", true); // maintained by Viewer 132 setI("rotationRadius", 0); // maintained by TransformManager 133 setI("scaleAngstromsPerInch", 0); // maintained by TransformManager 134 setI("scriptReportingLevel", 0); // maintained by ScriptEval 135 setB("selectionHalos", false); // maintained by ModelSet 136 setB("showaxes", false); // maintained by Axes 137 setB("showboundbox", false); // maintained by Bbcage 138 setB("showfrank", false); // maintained by Viewer 139 setB("showUnitcell", false); // maintained by Uccage 140 setI("slab", 100); // maintained by TransformManager 141 setB("slabEnabled", false); // maintained by TransformManager 142 setF("slabrange", 0f); // maintained by TransformManager 143 setI("spinX", 0); // maintained by TransformManager 144 setI("spinY", TransformManager.DEFAULT_SPIN_Y); 145 setI("spinZ", 0); // maintained by TransformManager 146 setI("spinFps", TransformManager.DEFAULT_SPIN_FPS); 147 setF("visualRange", TransformManager.DEFAULT_VISUAL_RANGE); 148 setI("stereoDegrees", TransformManager.DEFAULT_STEREO_DEGREES); 149 //setI("stateversion", 0); // only set by a saved state being recalled 150 setB("syncScript", vwr.sm.syncingScripts); 151 setB("syncMouse", vwr.sm.syncingMouse); 152 setB("syncStereo", vwr.sm.stereoSync); 153 setB("windowCentered", true); // maintained by TransformManager 154 setB("zoomEnabled", true); // maintained by TransformManager 155 156 // These next values have no other place than the global Hashtables. 157 // This just means that a call to vwr.getXxxxProperty() is necessary. 158 // Otherwise, it's the same as if they had a global variable. 159 // It's just an issue of speed of access. Generally, these should only be 160 // accessed by the user. 161 162 setI("_version", JC.versionInt); 163 setO("_versionDate", Viewer.getJmolVersion()); 164 165 setB("axesWindow", true); 166 setB("axesMolecular", false); 167 setB("axesPosition", false); 168 setB("axesUnitcell", false); 169 setI("backgroundModel", 0); 170 setB("colorRasmol", false); 171 setO("currentLocalPath", ""); 172 setO("defaultLattice", "{0 0 0}"); 173 setO("defaultColorScheme", "Jmol"); 174 setO("defaultDirectoryLocal", ""); 175 setO("defaults", "Jmol"); 176 setO("defaultVDW", "Jmol"); 177 setO("exportDrivers", JC.EXPORT_DRIVER_LIST); 178 setI("propertyAtomNumberColumnCount", 0); 179 setI("propertyAtomNumberField", 0); 180 setI("propertyDataColumnCount", 0); 181 setI("propertyDataField", 0); 182 setB("undo", true); 183 184 // OK, all of the rest of these are maintained here as global values (below) 185 186 setB("allowEmbeddedScripts", allowEmbeddedScripts); 187 setB("allowGestures", allowGestures); 188 setB("allowKeyStrokes", allowKeyStrokes); 189 setB("allowModelkit", allowModelkit); 190 setB("allowMultiTouch", allowMultiTouch); 191 setB("allowRotateSelected", allowRotateSelected); 192 setB("allowMoveAtoms", allowMoveAtoms); 193 setI("animationFps", animationFps); 194 setB("antialiasImages", antialiasImages); 195 setB("antialiasDisplay", antialiasDisplay); 196 setB("antialiasTranslucent", antialiasTranslucent); 197 setB("appendNew", appendNew); 198 setO("appletProxy", appletProxy); 199 setB("applySymmetryToBonds", applySymmetryToBonds); 200 setB("atomPicking", atomPicking); 201 setO("atomTypes", atomTypes); 202 setB("autoBond", autoBond); 203 setB("autoFps", autoFps); 204 // setParameterValue("autoLoadOrientation", autoLoadOrientation); 205 setI("axesMode", axesMode == T.axesunitcell ? 2 206 : axesMode == T.axesmolecular ? 1 : 0); 207 setF("axesScale", axesScale); 208 setF("axesOffset", axesOffset); 209 setB("axesOrientationRasmol", axesOrientationRasmol); 210 setF("cartoonBlockHeight", cartoonBlockHeight); 211 setB("cartoonBlocks", cartoonBlocks); 212 setB("cartoonSteps", cartoonSteps); 213 setB("bondModeOr", bondModeOr); 214 setB("bondPicking", bondPicking); 215 setI("bondRadiusMilliAngstroms", bondRadiusMilliAngstroms); 216 setF("bondTolerance", bondTolerance); 217 setB("cartoonBaseEdges", cartoonBaseEdges); 218 setB("cartoonFancy", cartoonFancy); 219 setB("cartoonLadders", cartoonLadders); 220 setB("cartoonLadders", cartoonRibose); 221 setB("cartoonRockets", cartoonRockets); 222 setB("chainCaseSensitive", chainCaseSensitive); 223 setB("cipRule6Full", cipRule6Full); 224 setI("bondingVersion", bondingVersion); 225 setO("dataSeparator", dataSeparator); 226 setB("debugScript", debugScript); 227 setO("defaultAngleLabel", defaultAngleLabel); 228 setF("defaultDrawArrowScale", defaultDrawArrowScale); 229 setO("defaultDirectory", defaultDirectory); 230 setO("defaultDistanceLabel", defaultDistanceLabel); 231 setO("defaultDropScript", defaultDropScript); 232 setO("defaultLabelPDB", defaultLabelPDB); 233 setO("defaultLabelXYZ", defaultLabelXYZ); 234 setO("defaultLoadFilter", defaultLoadFilter); 235 setO("defaultLoadScript", defaultLoadScript); 236 setB("defaultStructureDSSP", defaultStructureDSSP); 237 setO("defaultTorsionLabel", defaultTorsionLabel); 238 setF("defaultTranslucent", defaultTranslucent); 239 setI("delayMaximumMs", delayMaximumMs); 240 setF("dipoleScale", dipoleScale); 241 setB("disablePopupMenu", disablePopupMenu); 242 setB("displayCellParameters", displayCellParameters); 243 setI("dotDensity", dotDensity); 244 setI("dotScale", dotScale); 245 setB("dotsSelectedOnly", dotsSelectedOnly); 246 setB("dotSurface", dotSurface); 247 setB("dragSelected", dragSelected); 248 setB("drawHover", drawHover); 249 setF("drawFontSize", drawFontSize); 250 setB("drawPicking", drawPicking); 251 setB("dsspCalculateHydrogenAlways", dsspCalcHydrogen); 252 // setO("edsUrlFormat", edsUrlFormat); 253 // setO("edsUrlFormatDiff", edsUrlFormatDiff); 254 // //setParameterValue("edsUrlOptions", edsUrlOptions); 255 // setO("edsUrlCutoff", edsUrlCutoff); 256 setB("ellipsoidArcs", ellipsoidArcs); 257 setB("ellipsoidArrows", ellipsoidArrows); 258 setB("ellipsoidAxes", ellipsoidAxes); 259 setF("ellipsoidAxisDiameter", ellipsoidAxisDiameter); 260 setB("ellipsoidBall", ellipsoidBall); 261 setI("ellipsoidDotCount", ellipsoidDotCount); 262 setB("ellipsoidDots", ellipsoidDots); 263 setB("ellipsoidFill", ellipsoidFill); 264 setO("energyUnits", energyUnits); 265 // setParameterValue("_fileCaching", _fileCaching); 266 // setParameterValue("_fileCache", _fileCache); 267 setF("exportScale", exportScale); 268 setB("fontScaling", fontScaling); 269 setB("fontCaching", fontCaching); 270 setB("forceAutoBond", forceAutoBond); 271 setO("forceField", forceField); 272 setB("fractionalRelative", fractionalRelative); 273 setF("particleRadius", particleRadius); 274 setB("greyscaleRendering", greyscaleRendering); 275 setF("hbondsAngleMinimum", hbondsAngleMinimum); 276 setF("hbondHXDistanceMaximum", hbondHXDistanceMaximum); 277 setF("hbondsDistanceMaximum", hbondNODistanceMaximum); 278 setB("hbondsBackbone", hbondsBackbone); 279 setB("hbondsRasmol", hbondsRasmol); 280 setB("hbondsSolid", hbondsSolid); 281 setI("helixStep", helixStep); 282 setO("helpPath", helpPath); 283 setI("hermiteLevel", hermiteLevel); 284 setB("hideNameInPopup", hideNameInPopup); 285 setB("hideNavigationPoint", hideNavigationPoint); 286 setB("hiddenLinesDashed", hiddenLinesDashed); 287 setB("highResolution", highResolutionFlag); 288 setF("hoverDelay", hoverDelayMs / 1000f); 289 setB("imageState", imageState); 290 setI("infoFontSize", infoFontSize); 291 setB("isosurfaceKey", isosurfaceKey); 292 setB("isosurfacePropertySmoothing", isosurfacePropertySmoothing); 293 setI("isosurfacePropertySmoothingPower", isosurfacePropertySmoothingPower); 294 setB("jmolInJSpecView", jmolInJSpecView); 295 setB("justifyMeasurements", justifyMeasurements); 296 setB("legacyAutoBonding", legacyAutoBonding); 297 setB("legacyHAddition", legacyHAddition); 298 setB("legacyJavaFloat", legacyJavaFloat); 299 setF("loadAtomDataTolerance", loadAtomDataTolerance); 300 setO("loadFormat", loadFormat); 301 setO("loadLigandFormat", pdbLoadLigandFormat); 302 setB("logCommands", logCommands); 303 setB("logGestures", logGestures); 304 setB("measureAllModels", measureAllModels); 305 setB("measurementLabels", measurementLabels); 306 setO("measurementUnits", measureDistanceUnits); 307 setI("meshScale", meshScale); 308 setB("messageStyleChime", messageStyleChime); 309 setF("minBondDistance", minBondDistance); 310 setI("minPixelSelRadius", minPixelSelRadius); 311 setI("minimizationSteps", minimizationSteps); 312 setB("minimizationRefresh", minimizationRefresh); 313 setB("minimizationSilent", minimizationSilent); 314 setF("minimizationCriterion", minimizationCriterion); 315 setB("modelKitMode", modelKitMode); 316 setF("modulationScale", modulationScale); 317 setB("monitorEnergy", monitorEnergy); 318 setF("multipleBondRadiusFactor", multipleBondRadiusFactor); 319 setB("multipleBondBananas", multipleBondBananas); 320 setF("multipleBondSpacing", multipleBondSpacing); 321 setB("multiProcessor", multiProcessor && (Viewer.nProcessors > 1)); 322 setB("navigationMode", navigationMode); 323 //setParamB("navigateSurface", navigateSurface); 324 setB("navigationPeriodic", navigationPeriodic); 325 setF("navigationSpeed", navigationSpeed); 326 setB("nboCharges", nboCharges); 327 setB("noDelay", noDelay); 328 setO("nmrPredictFormat", nmrPredictFormat); 329 setO("nmrUrlFormat", nmrUrlFormat); 330 setB("partialDots", partialDots); 331 setB("pdbAddHydrogens", pdbAddHydrogens); // new 12.1.51 332 setB("pdbGetHeader", pdbGetHeader); // new 11.5.39 333 setB("pdbSequential", pdbSequential); // new 11.5.39 334 setI("percentVdwAtom", percentVdwAtom); 335 setI("pickingSpinRate", pickingSpinRate); 336 setO("pickLabel", pickLabel); 337 setI("platformSpeed", platformSpeed); 338 setF("pointGroupLinearTolerance", pointGroupLinearTolerance); 339 setF("pointGroupDistanceTolerance", pointGroupDistanceTolerance); 340 setB("preserveState", preserveState); 341 setO("propertyColorScheme", propertyColorScheme); 342 setO("quaternionFrame", quaternionFrame); 343 setB("rangeSelected", rangeSelected); 344 setI("repaintWaitMs", repaintWaitMs); 345 setI("ribbonAspectRatio", ribbonAspectRatio); 346 setB("ribbonBorder", ribbonBorder); 347 setB("rocketBarrels", rocketBarrels); 348 setB("saveProteinStructureState", saveProteinStructureState); 349 setB("scriptqueue", useScriptQueue); 350 setB("selectAllModels", selectAllModels); 351 setB("selectHetero", rasmolHeteroSetting); 352 setB("selectHydrogen", rasmolHydrogenSetting); 353 setF("sheetSmoothing", sheetSmoothing); 354 setB("showHiddenSelectionHalos", showHiddenSelectionHalos); 355 setB("showHydrogens", showHydrogens); 356 setB("showKeyStrokes", showKeyStrokes); 357 setB("showMeasurements", showMeasurements); 358 setB("showModulationVectors", showModVecs); 359 setB("showMultipleBonds", showMultipleBonds); 360 setB("showNavigationPointAlways", showNavigationPointAlways); 361 setI("showScript", scriptDelay); 362 setB("showtiming", showTiming); 363 setB("slabByMolecule", slabByMolecule); 364 setB("slabByAtom", slabByAtom); 365 setB("smartAromatic", smartAromatic); 366 setI("minimizationMaxAtoms", minimizationMaxAtoms); 367 setI("smallMoleculeMaxAtoms", smallMoleculeMaxAtoms); 368 setO("smilesUrlFormat", smilesUrlFormat); 369 setO("macroDirectory", macroDirectory); 370 setO("nihResolverFormat", nihResolverFormat); 371 setO("pubChemFormat", pubChemFormat); 372 setB("showUnitCellDetails", showUnitCellDetails); 373 setB("solventProbe", dotSolvent); 374 setF("solventProbeRadius", solventProbeRadius); 375 setB("ssbondsBackbone", ssbondsBackbone); 376 setF("starWidth", starWidth); 377 setB("statusReporting", statusReporting); 378 setI("strandCount", strandCountForStrands); 379 setI("strandCountForStrands", strandCountForStrands); 380 setI("strandCountForMeshRibbon", strandCountForMeshRibbon); 381 setF("strutDefaultRadius", strutDefaultRadius); 382 setF("strutLengthMaximum", strutLengthMaximum); 383 setI("strutSpacing", strutSpacing); 384 setB("strutsMultiple", strutsMultiple); 385 setB("testFlag1", testFlag1); 386 setB("testFlag2", testFlag2); 387 setB("testFlag3", testFlag3); 388 setB("testFlag4", testFlag4); 389 setB("traceAlpha", traceAlpha); 390 setB("translucent", translucent); 391 setB("twistedSheets", twistedSheets); 392 //setB("useArcBall", useArcBall); 393 setB("useMinimizationThread", useMinimizationThread); 394 setB("useNumberLocalization", useNumberLocalization); 395 setB("vectorsCentered", vectorsCentered); 396 setF("vectorScale", vectorScale); 397 setB("vectorSymmetry", vectorSymmetry); 398 setI("vectorTrail", vectorTrail); 399 setF("vibrationPeriod", vibrationPeriod); 400 setF("vibrationScale", vibrationScale); 401 setB("waitForMoveTo", waitForMoveTo); 402 setB("wireframeRotation", wireframeRotation); 403 setI("zDepth", zDepth); 404 setB("zeroBasedXyzRasmol", zeroBasedXyzRasmol); 405 setB("zoomHeight", zoomHeight); 406 setB("zoomLarge", zoomLarge); 407 setI("zShadePower", zShadePower); 408 setI("zSlab", zSlab); 409 } 410 clear()411 void clear() { 412 Iterator<String> e = htUserVariables.keySet().iterator(); 413 while (e.hasNext()) { 414 String key = e.next(); 415 if (key.charAt(0) == '@' || key.startsWith("site_")) 416 e.remove(); 417 } 418 419 // PER-zap settings made 420 vwr.setPicked(-1, false); 421 setI("_atomhovered", -1); 422 setO("_pickinfo", ""); 423 setB("selectionhalos", false); 424 setB("hidenotselected", false); // to synchronize with selectionManager 425 setB("measurementlabels", measurementLabels = true); 426 setB("drawHover", drawHover = false); 427 vwr.stm.saveScene("DELETE", null); 428 } 429 430 int zDepth = 0; 431 int zShadePower = 3; // increased to 3 from 1 for Jmol 12.1.49 432 int zSlab = 50; // increased to 50 from 0 in Jmol 12.3.6 and Jmol 12.2.6 433 434 boolean slabByMolecule = false; 435 boolean slabByAtom = false; 436 437 //file loading 438 439 boolean allowEmbeddedScripts = true; 440 public boolean appendNew = true; 441 String appletProxy = ""; 442 boolean applySymmetryToBonds = false; //new 11.1.29 443 String atomTypes = ""; 444 boolean autoBond = true; 445 // boolean autoLoadOrientation = false; // 11.7.30 for Spartan and Sygress/CAChe loading with or without rotation 446 // starting with Jmol 12.0.RC10, this setting is ignored, and FILTER "NoOrient" is required if the file 447 // is to be loaded without reference to the orientation saved in the file. 448 boolean axesOrientationRasmol = false; 449 short bondRadiusMilliAngstroms = JC.DEFAULT_BOND_MILLIANGSTROM_RADIUS; 450 float bondTolerance = JC.DEFAULT_BOND_TOLERANCE; 451 String defaultDirectory = ""; 452 boolean defaultStructureDSSP = true; // Jmol 12.1.15 453 final P3 ptDefaultLattice = new P3(); 454 public String defaultLoadScript = ""; 455 public String defaultLoadFilter = ""; 456 public String defaultDropScript = JC.DEFAULT_DRAG_DROP_SCRIPT; 457 // boolean _fileCaching = false; 458 // String _fileCache = ""; 459 boolean forceAutoBond = false; 460 boolean fractionalRelative = true;// true: {1/2 1/2 1/2} relative to current (possibly offset) unit cell 461 char inlineNewlineChar = '|'; //pseudo static 462 String loadFormat, pdbLoadFormat, pdbLoadLigandFormat, 463 nmrUrlFormat, nmrPredictFormat, smilesUrlFormat, nihResolverFormat, 464 pubChemFormat, macroDirectory, resolverResolver; 465 boolean checkCIR = false; 466 467 // String edsUrlFormat = "http://eds.bmc.uu.se/eds/dfs/%c2%c3/%file/%file.omap"; 468 // String edsUrlFormatDiff = "http://eds.bmc.uu.se/eds/dfs/%c2%c3/%file/%file_diff.omap"; 469 // String edsUrlCutoff = "http://eds.bmc.uu.se/eds/dfs/%c2%c3/%file/%file.sfdat"; 470 // not implemented String edsUrlOptions = "within 2.0 {*}"; 471 float minBondDistance = JC.DEFAULT_MIN_BOND_DISTANCE; 472 int minPixelSelRadius = 6; 473 boolean pdbAddHydrogens = false; // true to add hydrogen atoms 474 boolean pdbGetHeader = false; // true to get PDB header in auxiliary info 475 boolean pdbSequential = false; // true for no bonding check 476 int percentVdwAtom = JC.DEFAULT_PERCENT_VDW_ATOM; 477 int smallMoleculeMaxAtoms = 40000; 478 int minimizationMaxAtoms = 200; 479 boolean smartAromatic = true; 480 boolean zeroBasedXyzRasmol = false; 481 boolean legacyAutoBonding = false; 482 public boolean legacyHAddition = false; 483 public boolean legacyJavaFloat = false; // float/double issue with crystallographic symmetry before Jmol 14.2.5 484 boolean jmolInJSpecView = true; 485 486 boolean modulateOccupancy = true; 487 488 //centering and perspective 489 490 boolean allowRotateSelected = false; 491 boolean allowMoveAtoms = false; 492 493 //solvent for DOTS only 494 495 boolean dotSolvent = false; 496 497 //measurements 498 499 String defaultAngleLabel = "%VALUE %UNITS"; 500 String defaultDistanceLabel = "%VALUE %UNITS"; //also %_ and %a1 %a2 %m1 %m2, etc. 501 String defaultTorsionLabel = "%VALUE %UNITS"; 502 boolean justifyMeasurements = false; 503 boolean measureAllModels = false; 504 505 // minimization // 11.5.21 03/2008 506 507 int minimizationSteps = 100; 508 boolean minimizationRefresh = true; 509 boolean minimizationSilent = false; 510 float minimizationCriterion = 0.001f; 511 512 //rendering 513 514 int infoFontSize = 20; 515 boolean antialiasDisplay = false; 516 boolean antialiasImages = true; 517 boolean imageState = true; 518 boolean antialiasTranslucent = true; 519 boolean displayCellParameters = true; 520 boolean dotsSelectedOnly = false; 521 boolean dotSurface = true; 522 int dotDensity = 3; 523 int dotScale = 1; 524 int meshScale = 1; 525 boolean greyscaleRendering = false; 526 boolean isosurfaceKey = false; 527 boolean isosurfacePropertySmoothing = true; 528 int isosurfacePropertySmoothingPower = 7; 529 int platformSpeed = 10; // 1 (slow) to 10 (fast) 530 public int repaintWaitMs = 1000; 531 boolean showHiddenSelectionHalos = false; 532 boolean showKeyStrokes = true; 533 boolean showMeasurements = true; 534 public boolean showTiming = false; 535 boolean zoomLarge = true; //false would be like Chime 536 boolean zoomHeight = false; // true would be like PyMOL 537 String backgroundImageFileName; 538 539 //atoms and bonds 540 541 boolean partialDots = false; 542 boolean bondModeOr = false; 543 boolean hbondsBackbone = false; 544 float hbondsAngleMinimum = 90f; 545 float hbondNODistanceMaximum = 3.25f; // O----N 546 float hbondHXDistanceMaximum = 2.5f; // O--H 547 boolean hbondsRasmol = true; // 12.0.RC3 548 boolean hbondsSolid = false; 549 public byte modeMultipleBond = JC.MULTIBOND_NOTSMALL; 550 boolean showHydrogens = true; 551 boolean showMultipleBonds = true; 552 boolean ssbondsBackbone = false; 553 float multipleBondSpacing = -1; // 0.35? 554 float multipleBondRadiusFactor = 0; // 0.75? 555 boolean multipleBondBananas = false; 556 boolean nboCharges = true; 557 558 //secondary structure + Rasmol 559 560 boolean cartoonBaseEdges = false; 561 boolean cartoonRockets = false; 562 float cartoonBlockHeight = 0.5f; 563 boolean cartoonBlocks = false; 564 boolean cartoonSteps = false; 565 boolean cartoonFancy = false; 566 boolean cartoonLadders = false; 567 boolean cartoonRibose = false; 568 boolean chainCaseSensitive = false; 569 boolean cipRule6Full = false; 570 int hermiteLevel = 0; 571 boolean highResolutionFlag = false; 572 public boolean rangeSelected = false; 573 boolean rasmolHydrogenSetting = true; 574 boolean rasmolHeteroSetting = true; 575 int ribbonAspectRatio = 16; 576 boolean ribbonBorder = false; 577 boolean rocketBarrels = false; 578 float sheetSmoothing = 1; // 0: traceAlpha on alphas for helix, 1 on midpoints 579 boolean traceAlpha = true; 580 boolean translucent = true; 581 boolean twistedSheets = false; 582 583 //misc 584 585 boolean autoplayMovie = true; 586 boolean allowAudio = true; // once turned off, cannot be turned back on 587 boolean allowGestures = false; 588 boolean allowModelkit = true; 589 boolean allowMultiTouch = true; // but you still need to set the parameter multiTouchSparshUI=true 590 boolean allowKeyStrokes = false; 591 592 boolean hiddenLinesDashed = false; 593 594 int animationFps = 10; 595 boolean atomPicking = true; 596 boolean autoFps = false; 597 public int axesMode = T.axeswindow; 598 float axesScale = 2; 599 float axesOffset = 0; 600 float starWidth = 0.05f; 601 boolean bondPicking = false; 602 String dataSeparator = "~~~"; 603 boolean debugScript = false; 604 float defaultDrawArrowScale = 0.5f; 605 String defaultLabelXYZ = "%a"; 606 String defaultLabelPDB = "%m%r"; 607 float defaultTranslucent = 0.5f; 608 int delayMaximumMs = 0; 609 float dipoleScale = 1f; 610 float drawFontSize = 14f; 611 boolean disablePopupMenu = false; 612 boolean dragSelected = false; 613 boolean drawHover = false; 614 boolean drawPicking = false; 615 boolean dsspCalcHydrogen = true; 616 public String energyUnits = "kJ"; 617 float exportScale = 0f; 618 String helpPath = JC.DEFAULT_HELP_PATH; 619 boolean fontScaling = false; 620 boolean fontCaching = true; 621 String forceField = "MMFF"; 622 int helixStep = 1; 623 boolean hideNameInPopup = false; 624 int hoverDelayMs = 500; 625 float loadAtomDataTolerance = 0.01f; 626 public boolean logCommands = false; 627 public boolean logGestures = false; 628 public String measureDistanceUnits = "nanometers"; 629 boolean measurementLabels = true; 630 boolean messageStyleChime = false; 631 boolean monitorEnergy = false; 632 public float modulationScale = 1; 633 boolean multiProcessor = true; 634 float particleRadius = 20; 635 int pickingSpinRate = 10; 636 String pickLabel = ""; 637 float pointGroupDistanceTolerance = 0.2f; 638 float pointGroupLinearTolerance = 8.0f; 639 public boolean preserveState = true; 640 String propertyColorScheme = "roygb"; 641 String quaternionFrame = "p"; // was c prior to Jmol 11.7.47 642 boolean saveProteinStructureState = true; 643 boolean showModVecs = false; 644 boolean showUnitCellDetails = true; 645 float solventProbeRadius = 1.2f; 646 int scriptDelay = 0; 647 boolean selectAllModels = true; 648 boolean statusReporting = true; 649 int strandCountForStrands = 5; 650 int strandCountForMeshRibbon = 7; 651 int strutSpacing = 6; 652 float strutLengthMaximum = 7.0f; 653 float strutDefaultRadius = JC.DEFAULT_STRUT_RADIUS; 654 boolean strutsMultiple = false; //on a single position 655 //boolean useArcBall = false; 656 boolean useMinimizationThread = true; 657 boolean useNumberLocalization = true; 658 public boolean useScriptQueue = true; 659 public boolean waitForMoveTo = true; // Jmol 11.9.24 660 /** 661 * 662 * ensures that ScriptManager.allowJSThreads is false 663 * so that ScriptManager.useThreads() returns false; 664 * 665 * Jmol 14.21.1 666 * 667 */ 668 public boolean noDelay = false; 669 float vectorScale = 1f; 670 boolean vectorSymmetry = false; // Jmol 12.3.2 671 boolean vectorsCentered = false; // Jmol 14.1.14 672 int vectorTrail = 0; // Jmol 14.4.4 673 float vibrationPeriod = 1f; 674 float vibrationScale = 1f; 675 boolean wireframeRotation = false; 676 677 // window 678 679 boolean hideNavigationPoint = false; 680 boolean navigationMode = false; 681 //boolean navigateSurface = false; 682 boolean navigationPeriodic = false; 683 float navigationSpeed = 5; 684 boolean showNavigationPointAlways = false; 685 String stereoState = null; 686 boolean modelKitMode = false; 687 688 // special persistent object characteristics -- bbcage, uccage, axes: 689 690 int[] objColors = new int[StateManager.OBJ_MAX]; 691 boolean[] objStateOn = new boolean[StateManager.OBJ_MAX]; 692 int[] objMad10 = new int[StateManager.OBJ_MAX]; 693 694 boolean ellipsoidAxes = false; 695 boolean ellipsoidDots = false; 696 boolean ellipsoidArcs = false; 697 boolean ellipsoidArrows = false; 698 boolean ellipsoidFill = false; 699 boolean ellipsoidBall = true; 700 701 int ellipsoidDotCount = 200; 702 float ellipsoidAxisDiameter = 0.02f; 703 704 //testing 705 706 boolean testFlag1 = false; 707 boolean testFlag2 = false; 708 boolean testFlag3 = false; 709 boolean testFlag4 = false; 710 711 //controlled access: 712 setUnits(String units)713 void setUnits(String units) { 714 String mu = measureDistanceUnits; 715 String eu = energyUnits; 716 if (units.equalsIgnoreCase("angstroms")) 717 measureDistanceUnits = "angstroms"; 718 else if (units.equalsIgnoreCase("nanometers") 719 || units.equalsIgnoreCase("nm")) 720 measureDistanceUnits = "nanometers"; 721 else if (units.equalsIgnoreCase("picometers") 722 || units.equalsIgnoreCase("pm")) 723 measureDistanceUnits = "picometers"; 724 else if (units.equalsIgnoreCase("bohr") || units.equalsIgnoreCase("au")) 725 measureDistanceUnits = "au"; 726 else if (units.equalsIgnoreCase("vanderwaals") 727 || units.equalsIgnoreCase("vdw")) 728 measureDistanceUnits = "vdw"; 729 else if (units.toLowerCase().endsWith("hz") 730 || units.toLowerCase().endsWith("khz")) 731 measureDistanceUnits = units.toLowerCase(); 732 else if (units.equalsIgnoreCase("kj")) 733 energyUnits = "kJ"; 734 else if (units.equalsIgnoreCase("kcal")) 735 energyUnits = "kcal"; 736 if (!mu.equalsIgnoreCase(measureDistanceUnits)) 737 setO("measurementUnits", measureDistanceUnits); 738 else if (!eu.equalsIgnoreCase(energyUnits)) 739 setO("energyUnits", energyUnits); 740 } 741 isJmolVariable(String key)742 boolean isJmolVariable(String key) { 743 return key.charAt(0) == '_' 744 || htNonbooleanParameterValues.containsKey(key = key.toLowerCase()) 745 || htBooleanParameterFlags.containsKey(key) 746 || unreportedProperties.indexOf(";" + key + ";") >= 0; 747 } 748 resetValue(String name, GlobalSettings g)749 private void resetValue(String name, GlobalSettings g) { 750 setO(name, g == null ? "" : (String) g.getParameter(name, true)); 751 } 752 setB(String name, boolean value)753 public void setB(String name, boolean value) { 754 name = name.toLowerCase(); 755 if (htNonbooleanParameterValues.containsKey(name)) 756 return; // don't allow setting boolean of a numeric 757 htBooleanParameterFlags.put(name, value ? Boolean.TRUE : Boolean.FALSE); 758 } 759 setI(String name, int value)760 void setI(String name, int value) { 761 if (value != Integer.MAX_VALUE) 762 setO(name, Integer.valueOf(value)); 763 } 764 setF(String name, float value)765 public void setF(String name, float value) { 766 if (!Float.isNaN(value)) 767 setO(name, Float.valueOf(value)); 768 } 769 setO(String name, Object value)770 public void setO(String name, Object value) { 771 name = name.toLowerCase(); 772 if (value == null || htBooleanParameterFlags.containsKey(name)) 773 return; // don't allow setting string of a boolean 774 htNonbooleanParameterValues.put(name, value); 775 } 776 removeParam(String key)777 public void removeParam(String key) { 778 // used by resetError to remove _errorMessage 779 // used by setSmilesString to remove _smilesString 780 // used by setAxesModeMolecular to remove axesUnitCell 781 // and either axesWindow or axesMolecular 782 // used by setAxesModeUnitCell to remove axesMolecular 783 // and either remove axesWindow or axesUnitCell 784 785 key = key.toLowerCase(); 786 if (htBooleanParameterFlags.containsKey(key)) { 787 htBooleanParameterFlags.remove(key); 788 if (!htPropertyFlagsRemoved.containsKey(key)) 789 htPropertyFlagsRemoved.put(key, Boolean.FALSE); 790 return; 791 } 792 if (htNonbooleanParameterValues.containsKey(key)) 793 htNonbooleanParameterValues.remove(key); 794 } 795 setUserVariable(String key, SV var)796 public SV setUserVariable(String key, SV var) { 797 if (var != null) { 798 key = key.toLowerCase(); 799 htUserVariables.put(key, var.setName(key)); 800 } 801 return var; 802 } 803 unsetUserVariable(String key)804 void unsetUserVariable(String key) { 805 if (key.equals("all") || key.equals("variables")) { 806 htUserVariables.clear(); 807 Logger.info("all user-defined variables deleted"); 808 } else if (htUserVariables.containsKey(key)) { 809 Logger.info("variable " + key + " deleted"); 810 htUserVariables.remove(key); 811 } 812 } 813 removeUserVariable(String key)814 void removeUserVariable(String key) { 815 htUserVariables.remove(key); 816 } 817 getUserVariable(String name)818 SV getUserVariable(String name) { 819 if (name == null) 820 return null; 821 name = name.toLowerCase(); 822 return htUserVariables.get(name); 823 } 824 getParameterEscaped(String name, int nMax)825 String getParameterEscaped(String name, int nMax) { 826 name = name.toLowerCase(); 827 if (htNonbooleanParameterValues.containsKey(name)) { 828 Object v = htNonbooleanParameterValues.get(name); 829 return StateManager.varClip(name, Escape.e(v), nMax); 830 } 831 if (htBooleanParameterFlags.containsKey(name)) 832 return htBooleanParameterFlags.get(name).toString(); 833 if (htUserVariables.containsKey(name)) 834 return htUserVariables.get(name).escape(); 835 if (htPropertyFlagsRemoved.containsKey(name)) 836 return "false"; 837 return "<not defined>"; 838 } 839 840 /** 841 * 842 * strictly a getter 843 * 844 * @param name 845 * @param nullAsString 846 * returns "" if not found 847 * @return a Integer, Float, String, BitSet, or Variable, or null 848 */ getParameter(String name, boolean nullAsString)849 Object getParameter(String name, boolean nullAsString) { 850 Object v = getParam(name, false); 851 return (v == null && nullAsString ? "" : v); 852 } 853 854 /** 855 * 856 * 857 * @param name 858 * @param doSet 859 * @return a new variable if possible, but null if "_xxx" 860 * 861 */ getAndSetNewVariable(String name, boolean doSet)862 public SV getAndSetNewVariable(String name, boolean doSet) { 863 if (name == null || name.length() == 0) 864 name = "x"; 865 Object v = getParam(name, true); 866 return (v == null && doSet && name.charAt(0) != '_' ? setUserVariable(name, 867 SV.newV(T.string, "")) : SV.getVariable(v)); 868 } 869 getParam(String name, boolean asVariable)870 Object getParam(String name, boolean asVariable) { 871 name = name.toLowerCase(); 872 if (name.equals("_memory")) { 873 float bTotal = 0; 874 float bFree = 0; 875 /** 876 * @j2sIgnore 877 * 878 */ 879 { 880 Runtime runtime = Runtime.getRuntime(); 881 bTotal = runtime.totalMemory() / 1000000f; 882 bFree = runtime.freeMemory() / 1000000f; 883 } 884 String value = DF.formatDecimal(bTotal - bFree, 1) + "/" 885 + DF.formatDecimal(bTotal, 1); 886 htNonbooleanParameterValues.put("_memory", value); 887 } 888 if (htNonbooleanParameterValues.containsKey(name)) 889 return htNonbooleanParameterValues.get(name); 890 if (htBooleanParameterFlags.containsKey(name)) 891 return htBooleanParameterFlags.get(name); 892 if (htPropertyFlagsRemoved.containsKey(name)) 893 return Boolean.FALSE; 894 if (htUserVariables.containsKey(name)) { 895 SV v = htUserVariables.get(name); 896 return (asVariable ? v : SV.oValue(v)); 897 } 898 return null; 899 } 900 getVariableList()901 public String getVariableList() { 902 return StateManager.getVariableList(htUserVariables, 0, true, false); 903 } 904 905 // static because we don't plan to be changing these 906 Map<STR, float[]> structureList = new Hashtable<STR, float[]>(); 907 908 { structureList.put(STR.TURN, new float[] { 30, 90, -15, 95, })909 structureList.put(STR.TURN, new float[] { // turn 910 30, 90, -15, 95, }); structureList.put(STR.SHEET, new float[] { -180, -10, 70, 180, -180, -45, -180, -130, 140, 180, 90, 180, })911 structureList.put(STR.SHEET, new float[] { // sheet 912 -180, -10, 70, 180, -180, -45, -180, -130, 140, 180, 90, 180, }); structureList.put(STR.HELIX, new float[] { -160, 0, -100, 45, })913 structureList.put(STR.HELIX, new float[] { // helix 914 -160, 0, -100, 45, }); 915 } 916 917 boolean haveSetStructureList; 918 // private String[] userDatabases; 919 920 public int bondingVersion = Elements.RAD_COV_IONIC_OB1_100_1; 921 setStructureList(float[] list, STR type)922 public void setStructureList(float[] list, STR type) { 923 haveSetStructureList = true; 924 structureList.put(type, list); 925 } 926 getStructureList()927 public Map<STR, float[]> getStructureList() { 928 return structureList; 929 } 930 doReportProperty(String name)931 static boolean doReportProperty(String name) { 932 return (name.charAt(0) != '_' && unreportedProperties.indexOf(";" + name 933 + ";") < 0); 934 } 935 936 final private static String unreportedProperties = 937 //these are handled individually in terms of reporting for the state 938 //NOT EXCLUDING the load state settings, because although we 939 //handle these specially for the CURRENT FILE, their current 940 //settings won't be reflected in the load state, which is determined 941 //earlier, when the file loads. 942 // 943 //place any parameter here you do NOT want to have in the state 944 // 945 // _xxxxx variables are automatically exempt 946 // 947 (";ambientpercent;animationfps" 948 + ";antialiasdisplay;antialiasimages;antialiastranslucent;appendnew;axescolor" 949 + ";axesposition;axesmolecular;axesorientationrasmol;axesunitcell;axeswindow;axis1color;axis2color" 950 + ";axis3color;backgroundcolor;backgroundmodel;bondsymmetryatoms;boundboxcolor;cameradepth" 951 + ";bondingversion;ciprule6full;contextdepthmax;debug;debugscript;defaultlatttice;defaults;defaultdropscript;diffusepercent;" 952 + ";exportdrivers;exportscale" 953 + ";_filecaching;_filecache;fontcaching;fontscaling;forcefield;language" 954 + ";hbondsDistanceMaximum;hbondsangleminimum" // added Jmol 14.24.2 955 + ";jmolinjspecview;legacyautobonding;legacyhaddition;legacyjavafloat" 956 + ";loglevel;logfile;loggestures;logcommands;measurestylechime" 957 + ";loadformat;loadligandformat;macrodirectory;mkaddhydrogens" 958 + ";minimizationmaxatoms;smilesurlformat;pubchemformat;nihresolverformat;edsurlformat;edsurlcutoff;multiprocessor;navigationmode;" 959 + ";nodelay;pathforallfiles;perspectivedepth;phongexponent;perspectivemodel;platformspeed" 960 + ";preservestate;refreshing;repaintwaitms;rotationradius;selectallmodels" 961 + ";showaxes;showaxis1;showaxis2;showaxis3;showboundbox;showfrank;showtiming;showunitcell" 962 + ";slabenabled;slab;slabrange;depth;zshade;zshadepower;specular;specularexponent;specularpercent" 963 + ";celshading;celshadingpower;specularpower;stateversion" 964 + ";statusreporting;stereo;stereostate;vibrationperiod" 965 + ";unitcellcolor;visualrange;windowcentered;zerobasedxyzrasmol;zoomenabled;mousedragfactor;mousewheelfactor" 966 // saved in the hash table but not considered part of the state: 967 + ";scriptqueue;scriptreportinglevel;syncscript;syncmouse;syncstereo" 968 + ";defaultdirectory;currentlocalpath;defaultdirectorylocal" 969 // more settable Jmol variables 970 + ";ambient;bonds;colorrasmol;diffuse;fractionalrelative;frank;hetero;hidenotselected" 971 + ";hoverlabel;hydrogen;languagetranslation;measurementunits;navigationdepth;navigationslab" 972 + ";picking;pickingstyle;propertycolorschemeoverload;radius;rgbblue;rgbgreen;rgbred" 973 + ";scaleangstromsperinch;selectionhalos;showscript;showselections;solvent;strandcount" 974 + ";spinx;spiny;spinz;spinfps;navx;navy;navz;navfps;" 975 + CBK.getNameList() 976 + ";undo;atompicking;drawpicking;bondpicking;pickspinrate;picklabel" 977 + ";modelkitmode;autoplaymovie;allowaudio;allowgestures;allowkeystrokes;allowmultitouch;allowmodelkit" 978 // oops these were in some state scripts but should not have been 979 + ";dodrop;hovered;historylevel;imagestate;iskiosk;useminimizationthread" 980 + ";checkcir;resolverresolver;showkeystrokes;saveproteinstructurestate;testflag1;testflag2;testflag3;testflag4" 981 // removed in Jmol 14.29.18 982 + ";selecthetero;selecthydrogen;" 983 984 + ";") 985 .toLowerCase(); 986 getAllVariables()987 Object getAllVariables() { 988 Map<String, Object> map = new Hashtable<String, Object>(); 989 map.putAll(htBooleanParameterFlags); 990 map.putAll(htNonbooleanParameterValues); 991 map.putAll(htUserVariables); 992 return map; 993 } 994 995 /** 996 * these settings are determined when the file is loaded and are kept even 997 * though they might later change. So we list them here and ALSO let them be 998 * defined in the settings. 10.9.98 missed this. 999 * 1000 * @param htParams 1001 * 1002 * @return script command 1003 */ getLoadState(Map<String, Object> htParams)1004 String getLoadState(Map<String, Object> htParams) { 1005 1006 // some commands register flags so that they will be 1007 // restored in a saved state definition, but will not execute 1008 // now so that there is no chance any embedded scripts or 1009 // default load scripts will run and slow things down. 1010 SB str = new SB(); 1011 app(str, "set allowEmbeddedScripts false"); 1012 if (allowEmbeddedScripts) 1013 setB("allowEmbeddedScripts", true); 1014 app(str, "set appendNew " + appendNew); 1015 app(str, "set appletProxy " + PT.esc(appletProxy)); 1016 app(str, "set applySymmetryToBonds " + applySymmetryToBonds); 1017 if (atomTypes.length() > 0) 1018 app(str, "set atomTypes " + PT.esc(atomTypes)); 1019 app(str, "set autoBond " + autoBond); 1020 // appendCmd(str, "set autoLoadOrientation " + autoLoadOrientation); 1021 if (axesOrientationRasmol) 1022 app(str, "set axesOrientationRasmol true"); 1023 app(str, "set bondRadiusMilliAngstroms " + bondRadiusMilliAngstroms); 1024 app(str, "set bondTolerance " + bondTolerance); 1025 app(str, "set defaultLattice " + Escape.eP(ptDefaultLattice)); 1026 app(str, "set defaultLoadFilter " + PT.esc(defaultLoadFilter)); 1027 app(str, "set defaultLoadScript \"\""); 1028 if (defaultLoadScript.length() > 0) 1029 setO("defaultLoadScript", defaultLoadScript); 1030 app(str, "set defaultStructureDssp " + defaultStructureDSSP); 1031 String sMode = vwr.getDefaultVdwNameOrData(Integer.MIN_VALUE, null, null); 1032 app(str, "set defaultVDW " + sMode); 1033 if (sMode.equals("User")) 1034 app(str, vwr.getDefaultVdwNameOrData(Integer.MAX_VALUE, null, null)); 1035 app(str, "set forceAutoBond " + forceAutoBond); 1036 app(str, "#set defaultDirectory " + PT.esc(defaultDirectory)); 1037 app(str, "#set loadFormat " + PT.esc(loadFormat)); 1038 app(str, "#set loadLigandFormat " + PT.esc(pdbLoadLigandFormat)); 1039 app(str, "#set smilesUrlFormat " + PT.esc(smilesUrlFormat)); 1040 app(str, "#set nihResolverFormat " + PT.esc(nihResolverFormat)); 1041 app(str, "#set pubChemFormat " + PT.esc(pubChemFormat)); 1042 // app(str, "#set edsUrlFormat " + PT.esc(edsUrlFormat)); 1043 // app(str, "#set edsUrlFormatDiff " + PT.esc(edsUrlFormatDiff)); 1044 // app(str, "#set edsUrlCutoff " + PT.esc(edsUrlCutoff)); 1045 // if (autoLoadOrientation) 1046 // appendCmd(str, "set autoLoadOrientation true"); 1047 app(str, "set bondingVersion " + bondingVersion); 1048 app(str, "set legacyAutoBonding " + legacyAutoBonding); 1049 app(str, "set legacyAutoBonding " + legacyAutoBonding); 1050 app(str, "set legacyHAddition " + legacyHAddition); 1051 app(str, "set legacyJavaFloat " + legacyJavaFloat); 1052 app(str, "set minBondDistance " + minBondDistance); 1053 // these next two might be part of a 2D->3D operation 1054 app(str, "set minimizationCriterion " + minimizationCriterion); 1055 app(str, "set minimizationSteps " + minimizationSteps); 1056 // Jmol 14.3.15 introduces bananas, but this setting should not carry through from one model to the next 1057 app(str, "set multipleBondBananas false"); 1058 app(str, 1059 "set pdbAddHydrogens " 1060 + (htParams != null 1061 && htParams.get("pdbNoHydrogens") != Boolean.TRUE ? pdbAddHydrogens 1062 : false)); 1063 app(str, "set pdbGetHeader " + pdbGetHeader); 1064 app(str, "set pdbSequential " + pdbSequential); 1065 app(str, "set percentVdwAtom " + percentVdwAtom); 1066 app(str, "set smallMoleculeMaxAtoms " + smallMoleculeMaxAtoms); 1067 app(str, "set smartAromatic " + smartAromatic); 1068 if (zeroBasedXyzRasmol) 1069 app(str, "set zeroBasedXyzRasmol true"); 1070 return str.toString(); 1071 } 1072 app(SB s, String cmd)1073 private void app(SB s, String cmd) { 1074 if (cmd.length() == 0) 1075 return; 1076 s.append(" ").append(cmd).append(";\n"); 1077 } 1078 setCIR(String template)1079 public void setCIR(String template) { 1080 if (template == null || template.equals(nihResolverFormat) && smilesUrlFormat != null) 1081 return; 1082 int pt = template.indexOf("/structure"); 1083 if (pt > 0) { 1084 nihResolverFormat = template.substring(0, pt + 10); 1085 smilesUrlFormat = nihResolverFormat + "/%FILE/file?format=sdf&get3d=true"; 1086 System.out.println("CIR resolver set to " + nihResolverFormat); 1087 } 1088 1089 } 1090 1091 1092 } 1093