Repository 'pm_muairss_read'
hg clone https://toolshed.g2.bx.psu.edu/repos/muon-spectroscopy-computational-project/pm_muairss_read

Changeset 4:40071ff77285 (2023-07-18)
Previous changeset 3:276a25ab05f2 (2023-02-03) Next changeset 5:17da9f67ed33 (2024-07-26)
Commit message:
planemo upload for repository https://github.com/muon-spectroscopy-computational-project/muon-galaxy-tools/main/pm_muairss_read commit 70a4d37ecdf5d586703cfc509922311e95d3205c
modified:
pm_muairss_read.xml
added:
config.py
muon_macros.xml
test-data/Si_uep_min_cluster_1.cell
test-data/Si_uep_min_cluster_2.cell
test-data/clustout-uep-kmeans.dat
test-data/clustout-uep-kmeans.txt
b
diff -r 276a25ab05f2 -r 40071ff77285 config.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/config.py Tue Jul 18 13:26:40 2023 +0000
b
@@ -0,0 +1,18 @@
+import yaml
+
+
+def main():
+    with open("params.yaml") as f:
+        existing_params = yaml.safe_load(f)
+
+    with open("incoming_params") as f:
+        incoming_params = yaml.safe_load(f)
+
+    merged_params = {**existing_params, **incoming_params}
+
+    with open("params.yaml", "w") as f:
+        yaml.safe_dump(merged_params, f)
+
+
+if __name__ == "__main__":
+    main()
b
diff -r 276a25ab05f2 -r 40071ff77285 muon_macros.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/muon_macros.xml Tue Jul 18 13:26:40 2023 +0000
[
@@ -0,0 +1,29 @@
+<macros>
+    <xml name="dftb_set">
+        <param type="select" name="dftb_set" value="3ob-3-1" display="radio" label="DFTB parameter set" help="The parameter set to use for DFTB+. Currently supported are: 3ob-3-1 and pbc-0-3. See help section at the bottom of the page for details.">
+            <option value="3ob-3-1">3ob-3-1</option>
+            <option value="pbc-0-3">pbc-0-3</option>
+        </param>
+    </xml>
+    <xml name="dftb+">
+        <expand macro="dftb_set"/>
+        <param type="boolean" name="dftb_pbc" label="Use periodic boundary conditions" help="Whether to turn on periodic boundary conditions in DFTB+." checked="true"/>
+    </xml>
+    <xml name="dftb_optionals">
+        <param type="text" argument="dftb_optionals" value="[]" optional="true" label="DFTB optional files" help="Additional optional json files to activate for DFTBArgs (for example, dftd3.json will use DFTD3 dispersion forces for 3ob-3-1 if DFTB+ has been compiled to support them)."/>
+    </xml>
+    <xml name="k_points_grid">
+        <param type="text" argument="k_points_grid" value="[1,1,1]" label="K-points grid" help="List of three integer k-points. Default is [1,1,1].">
+            <validator type="regex" message="Input should only contain whitespace, '[', ']', ',' and digits.">^[\s\d,\[\]]+$</validator>
+        </param>
+    </xml>
+    <!-- version of underlying tool (PEP 440) -->
+    <!-- citation should be updated with every underlying tool version -->
+    <!-- concept is not updated, and should only be used for referencing the idea of the software -->
+    <token name="@MUSPINSIM_VERSION@">2.2.1</token>
+    <token name="@MUSPINSIM_CITATION@">10.5281/zenodo.7733979</token>
+    <token name="@MUSPINSIM_CONCEPT@">10.5281/zenodo.6517626</token>
+    <token name="@PYMUONSUITE_VERSION@">0.3.0</token>
+    <token name="@PYMUONSUITE_CITATION@">10.5281/zenodo.8026711</token>
+    <token name="@PYMUONSUITE_CONCEPT@">10.5281/zenodo.7025643</token>
+</macros>
\ No newline at end of file
b
diff -r 276a25ab05f2 -r 40071ff77285 pm_muairss_read.xml
--- a/pm_muairss_read.xml Fri Feb 03 15:39:29 2023 +0000
+++ b/pm_muairss_read.xml Tue Jul 18 13:26:40 2023 +0000
[
b'@@ -1,67 +1,165 @@\n-<tool id="pm_muairss_read" name="PyMuonSuite AIRSS Cluster" version="@TOOL_VERSION@+galaxy@WRAPPER_VERSION@" python_template_version="3.5" profile="22.05" license="MIT">\n+<tool id="pm_muairss_read" name="PyMuonSuite AIRSS Cluster" version="@PYMUONSUITE_VERSION@+galaxy@WRAPPER_VERSION@" python_template_version="3.5" profile="22.05" license="MIT">\n     <description>run clustering for optimised structures</description>\n     <macros>\n-        <!-- version of underlying tool (PEP 440) -->\n-        <token name="@TOOL_VERSION@">0.2.3</token>\n         <!-- version of this tool wrapper (integer) -->\n         <token name="@WRAPPER_VERSION@">0</token>\n-        <!-- citation should be updated with every underlying tool version -->\n-        <!-- typical fields to update are version, month, year, and doi -->\n-        <token name="@TOOL_CITATION@">\n-            @software{Sturniolo_pymuon-suite_2022,\n-                author = {Sturniolo, Simone and Liborio, Leandro and Chadwick, Eli and Murgatroyd, Laura and Laverack, Adam and Mudaraddi, Anish and {Muon Spectroscopy Computational Project}},\n-                license = {GPL-3.0},\n-                month = {8},\n-                title = {{pymuon-suite}},\n-                url = {https://github.com/muon-spectroscopy-computational-project/pymuon-suite},\n-                version = {v0.2.3},\n-                doi = {10.5281/zenodo.7025644},\n-                year = {2022}\n-            }\n-        </token>\n+        <import>muon_macros.xml</import>\n+        <xml name="supercell">\n+            <param type="text" argument="supercell" value="1" label="Supercell" help="Supercell size and shape to use when saving cluster structures. This can either be a single int, a list of three integers or a 3x3 matrix of integers. For a single number a diagonal matrix will be generated with the integer repeated on the diagonals. For a list of three numbers a diagonal matrix will be generated where the diagonal elements are set to the list. A matrix will be used directly as is. Default is a 3x3 identity matrix.">\n+                <validator type="regex" message="Input should only contain whitespace, \'[\', \']\', \',\' and digits.">^[\\s\\d,\\[\\]]+$</validator>\n+            </param>\n+        </xml>\n     </macros>\n     <creator>\n         <person givenName="Jyothish" familyName="Thomas" identifier="https://orcid.org/0000-0003-4724-6924"/>\n         <person givenName="Eli" familyName="Chadwick" url="https://github.com/elichad" identifier="https://orcid.org/0000-0002-0035-6475"/>\n+        <person givenName="Patrick" familyName="Austin" url="https://github.com/patrick-austin" identifier="https://orcid.org/0000-0002-6279-7823"/>\n         <organization url="https://muon-spectroscopy-computational-project.github.io/index.html" name="The Muon Spectroscopy Computational Project"/>\n     </creator>\n     <requirements>\n-        <requirement type="package" version="@TOOL_VERSION@">pymuonsuite</requirement>\n+        <requirement type="package" version="@PYMUONSUITE_VERSION@">pymuonsuite</requirement>\n+        <requirement type="package" version="3.0">zip</requirement>\n     </requirements>\n     <required_files>\n         <include type="literal" path="get_out_folder.py"/>\n+        <include type="literal" path="config.py"/>\n     </required_files>\n     <command detect_errors="exit_code"><![CDATA[\n         unzip \'$optimisation_results\' &&\n         if test -f "params.yaml"; then echo "params.yaml present"; else echo "params.yaml missing" && exit 64; fi\n         && if ( test -f input_structure.* ) ; then echo "input structure present"; else echo "input structure missing" && exit 64; fi\n-        && out_folder="`python \'${__tool_directory__}/get_out_folder.py\'`" &&\n-        pm-muairss -t r input_structure.* params.yaml\n+        && out_folder="`python \'${__tool_directory__}/get_out_folder.py\'`"\n+        && python \'${__tool_directory__}/config.py\' \n+        && pm-muairss -t r input_structure.* params.yaml\n+        #if $clustering_save.cluste'..b'tout-dftb.txt" ftype="txt" lines_diff="2"/>\n             <output name="cluster_data" file="clustout-dftb.dat" ftype="txt"/>\n         </test>\n+        <!-- Test overwrite of values in the existing params.yaml -->\n+        <test expect_num_outputs="2">\n+            <param name="optimisation_results" value="uep-out.zip" ftype="zip"/>\n+            <conditional name="clustering">\n+                <param name="clustering_method" value="kmeans"/>\n+                <param name="clustering_kmeans_k" value="2"/>\n+            </conditional>\n+            <!-- kmeans gives predictable clusters, but orders them randomly -->\n+            <!-- To prevent this from affecting tests, sort the lines -->\n+            <!-- in the report and use regex matching for the dat file -->\n+            <output name="cluster_report" file="clustout-uep-kmeans.txt" ftype="txt" lines_diff="2" sort="true"/>\n+            <output name="cluster_data" file="clustout-uep-kmeans.dat" ftype="txt" compare="re_match"/>\n+        </test>\n     </tests>\n     <help><![CDATA[\n         Given a set of optimised muonated structures, clusters the structures based on similarity.\n \n+        This is intended to be used with the output from \'`PyMuonSuite AIRSS UEP Optimise`_\'.\n         If you used the \'Run UEP optimisation\' tool for optimisation, the output from that tool can be used as the input to this one.\n-        If you are bringing files from elsewhere, make sure they fit the expected zip folder structure:\n+        If you are bringing files from elsewhere (such as running PyMuonSuite from the command line, or with a different optimisation calculator), make sure they fit the expected zip folder structure:\n \n         .. code-block::\n \n@@ -77,24 +175,23 @@\n             \xe2\x94\x9c\xe2\x94\x80 input.cell\n             \xe2\x94\x9c\xe2\x94\x80 params.yaml\n \n-        This folder represents a run with the output folder name ``muon-airss-out``, the structure name ``struct``, and the UEP calculator.\n-        If you use different parameters, these names should match your own settings. (``dftb+`` and ``castep`` are used as folder names for the respective calculators)\n-\n+        This folder represents a run with the output folder name ``muon-airss-out``, the structure name ``struct``, and the ``uep`` calculator.\n+        If you use different parameters, these names should match your own settings (``dftb+`` and ``castep`` are used as folder names for the respective calculators).\n         The zip folder itself has been named ``optimised-structures.zip`` in this example, but it doesn\'t matter what you call it.\n \n         The files ``input.cell`` and ``params.yaml`` must have those exact names. ``input.cell`` should be your original structure file,\n-        and ``params.yaml`` is the YAML parameter file used to configure the clustering (as well as any prior muonation and optimisation).\n-        You should have created this YAML file using the \'Create YAML for pm-muairss\' tool or written it yourself, then passed it into the\n-        \'Generate muon structures\' tool or pm-muairss.\n+        and ``params.yaml`` is the YAML parameter file used to configure the muonation and optimisation.\n+        This file is created automatically when using \'`PyMuonSuite AIRSS UEP Optimise`_\'.\n+        Any parameters relating to the clustering process present in the original file will be overwritten with the values selected here.\n \n         Command-line usage: pm-muairss [-h] -t r structures parameter_file\n \n+        .. _PyMuonSuite AIRSS UEP Optimise: /tool_runner?tool_id=pm_uep_opt\n+\n         PyMuonSuite is distributed under the GPLv3 license. This tool wrapper is distributed under the MIT license.\n     ]]></help>\n     <citations>\n-        <citation type="bibtex">\n-            @TOOL_CITATION@\n-        </citation>\n+        <citation type="doi">@PYMUONSUITE_CITATION@</citation>\n         <citation type="doi">10.1063/1.5024450</citation>\n         <citation type="doi">10.1063/1.5085197</citation>\n         <citation type="doi">10.1063/5.0012381</citation>\n'
b
diff -r 276a25ab05f2 -r 40071ff77285 test-data/Si_uep_min_cluster_1.cell
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/Si_uep_min_cluster_1.cell Tue Jul 18 13:26:40 2023 +0000
b
@@ -0,0 +1,91 @@
+#######################################################
+#CASTEP cell file: Si_clusters/uep/Si_uep_min_cluster_1.cell
+#Created using the Atomic Simulation Environment (ASE)#
+#######################################################
+
+%BLOCK LATTICE_CART
+10.950902  0.000000  0.000000
+ 0.000000 10.950902 -0.000000
+ 0.000000 -0.000000 10.950902
+%ENDBLOCK LATTICE_CART
+
+%BLOCK POSITIONS_ABS
+Si  0.000000  0.000000  0.000000
+Si  4.106588  4.106588  1.368863
+Si  2.737726  0.000000  2.737726
+Si  4.106588  1.368863  4.106588
+Si  0.000000  2.737726  2.737726
+Si  1.368863  1.368863  1.368863
+Si  1.368863  4.106588  4.106588
+Si  2.737726  2.737726  0.000000
+Si  0.000000  0.000000  5.475451
+Si  4.106588  4.106588  6.844314
+Si  2.737726  0.000000  8.213177
+Si  4.106588  1.368863  9.582039
+Si  0.000000  2.737726  8.213177
+Si  1.368863  1.368863  6.844314
+Si  1.368863  4.106588  9.582039
+Si  2.737726  2.737726  5.475451
+Si  0.000000  5.475451  0.000000
+Si  4.106588  9.582039  1.368863
+Si  2.737726  5.475451  2.737726
+Si  4.106588  6.844314  4.106588
+Si  0.000000  8.213177  2.737726
+Si  1.368863  6.844314  1.368863
+Si  1.368863  9.582039  4.106588
+Si  2.737726  8.213177  0.000000
+Si  0.000000  5.475451  5.475451
+Si  4.106588  9.582039  6.844314
+Si  2.737726  5.475451  8.213177
+Si  4.106588  6.844314  9.582039
+Si  0.000000  8.213177  8.213177
+Si  1.368863  6.844314  6.844314
+Si  1.368863  9.582039  9.582039
+Si  2.737726  8.213177  5.475451
+Si  5.475451  0.000000  0.000000
+Si  9.582039  4.106588  1.368863
+Si  8.213177  0.000000  2.737726
+Si  9.582039  1.368863  4.106588
+Si  5.475451  2.737726  2.737726
+Si  6.844314  1.368863  1.368863
+Si  6.844314  4.106588  4.106588
+Si  8.213177  2.737726  0.000000
+Si  5.475451  0.000000  5.475451
+Si  9.582039  4.106588  6.844314
+Si  8.213177  0.000000  8.213177
+Si  9.582039  1.368863  9.582039
+Si  5.475451  2.737726  8.213177
+Si  6.844314  1.368863  6.844314
+Si  6.844314  4.106588  9.582039
+Si  8.213177  2.737726  5.475451
+Si  5.475451  5.475451  0.000000
+Si  9.582039  9.582039  1.368863
+Si  8.213177  5.475451  2.737726
+Si  9.582039  6.844314  4.106588
+Si  5.475451  8.213177  2.737726
+Si  6.844314  6.844314  1.368863
+Si  6.844314  9.582039  4.106588
+Si  8.213177  8.213177  0.000000
+Si  5.475451  5.475451  5.475451
+Si  9.582039  9.582039  6.844314
+Si  8.213177  5.475451  8.213177
+Si  9.582039  6.844314  9.582039
+Si  5.475451  8.213177  8.213177
+Si  6.844314  6.844314  6.844314
+Si  6.844314  9.582039  9.582039
+Si  8.213177  8.213177  5.475451
+H:nu  2.737259  2.736006  2.738945
+%ENDBLOCK POSITIONS_ABS
+
+%BLOCK SPECIES_GAMMA
+radsectesla
+H:nu 851615456.5978916
+%ENDBLOCK SPECIES_GAMMA
+
+%BLOCK SPECIES_MASS
+AMU
+H:nu 0.1134289259
+%ENDBLOCK SPECIES_MASS
+
+KPOINT_MP_GRID: 1 1 1
+FIX_ALL_CELL: True
b
diff -r 276a25ab05f2 -r 40071ff77285 test-data/Si_uep_min_cluster_2.cell
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/Si_uep_min_cluster_2.cell Tue Jul 18 13:26:40 2023 +0000
b
@@ -0,0 +1,91 @@
+#######################################################
+#CASTEP cell file: Si_clusters/uep/Si_uep_min_cluster_2.cell
+#Created using the Atomic Simulation Environment (ASE)#
+#######################################################
+
+%BLOCK LATTICE_CART
+10.950902  0.000000  0.000000
+ 0.000000 10.950902 -0.000000
+ 0.000000 -0.000000 10.950902
+%ENDBLOCK LATTICE_CART
+
+%BLOCK POSITIONS_ABS
+Si  0.000000  0.000000  0.000000
+Si  4.106588  4.106588  1.368863
+Si  2.737726  0.000000  2.737726
+Si  4.106588  1.368863  4.106588
+Si  0.000000  2.737726  2.737726
+Si  1.368863  1.368863  1.368863
+Si  1.368863  4.106588  4.106588
+Si  2.737726  2.737726  0.000000
+Si  0.000000  0.000000  5.475451
+Si  4.106588  4.106588  6.844314
+Si  2.737726  0.000000  8.213177
+Si  4.106588  1.368863  9.582039
+Si  0.000000  2.737726  8.213177
+Si  1.368863  1.368863  6.844314
+Si  1.368863  4.106588  9.582039
+Si  2.737726  2.737726  5.475451
+Si  0.000000  5.475451  0.000000
+Si  4.106588  9.582039  1.368863
+Si  2.737726  5.475451  2.737726
+Si  4.106588  6.844314  4.106588
+Si  0.000000  8.213177  2.737726
+Si  1.368863  6.844314  1.368863
+Si  1.368863  9.582039  4.106588
+Si  2.737726  8.213177  0.000000
+Si  0.000000  5.475451  5.475451
+Si  4.106588  9.582039  6.844314
+Si  2.737726  5.475451  8.213177
+Si  4.106588  6.844314  9.582039
+Si  0.000000  8.213177  8.213177
+Si  1.368863  6.844314  6.844314
+Si  1.368863  9.582039  9.582039
+Si  2.737726  8.213177  5.475451
+Si  5.475451  0.000000  0.000000
+Si  9.582039  4.106588  1.368863
+Si  8.213177  0.000000  2.737726
+Si  9.582039  1.368863  4.106588
+Si  5.475451  2.737726  2.737726
+Si  6.844314  1.368863  1.368863
+Si  6.844314  4.106588  4.106588
+Si  8.213177  2.737726  0.000000
+Si  5.475451  0.000000  5.475451
+Si  9.582039  4.106588  6.844314
+Si  8.213177  0.000000  8.213177
+Si  9.582039  1.368863  9.582039
+Si  5.475451  2.737726  8.213177
+Si  6.844314  1.368863  6.844314
+Si  6.844314  4.106588  9.582039
+Si  8.213177  2.737726  5.475451
+Si  5.475451  5.475451  0.000000
+Si  9.582039  9.582039  1.368863
+Si  8.213177  5.475451  2.737726
+Si  9.582039  6.844314  4.106588
+Si  5.475451  8.213177  2.737726
+Si  6.844314  6.844314  1.368863
+Si  6.844314  9.582039  4.106588
+Si  8.213177  8.213177  0.000000
+Si  5.475451  5.475451  5.475451
+Si  9.582039  9.582039  6.844314
+Si  8.213177  5.475451  8.213177
+Si  9.582039  6.844314  9.582039
+Si  5.475451  8.213177  8.213177
+Si  6.844314  6.844314  6.844314
+Si  6.844314  9.582039  9.582039
+Si  8.213177  8.213177  5.475451
+H:nu  4.793737  3.419626  4.793651
+%ENDBLOCK POSITIONS_ABS
+
+%BLOCK SPECIES_GAMMA
+radsectesla
+H:nu 851615456.5978916
+%ENDBLOCK SPECIES_GAMMA
+
+%BLOCK SPECIES_MASS
+AMU
+H:nu 0.1134289259
+%ENDBLOCK SPECIES_MASS
+
+KPOINT_MP_GRID: 1 1 1
+FIX_ALL_CELL: True
b
diff -r 276a25ab05f2 -r 40071ff77285 test-data/clustout-uep-kmeans.dat
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/clustout-uep-kmeans.dat Tue Jul 18 13:26:40 2023 +0000
b
@@ -0,0 +1,2 @@
+1 1?2 -8\.4\d+ -8\.4\d+ \d\.\d+e?-?\d{0,2} \d\.\d+ \d\.\d+ \d\.\d+
+2 1?2 -8\.4\d+ -8\.4\d+ \d\.\d+e?-?\d{0,2} \d\.\d+ \d\.\d+ \d\.\d+
b
diff -r 276a25ab05f2 -r 40071ff77285 test-data/clustout-uep-kmeans.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/clustout-uep-kmeans.txt Tue Jul 18 13:26:40 2023 +0000
b
@@ -0,0 +1,66 @@
+
+****************************
+|                          |
+|       PYMUON-SUITE       |
+|  MuAirss Clusters report |
+|                          |
+****************************
+
+Name: Si
+Date: 2022-06-21 09:32:03.839222
+Structure file(s): input_structure.cell
+Parameter file: params.yaml
+
+Clustering method: k-Means
+    k = 2
+
+
+*******************
+
+Clusters for Si:
+CALCULATOR: uep
+ 2 clusters found
+
+
+ -----------
+ Cluster 1
+ -----------
+ Structures: 12
+
+ Energy (eV):
+ Minimum Average StDev
+ -8.49 -8.49 0.00
+
+ Minimum energy structure: Si_1
+
+
+ Structure list:
+ Si_1 Si_2 Si_5 Si_6
+ Si_7 Si_8 Si_9 Si_10
+ Si_11 Si_12 Si_13 Si_14
+
+ -----------
+ Cluster 2
+ -----------
+ Structures: 2
+
+ Energy (eV):
+ Minimum Average StDev
+ -8.43 -8.43 0.00
+
+ Minimum energy structure: Si_3
+
+
+ Structure list:
+ Si_3 Si_4
+
+ ----------
+
+ Similarity (ranked):
+ 1 <--> 2 (distance = 0.218)
+
+--------------------------
+
+
+==========================
+