Revision: 20596 http://sourceforge.net/p/jmol/code/20596 Author: hansonr Date: 2015-06-19 17:14:06 +0000 (Fri, 19 Jun 2015) Log Message: ----------- Jmol.___JmolVersion="14.3.15_2015.06.19b"
new feature: MACRO command -- runs predefined script, generally defining new functions of general use -- contributions welcome! -- will be expanded $ macro aflow running http://aflowlib.mems.duke.edu/users/jmolers/jmol/spt/AFLOW.spt aflowLoad(binaryAlloy) loaded aflowBinaries loaded aflowDualArray(binaryAlloy, a, b) loaded aflowDualWrite loaded aflowConvexHull(binaryAlloy) loaded aflowCheckBinary(binaryAlloy) loaded aflowGetPG(binaryAlloy, a, range1, range2,radius) loaded $ aflowLoad("AgAu") 294 models $ print aflowConvexHull { "Cb" : 0.0 "Hf_eV_VASP" : 0.0 "modelNumber" : 2 } { "Cb" : 0.25 "Hf_eV_VASP" : -0.0472733 "modelNumber" : 26 } { "Cb" : 0.5 "Hf_eV_VASP" : -0.085589 "modelNumber" : 180 } { "Cb" : 0.75 "Hf_eV_VASP" : -0.0463823 "modelNumber" : 25 } { "Cb" : 1.0 "Hf_eV_VASP" : 0.0 "modelNumber" : 260 } bug fix: AFLOW binary file reader can fail with certain VASP formats containing both in-line atom labels and atom elements prior to #elements line. (AlPd#5, for example) Modified Paths: -------------- trunk/Jmol/src/org/jmol/script/ScriptEval.java trunk/Jmol/src/org/jmol/script/T.java trunk/Jmol/src/org/jmol/scriptext/CmdExt.java trunk/Jmol/src/org/jmol/viewer/JC.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/script/ScriptEval.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEval.java 2015-06-19 15:45:34 UTC (rev 20595) +++ trunk/Jmol/src/org/jmol/script/ScriptEval.java 2015-06-19 17:14:06 UTC (rev 20596) @@ -2520,6 +2520,7 @@ case T.hbond: // hbond connect case T.image: case T.stereo: + case T.macro: case T.mapproperty: case T.minimize: case T.modulation: Modified: trunk/Jmol/src/org/jmol/script/T.java =================================================================== --- trunk/Jmol/src/org/jmol/script/T.java 2015-06-19 15:45:34 UTC (rev 20595) +++ trunk/Jmol/src/org/jmol/script/T.java 2015-06-19 17:14:06 UTC (rev 20596) @@ -330,7 +330,8 @@ public final static int invertSelected = scriptCommand | 26; //public final static int load see mathfunc public final static int loop = scriptCommand | 27 | defaultON; - public final static int mapproperty = scriptCommand | 28 | expression; + public final static int macro = scriptCommand | 28; + public final static int mapproperty = scriptCommand | 29 | expression; public final static int minimize = scriptCommand | 30; //public final static int model see mathfunc //public final static int measure see mathfunc @@ -2250,6 +2251,7 @@ "lonePair", "lp", "lumo", + "macro", "manifest", "mapProperty", "map", @@ -3280,6 +3282,7 @@ lonepair, // "lonePair" lp, // "lp" lumo, // "lumo" + macro, // "macro" // added in Jmol 14.3.15 manifest, // "manifest" mapproperty, // "mapProperty" -1, // "map" Modified: trunk/Jmol/src/org/jmol/scriptext/CmdExt.java =================================================================== --- trunk/Jmol/src/org/jmol/scriptext/CmdExt.java 2015-06-19 15:45:34 UTC (rev 20595) +++ trunk/Jmol/src/org/jmol/scriptext/CmdExt.java 2015-06-19 17:14:06 UTC (rev 20596) @@ -142,6 +142,9 @@ case T.image: image(); break; + case T.macro: + macro(); + break; case T.mapproperty: mapProperty(); break; @@ -190,6 +193,22 @@ } + private void macro() throws ScriptException { + String key = e.optParameterAsString(1); + if (key.length() == 0) + return; + if (chk) + return; + String macro = JC.getMacro(key); + if (macro == null) { + showString("macro " + key + " could not be found. Current macros include:\n" + JC.getMacroList()); + return; + } + showString("running " + macro); + macro = vwr.getFileAsString3(macro, false, null); + e.runScript(macro); + } + /** * used for TRY command * Modified: trunk/Jmol/src/org/jmol/viewer/JC.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JC.java 2015-06-19 15:45:34 UTC (rev 20595) +++ trunk/Jmol/src/org/jmol/viewer/JC.java 2015-06-19 17:14:06 UTC (rev 20596) @@ -32,6 +32,7 @@ import javajs.J2SRequireImport; import javajs.util.PT; +import javajs.util.SB; import javajs.util.V3; import java.io.BufferedInputStream; @@ -64,7 +65,25 @@ "map", "http://www.ebi.ac.uk/pdbe/api/%TYPE/%FILE?pretty=false&metadata=true", "rna3d", "http://rna.bgsu.edu/rna3dhub/%TYPE/download/%FILE" }; + + public static String[] macros = { + "aflow", "http://aflowlib.mems.duke.edu/users/jmolers/jmol/spt/AFLOW.spt" + }; + public static String getMacroList() { + SB s = new SB(); + for (int i = 0; i < macros.length; i += 2) + s.append(macros[i]).append("\t").append(macros[i + 1]).append("\n"); + return s.toString(); + } + + + public static String getMacro(String key) { + for (int i = 0; i < macros.length; i += 2) + if (macros[i].equals(key)) + return macros[i + 1]; + return null; + } public final static String copyright = "(C) 2015 Jmol Development"; Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-06-19 15:45:34 UTC (rev 20595) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-06-19 17:14:06 UTC (rev 20596) @@ -17,6 +17,50 @@ Jmol.___JmolVersion="14.3.15_2015.06.19b" +new feature: MACRO command + -- runs predefined script, generally defining new functions of general use + -- contributions welcome! + -- will be expanded + + $ macro aflow + running http://aflowlib.mems.duke.edu/users/jmolers/jmol/spt/AFLOW.spt + aflowLoad(binaryAlloy) loaded + aflowBinaries loaded + aflowDualArray(binaryAlloy, a, b) loaded + aflowDualWrite loaded + aflowConvexHull(binaryAlloy) loaded + aflowCheckBinary(binaryAlloy) loaded + aflowGetPG(binaryAlloy, a, range1, range2,radius) loaded + $ aflowLoad("AgAu") + 294 models + + $ print aflowConvexHull + { + "Cb" : 0.0 + "Hf_eV_VASP" : 0.0 + "modelNumber" : 2 + } + { + "Cb" : 0.25 + "Hf_eV_VASP" : -0.0472733 + "modelNumber" : 26 + } + { + "Cb" : 0.5 + "Hf_eV_VASP" : -0.085589 + "modelNumber" : 180 + } + { + "Cb" : 0.75 + "Hf_eV_VASP" : -0.0463823 + "modelNumber" : 25 + } + { + "Cb" : 1.0 + "Hf_eV_VASP" : 0.0 + "modelNumber" : 260 + } + bug fix: AFLOW binary file reader can fail with certain VASP formats containing both in-line atom labels and atom elements prior to #elements line. (AlPd#5, for example) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits