comparison pm_muairss_read.xml @ 4:40071ff77285 draft

planemo upload for repository https://github.com/muon-spectroscopy-computational-project/muon-galaxy-tools/main/pm_muairss_read commit 70a4d37ecdf5d586703cfc509922311e95d3205c
author muon-spectroscopy-computational-project
date Tue, 18 Jul 2023 13:26:40 +0000
parents 276a25ab05f2
children 17da9f67ed33
comparison
equal deleted inserted replaced
3:276a25ab05f2 4:40071ff77285
1 <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"> 1 <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">
2 <description>run clustering for optimised structures</description> 2 <description>run clustering for optimised structures</description>
3 <macros> 3 <macros>
4 <!-- version of underlying tool (PEP 440) -->
5 <token name="@TOOL_VERSION@">0.2.3</token>
6 <!-- version of this tool wrapper (integer) --> 4 <!-- version of this tool wrapper (integer) -->
7 <token name="@WRAPPER_VERSION@">0</token> 5 <token name="@WRAPPER_VERSION@">0</token>
8 <!-- citation should be updated with every underlying tool version --> 6 <import>muon_macros.xml</import>
9 <!-- typical fields to update are version, month, year, and doi --> 7 <xml name="supercell">
10 <token name="@TOOL_CITATION@"> 8 <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.">
11 @software{Sturniolo_pymuon-suite_2022, 9 <validator type="regex" message="Input should only contain whitespace, '[', ']', ',' and digits.">^[\s\d,\[\]]+$</validator>
12 author = {Sturniolo, Simone and Liborio, Leandro and Chadwick, Eli and Murgatroyd, Laura and Laverack, Adam and Mudaraddi, Anish and {Muon Spectroscopy Computational Project}}, 10 </param>
13 license = {GPL-3.0}, 11 </xml>
14 month = {8},
15 title = {{pymuon-suite}},
16 url = {https://github.com/muon-spectroscopy-computational-project/pymuon-suite},
17 version = {v0.2.3},
18 doi = {10.5281/zenodo.7025644},
19 year = {2022}
20 }
21 </token>
22 </macros> 12 </macros>
23 <creator> 13 <creator>
24 <person givenName="Jyothish" familyName="Thomas" identifier="https://orcid.org/0000-0003-4724-6924"/> 14 <person givenName="Jyothish" familyName="Thomas" identifier="https://orcid.org/0000-0003-4724-6924"/>
25 <person givenName="Eli" familyName="Chadwick" url="https://github.com/elichad" identifier="https://orcid.org/0000-0002-0035-6475"/> 15 <person givenName="Eli" familyName="Chadwick" url="https://github.com/elichad" identifier="https://orcid.org/0000-0002-0035-6475"/>
16 <person givenName="Patrick" familyName="Austin" url="https://github.com/patrick-austin" identifier="https://orcid.org/0000-0002-6279-7823"/>
26 <organization url="https://muon-spectroscopy-computational-project.github.io/index.html" name="The Muon Spectroscopy Computational Project"/> 17 <organization url="https://muon-spectroscopy-computational-project.github.io/index.html" name="The Muon Spectroscopy Computational Project"/>
27 </creator> 18 </creator>
28 <requirements> 19 <requirements>
29 <requirement type="package" version="@TOOL_VERSION@">pymuonsuite</requirement> 20 <requirement type="package" version="@PYMUONSUITE_VERSION@">pymuonsuite</requirement>
21 <requirement type="package" version="3.0">zip</requirement>
30 </requirements> 22 </requirements>
31 <required_files> 23 <required_files>
32 <include type="literal" path="get_out_folder.py"/> 24 <include type="literal" path="get_out_folder.py"/>
25 <include type="literal" path="config.py"/>
33 </required_files> 26 </required_files>
34 <command detect_errors="exit_code"><![CDATA[ 27 <command detect_errors="exit_code"><![CDATA[
35 unzip '$optimisation_results' && 28 unzip '$optimisation_results' &&
36 if test -f "params.yaml"; then echo "params.yaml present"; else echo "params.yaml missing" && exit 64; fi 29 if test -f "params.yaml"; then echo "params.yaml present"; else echo "params.yaml missing" && exit 64; fi
37 && if ( test -f input_structure.* ) ; then echo "input structure present"; else echo "input structure missing" && exit 64; fi 30 && if ( test -f input_structure.* ) ; then echo "input structure present"; else echo "input structure missing" && exit 64; fi
38 && out_folder="`python '${__tool_directory__}/get_out_folder.py'`" && 31 && out_folder="`python '${__tool_directory__}/get_out_folder.py'`"
39 pm-muairss -t r input_structure.* params.yaml 32 && python '${__tool_directory__}/config.py'
33 && pm-muairss -t r input_structure.* params.yaml
34 #if $clustering_save.clustering_save_format != "none":
35 && ln -s *_clusters/* minimal_clusters
36 #end if
40 ]]></command> 37 ]]></command>
38 <configfiles>
39 <configfile filename="incoming_params">clustering_method: $clustering.clustering_method
40 #if $clustering.clustering_method == "hier":
41 clustering_hier_t: $clustering.clustering_hier_t
42 #else if $clustering.clustering_method == "kmeans":
43 clustering_kmeans_k: $clustering.clustering_kmeans_k
44 #end if
45 #if $clustering_save.clustering_save_format != "none":
46 clustering_save_type: structures
47 clustering_save_format: $clustering_save.clustering_save_format
48 supercell: $clustering_save.supercell.replace('__ob__', '[').replace('__cb__', ']')
49 #if $clustering_save.clustering_save_format == "cell":
50 mu_symbol: $clustering_save.mu_symbol
51 #end if
52 #end if</configfile>
53 </configfiles>
41 <inputs> 54 <inputs>
42 <param type="data" name="optimisation_results" label="optimised muonated structures (.zip)" format="zip" help="A zip folder containing a set of optimised muonated structures, the original structure, and a YAML parameter file. See below for the expected folder structure."/> 55 <param type="data" name="optimisation_results" label="optimised muonated structures (.zip)" format="zip" help="A zip folder containing a set of optimised muonated structures, the original structure, and a YAML parameter file. See below for the expected folder structure."/>
56 <conditional name="clustering">
57 <param type="select" argument="clustering_method" display="radio" label="Clustering method" value="hier">
58 <option value="hier">hierarchical</option>
59 <option value="kmeans">k-means</option>
60 </param>
61 <when value="hier">
62 <param type="float" argument="clustering_hier_t" value="0.3" min="0.0" optional="true" label="t parameter for hierarchical clustering"/>
63 </when>
64 <when value="kmeans">
65 <param type="integer" argument="clustering_kmeans_k" value="4" min="0" optional="true" label="Number of clusters for k-means clustering"/>
66 </when>
67 </conditional>
68 <conditional name="clustering_save">
69 <param argument="clustering_save_format" type="select" label="Clustering Save Format" help="If set, for each cluster a structural file with the specified format will be generated, corresponding to the structure in the cluster with minimal energy.">
70 <option value="none" selected="true">Do not generate</option>
71 <option value="cell">CELL</option>
72 <option value="cif">CIF</option>
73 <option value="xyz">XYZ</option>
74 </param>
75 <when value="none"/>
76 <when value="cell">
77 <expand macro="supercell"/>
78 <param argument="mu_symbol" type="text" value="H:mu" optional="true" label="Muon symbol" help="The symbol to use for the muon when writing out the CASTEP custom species. Should be a valid chemical symbol followed by `:`, then custom text."/>
79 </when>
80 <when value="cif">
81 <expand macro="supercell"/>
82 </when>
83 <when value="xyz">
84 <expand macro="supercell"/>
85 </when>
86 </conditional>
43 </inputs> 87 </inputs>
44 <outputs> 88 <outputs>
45 <data label="Cluster report for $optimisation_results.name" name="cluster_report" format="txt" from_work_dir="${out_folder}/*clusters.txt"/> 89 <data label="Cluster report for $optimisation_results.name" name="cluster_report" format="txt" from_work_dir="${out_folder}/*clusters.txt"/>
46 <data label="Cluster data for $optimisation_results.name" name="cluster_data" format="txt" from_work_dir="${out_folder}/*clusters.dat"/> 90 <data label="Cluster data for $optimisation_results.name" name="cluster_data" format="txt" from_work_dir="${out_folder}/*clusters.dat"/>
91 <collection name="saved_structures" type="list" label="Minimal energy structures" format="txt">
92 <filter>clustering_save["clustering_save_format"] != "none"</filter>
93 <discover_datasets pattern="__name_and_ext__" directory="minimal_clusters"/>
94 </collection>
47 </outputs> 95 </outputs>
48 <tests> 96 <tests>
49 <test expect_num_outputs="2"> 97 <test expect_num_outputs="2">
50 <param name="optimisation_results" value="uep-out.zip" ftype="zip"/> 98 <param name="optimisation_results" value="uep-out.zip" ftype="zip"/>
99 <conditional name="clustering">
100 <param name="clustering_hier_t" value="0.2"/>
101 </conditional>
51 <output name="cluster_report" file="clustout-uep.txt" ftype="txt" lines_diff="2"/> 102 <output name="cluster_report" file="clustout-uep.txt" ftype="txt" lines_diff="2"/>
52 <output name="cluster_data" file="clustout-uep.dat" ftype="txt"/> 103 <output name="cluster_data" file="clustout-uep.dat" ftype="txt"/>
53 </test> 104 </test>
105 <test expect_num_outputs="3">
106 <param name="optimisation_results" value="uep-out.zip" ftype="zip"/>
107 <conditional name="clustering">
108 <param name="clustering_hier_t" value="0.2"/>
109 </conditional>
110 <conditional name="clustering_save">
111 <param name="clustering_save_format" value="cell"/>
112 </conditional>
113 <output name="cluster_report" file="clustout-uep.txt" ftype="txt" lines_diff="2"/>
114 <output name="cluster_data" file="clustout-uep.dat" ftype="txt"/>
115 <output_collection name="saved_structures" type="list" count="2"/>
116 </test>
117 <!-- Test optional save params -->
118 <test expect_num_outputs="3">
119 <param name="optimisation_results" value="uep-out.zip" ftype="zip"/>
120 <conditional name="clustering">
121 <param name="clustering_hier_t" value="0.2"/>
122 </conditional>
123 <conditional name="clustering_save">
124 <param name="clustering_save_format" value="cell"/>
125 <param name="supercell" value="2"/>
126 <param name="mu_symbol" value="H:nu"/>
127 </conditional>
128 <output name="cluster_report" file="clustout-uep.txt" ftype="txt" lines_diff="2"/>
129 <output name="cluster_data" file="clustout-uep.dat" ftype="txt"/>
130 <output_collection name="saved_structures" type="list" count="2">
131 <element name="Si_uep_min_cluster_1" file="Si_uep_min_cluster_1.cell"/>
132 <element name="Si_uep_min_cluster_2" file="Si_uep_min_cluster_2.cell"/>
133 </output_collection>
134 </test>
54 <test expect_num_outputs="2"> 135 <test expect_num_outputs="2">
55 <param name="optimisation_results" value="dftb-out.zip" ftype="zip"/> 136 <param name="optimisation_results" value="dftb-out.zip" ftype="zip"/>
137 <conditional name="clustering">
138 <param name="clustering_hier_t" value="0.2"/>
139 </conditional>
56 <output name="cluster_report" file="clustout-dftb.txt" ftype="txt" lines_diff="2"/> 140 <output name="cluster_report" file="clustout-dftb.txt" ftype="txt" lines_diff="2"/>
57 <output name="cluster_data" file="clustout-dftb.dat" ftype="txt"/> 141 <output name="cluster_data" file="clustout-dftb.dat" ftype="txt"/>
142 </test>
143 <!-- Test overwrite of values in the existing params.yaml -->
144 <test expect_num_outputs="2">
145 <param name="optimisation_results" value="uep-out.zip" ftype="zip"/>
146 <conditional name="clustering">
147 <param name="clustering_method" value="kmeans"/>
148 <param name="clustering_kmeans_k" value="2"/>
149 </conditional>
150 <!-- kmeans gives predictable clusters, but orders them randomly -->
151 <!-- To prevent this from affecting tests, sort the lines -->
152 <!-- in the report and use regex matching for the dat file -->
153 <output name="cluster_report" file="clustout-uep-kmeans.txt" ftype="txt" lines_diff="2" sort="true"/>
154 <output name="cluster_data" file="clustout-uep-kmeans.dat" ftype="txt" compare="re_match"/>
58 </test> 155 </test>
59 </tests> 156 </tests>
60 <help><![CDATA[ 157 <help><![CDATA[
61 Given a set of optimised muonated structures, clusters the structures based on similarity. 158 Given a set of optimised muonated structures, clusters the structures based on similarity.
62 159
160 This is intended to be used with the output from '`PyMuonSuite AIRSS UEP Optimise`_'.
63 If you used the 'Run UEP optimisation' tool for optimisation, the output from that tool can be used as the input to this one. 161 If you used the 'Run UEP optimisation' tool for optimisation, the output from that tool can be used as the input to this one.
64 If you are bringing files from elsewhere, make sure they fit the expected zip folder structure: 162 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:
65 163
66 .. code-block:: 164 .. code-block::
67 165
68 optimised-structures.zip/ 166 optimised-structures.zip/
69 ├─ muon-airss-out/ 167 ├─ muon-airss-out/
75 │ │ ├─ struct_N/ 173 │ │ ├─ struct_N/
76 │ │ │ ├─ <files for optimised struct_N go here> 174 │ │ │ ├─ <files for optimised struct_N go here>
77 ├─ input.cell 175 ├─ input.cell
78 ├─ params.yaml 176 ├─ params.yaml
79 177
80 This folder represents a run with the output folder name ``muon-airss-out``, the structure name ``struct``, and the UEP calculator. 178 This folder represents a run with the output folder name ``muon-airss-out``, the structure name ``struct``, and the ``uep`` calculator.
81 If you use different parameters, these names should match your own settings. (``dftb+`` and ``castep`` are used as folder names for the respective calculators) 179 If you use different parameters, these names should match your own settings (``dftb+`` and ``castep`` are used as folder names for the respective calculators).
82
83 The zip folder itself has been named ``optimised-structures.zip`` in this example, but it doesn't matter what you call it. 180 The zip folder itself has been named ``optimised-structures.zip`` in this example, but it doesn't matter what you call it.
84 181
85 The files ``input.cell`` and ``params.yaml`` must have those exact names. ``input.cell`` should be your original structure file, 182 The files ``input.cell`` and ``params.yaml`` must have those exact names. ``input.cell`` should be your original structure file,
86 and ``params.yaml`` is the YAML parameter file used to configure the clustering (as well as any prior muonation and optimisation). 183 and ``params.yaml`` is the YAML parameter file used to configure the muonation and optimisation.
87 You should have created this YAML file using the 'Create YAML for pm-muairss' tool or written it yourself, then passed it into the 184 This file is created automatically when using '`PyMuonSuite AIRSS UEP Optimise`_'.
88 'Generate muon structures' tool or pm-muairss. 185 Any parameters relating to the clustering process present in the original file will be overwritten with the values selected here.
89 186
90 Command-line usage: pm-muairss [-h] -t r structures parameter_file 187 Command-line usage: pm-muairss [-h] -t r structures parameter_file
188
189 .. _PyMuonSuite AIRSS UEP Optimise: /tool_runner?tool_id=pm_uep_opt
91 190
92 PyMuonSuite is distributed under the GPLv3 license. This tool wrapper is distributed under the MIT license. 191 PyMuonSuite is distributed under the GPLv3 license. This tool wrapper is distributed under the MIT license.
93 ]]></help> 192 ]]></help>
94 <citations> 193 <citations>
95 <citation type="bibtex"> 194 <citation type="doi">@PYMUONSUITE_CITATION@</citation>
96 @TOOL_CITATION@
97 </citation>
98 <citation type="doi">10.1063/1.5024450</citation> 195 <citation type="doi">10.1063/1.5024450</citation>
99 <citation type="doi">10.1063/1.5085197</citation> 196 <citation type="doi">10.1063/1.5085197</citation>
100 <citation type="doi">10.1063/5.0012381</citation> 197 <citation type="doi">10.1063/5.0012381</citation>
101 <citation type="bibtex"> 198 <citation type="bibtex">
102 @article {castep, 199 @article {castep,