diff muspinsim_config.xml @ 4:e1e338f56656 draft default tip

planemo upload for repository https://github.com/muon-spectroscopy-computational-project/muon-galaxy-tools/main/muspinsim_config commit 70a4d37ecdf5d586703cfc509922311e95d3205c
author muon-spectroscopy-computational-project
date Tue, 18 Jul 2023 13:26:20 +0000
parents 331d0776abb4
children
line wrap: on
line diff
--- a/muspinsim_config.xml	Fri Feb 03 15:39:07 2023 +0000
+++ b/muspinsim_config.xml	Tue Jul 18 13:26:20 2023 +0000
@@ -1,25 +1,10 @@
-<tool id="muspinsim_config" name="MuSpinSim Configure" version="@TOOL_VERSION@+galaxy@WRAPPER_VERSION@" python_template_version="3.5" profile="22.05" license="MIT">
+<tool id="muspinsim_config" name="MuSpinSim Configure" version="@MUSPINSIM_VERSION@+galaxy@WRAPPER_VERSION@" python_template_version="3.5" profile="22.05" license="MIT">
     <description>define simulation parameters</description>
     <macros>
-        <!-- version of underlying tool (PEP 440) -->
-        <token name="@TOOL_VERSION@">2.0.2</token>
         <!-- version of this tool wrapper (integer) -->
         <token name="@WRAPPER_VERSION@">0</token>
-        <!-- citation should be updated with every underlying tool version -->
-        <!-- typical fields to update are version, month, year, and doi -->
-        <token name="@TOOL_CITATION@">
-            @software{muspinsim,
-                author = {Sturniolo, Simone and Liborio, Leandro and Owen, Josh and Mudaraddi, Anish and Davies, Joel and Wilkinson, John and {Muon Spectroscopy Computational Project}},
-                license = {MIT},
-                title = {{muspinsim}},
-                url = {https://github.com/muon-spectroscopy-computational-project/muspinsim},
-                version = {v2.0.2},
-                month = {1},
-                year = {2023}
-                doi = {10.5281/zenodo.7568830}
-            }
-        </token>
         <import>config_macros.xml</import>
+        <import>muon_macros.xml</import>
     </macros>
     <creator>
         <person givenName="Anish" familyName="Mudaraddi" identifier="https://orcid.org/0000-0002-2135-2705"/>
@@ -28,83 +13,60 @@
         <organization url="https://muon-spectroscopy-computational-project.github.io/index.html" name="The Muon Spectroscopy Computational Project"/>
     </creator>
     <requirements>
-        <requirement type="package" version="@TOOL_VERSION@">muspinsim</requirement>
+        <requirement type="package" version="@MUSPINSIM_VERSION@">muspinsim</requirement>
     </requirements>
     <required_files>
         <include type="literal" path="sample_fitting_data.dat"/>
         <include type="literal" path="build_file.py"/>
     </required_files>
     <command detect_errors="exit_code"><![CDATA[
+        #if $use_structure_file_conditional.use_structure_file == "true":
+            #set generator_params = $use_structure_file_conditional.generator
+            structure_name_internal=\$(sed 's/ /\_/g' <<< '$generator_params.structure_file.name') &&
+            ln -s '$generator_params.structure_file' \$structure_name_internal &&
+            muspinsim-gen \$structure_name_internal $generator_params.number_closest --out muspinsim_gen_out.in
+            $generator_params.dipolar
+            $generator_params.quadrupolar
+            $generator_params.include_interatomic
+            --muon_symbol $generator_params.muon_symbol
+            #for $ignored_symbol in $generator_params.ignored_symbols:
+            --ignore_symbol $ignored_symbol.ignored_symbol
+            #end for
+            &&
+        #end if
         cp '${__tool_directory__}/sample_fitting_data.dat' ./fitting_data.dat &&
         python '${__tool_directory__}/build_file.py' inputs.json
     ]]></command>
     <configfiles>
-        <inputs name="inputs" filename="inputs.json"/>
+        <inputs name="inputs" data_style="paths" filename="inputs.json"/>
     </configfiles>
     <inputs>
-        <param type="text" name="out_file_prefix" label="Name" help="A name with which to label this configuration" optional="true" value="muspinsim"/>
-        <section name="spins" expanded="true" title="Spins">
-            <repeat name="spins" title="Spins to simulate" min="1" help="Specify the spins to be used in the system. This should include a muon (mu) and one or more electrons (e)">
-                <conditional name="spin_options">
-                    <param name="spin_preset" type="select" value="mu" label="Species" help="Select 'custom' to define own">
-                        <option selected="true" value="mu">mu</option>
-                        <option value="e">e</option>
-                        <option value="custom">custom</option>
-                    </param>
-                    <when value="custom">
-                        <param name="spin" optional="false" type="text" label="Species name"/>
-                        <param name="atomic_mass" optional="true" type="integer" min="0" value="" label="Atomic mass" help="Leave blank to use default mass - whole numbers only"/>
-                    </when>
-                    <when value="mu"/>
-                    <when value="e"/>
-                </conditional>
-            </repeat>
-        </section>
-        <section name="interaction_params" expanded="true" title="Spin Interactions" help="">
-            <repeat name="interactions" title="Interactions to simulate" help="Add couplings between spins, and/or dissipation terms. Interaction terms available: Zeeman, hyperfine, dipolar, quadrupolar or dissipation. See MuSpinSim docs for more info">
-                <conditional name="interaction_options">
-                    <param name="interaction" type="select" label="Choose interaction type">
-                        <option value="zeeman">Zeeman</option>
-                        <option value="hyperfine">hyperfine</option>
-                        <option value="dipolar">dipolar</option>
-                        <option value="quadrupolar">quadrupolar</option>
-                        <option value="dissipation">dissipation</option>
-                    </param>
-                    <when value="zeeman">
-                        <param name="zeeman_index" type="integer" value="" label="Index of coupled spin" min="1" help="Index refers to the order of the spins listed in 'spins' section.  The first spin in the list has index 1, the second has index 2, and so on."/>
-                        <param name="zeeman_vector" type="text" value="" label="Zeeman coupling vector" help="Define 1X3 vector for local magnetic field coupling (T). Allows default expressions, constants and functions (see help)"/>
-                    </when>
-                    <when value="hyperfine">
-                        <param name="hfine_index" type="integer" value="" label="Index of nuclear coupled spin" min="1" help="Non-electronic spin - muon or otherwise. Index refers to the order of the spins listed in 'spins' section.  The first spin in the list has index 1, the second has index 2, and so on."/>
-                        <param name="hfine_e_index" type="integer" value="" optional="true" min="1" label="Index of electronic coupled spin" help="Optional, will use first defined electronic spin if unspecified"/>
-                        <param name="hfine_matrix" area="true" type="text" value="" label="Hyperfine coupling tensor" help="Define 3X3 tensor for coupling between electron and non-electron spins (in MHz). Allows default expressions, constants and functions (see help)">
-                            <sanitizer>
-                                <valid initial="string.printable">
-                                </valid>
-                            </sanitizer>
-                        </param>
-                    </when>
-                    <when value="dipolar">
-                        <param name="di_index" type="integer" value="" min="1" label="Index of 1st coupled spin" help="Index refers to the order of the spins listed in 'spins' section.  The first spin in the list has index 1, the second has index 2, and so on."/>
-                        <param name="di_index_2" type="integer" value="" label="Index of 2nd coupled spin" help="Index refers to the order of the spins listed in 'spins' section.  The first spin in the list has index 1, the second has index 2, and so on."/>
-                        <param name="di_vector" type="text" value="" label="Dipole coupling vector" help="Define 1X3 vector for coupling between two spins (Angstrom). Allows default expressions, constants and functions (see help)"/>
-                    </when>
-                    <when value="quadrupolar">
-                        <param name="quad_index" type="integer" value="" label="Index of coupled spin" help="Index refers to the order of the spins listed in 'spins' section.  The first spin in the list has index 1, the second has index 2, and so on."/>
-                        <param name="quad_matrix" area="true" type="text" value="" label="Electric Field Gradient tensor" help="Define 3X3 tensor (in atomic units) for quadrupolar coupling. Allows default expressions, constants and functions (see help). Warning: spins with zero quadrupole moment will have zero coupling regardless of the input">
-                            <sanitizer>
-                                <valid initial="string.printable">
-                                </valid>
-                            </sanitizer>
-                        </param>
-                    </when>
-                    <when value="dissipation">
-                        <param name="dis_index" type="integer" value="" label="Index of spin with dissipation" help="Index refers to the order of the spins listed in 'spins' section.  The first spin in the list has index 1, the second has index 2, and so on."/>
-                        <param name="dis_val" type="text" value="" label="Dissipation" help="Define dissipation term (MHz). Allows default expressions, constants and functions (see help)"/>
-                    </when>
-                </conditional>
-            </repeat>
-        </section>
+        <param name="out_file_prefix" type="text" label="Name" help="A name with which to label this configuration" optional="true" value="muspinsim"/>
+        <conditional name="use_structure_file_conditional">
+            <param name="use_structure_file" type="select" display="radio" value="false" label="Generate interactions from a file?" help="Use a file containing a structure to obtain the spins and generate interactions.">
+                <option value="true">Yes</option>
+                <option value="false" selected="true">No</option>
+            </param>
+            <when value="true">
+                <section name="generator" expanded="true" title="Generator">
+                    <expand macro="generator_options"/>
+                </section>
+                <section name="spins" expanded="true" title="Additional Spins">
+                    <expand macro="additional_spin_options"/>
+                </section>
+                <section name="interaction_params" expanded="true" title="Additional Spin Interactions" help="Use this section to include any interactions that are not automatically generated from the structure file. The muon index will always be 1, then the rest of the requested number of spins, N, will be in order of distance to the muon (excluding any ignored symbols). So any spins added above will have indices starting at N + 2.">
+                    <expand macro="interaction_options"/>
+                </section>
+            </when>
+            <when value="false">
+                <section name="spins" expanded="true" title="Spins">
+                    <expand macro="spin_options"/>
+                </section>
+                <section name="interaction_params" expanded="true" title="Spin Interactions" help="">
+                    <expand macro="interaction_options"/>
+                </section>
+            </when>
+        </conditional>
         <section name="experiment_params" expanded="true" title="Experiment Parameters">
             <conditional name="experiment">
                 <param name="experiment_preset" type="select" value="custom" display="radio" label="Experiment type" help="Experiment preset to use. Avoided Level Crossing (ALC): sets polarization to longitudinal, x-axis to field and y-axis to integral. Zero field: sets polarization to transverse, field to 0, x-axis to time and y-axis to asymmetry. Choose custom for no preset">
@@ -169,6 +131,7 @@
     <tests>
         <test expect_num_outputs="1">
             <param name="out_file_prefix" value="test_1"/>
+            <param name="use_structure_file" value="false"/>
             <param name="spin_preset" value="custom"/>
             <param name="spin" value="H"/>
             <param name="spin_preset" value="mu"/>
@@ -184,6 +147,7 @@
         </test>
         <test expect_num_outputs="1">
             <param name="out_file_prefix" value="test_2"/>
+            <param name="use_structure_file" value="false"/>
             <param name="experiment_preset" value="custom"/>
             <param name="spin_preset" value="e"/>
             <param name="spin_preset" value="mu"/>
@@ -199,6 +163,7 @@
         </test>
         <test expect_num_outputs="1">
             <param name="out_file_prefix" value="test_3"/>
+            <param name="use_structure_file" value="false"/>
             <param name="spin_preset" value="custom"/>
             <param name="spin" value="H"/>
             <param name="spin_preset" value="mu"/>
@@ -218,6 +183,7 @@
         </test>
         <test expect_num_outputs="1">
             <param name="out_file_prefix" value="test_4"/>
+            <param name="use_structure_file" value="false"/>
             <param name="spin_preset" value="custom"/>
             <param name="spin" value="F"/>
             <param name="spin_preset" value="custom"/>
@@ -252,6 +218,7 @@
         </test>
         <test expect_num_outputs="1">
             <param name="out_file_prefix" value="test_5"/>
+            <param name="use_structure_file" value="false"/>
             <param name="spin_preset" value="mu"/>
             <param name="interaction" value="dissipation"/>
             <param name="dis_index" value="1"/>
@@ -270,6 +237,7 @@
         </test>
         <test expect_num_outputs="1">
             <param name="out_file_prefix" value="test_6"/>
+            <param name="use_structure_file" value="false"/>
             <param name="experiment_preset" value="zero_field"/>
             <param name="spin_preset" value="custom"/>
             <param name="spin" value="H"/>
@@ -284,6 +252,7 @@
         </test>
         <test expect_num_outputs="1">
             <param name="out_file_prefix" value="test_7"/>
+            <param name="use_structure_file" value="false"/>
             <param name="experiment_preset" value="custom"/>
             <param name="spin_preset" value="custom"/>
             <param name="spin" value="H"/>
@@ -298,6 +267,86 @@
             <param name="average_axes" value="orientation,temperature"/>
             <output name="out_file" file="test_7.in" ftype="txt" compare="diff"/>
         </test>
+        <!-- The tests below use a structure file to generate interactions -->
+
+        <!-- Default generator values with cell file -->
+        <test expect_num_outputs="1">
+            <param name="out_file_prefix" value="test_8"/>
+            <param name="use_structure_file" value="true"/>
+            <param name="structure_file" value="Basic.cell" ftype="cell"/>
+            <param name="experiment_preset" value="custom"/>
+            <param name="time" value="range(0,8.0,1000)"/>
+            <output name="out_file" file="test_8.in" ftype="txt" compare="diff"/>
+        </test>
+        <!-- Magres file -->
+        <test expect_num_outputs="1">
+            <param name="out_file_prefix" value="test_9"/>
+            <param name="use_structure_file" value="true"/>
+            <param name="structure_file" value="Basic.magres" ftype="cell"/>
+            <param name="number_closest" value="8"/>
+            <param name="dipolar" value="true"/>
+            <param name="quadrupolar" value="false"/>
+            <param name="ignored_symbol" value="Si"/>
+            <param name="include_interatomic" value="false"/>
+            <param name="experiment_preset" value="custom"/>
+            <param name="time" value="range(0,8.0,1000)"/>
+            <output name="out_file" file="test_9.in" ftype="txt" compare="diff"/>
+        </test>
+        <!-- Magres file with quadrupolar and interatomic -->
+        <test expect_num_outputs="1">
+            <param name="out_file_prefix" value="test_10"/>
+            <param name="use_structure_file" value="true"/>
+            <param name="structure_file" value="Basic.magres" ftype="cell"/>
+            <param name="dipolar" value="true"/>
+            <param name="quadrupolar" value="true"/>
+            <param name="ignored_symbol" value="Si"/>
+            <param name="include_interatomic" value="true"/>
+            <param name="experiment_preset" value="custom"/>
+            <param name="time" value="range(0,8.0,1000)"/>
+            <output name="out_file" file="test_10.in" ftype="txt" compare="diff"/>
+        </test>
+        <!-- Magres file with quadrupolar, and extra interactions as well -->
+        <test expect_num_outputs="1">
+            <param name="out_file_prefix" value="test_11"/>
+            <param name="use_structure_file" value="true"/>
+            <param name="structure_file" value="Basic.magres" ftype="cell"/>
+            <param name="dipolar" value="true"/>
+            <param name="quadrupolar" value="true"/>
+            <param name="ignored_symbol" value="Si"/>
+            <param name="include_interatomic" value="false"/>
+            <param name="interaction" value="hyperfine"/>
+            <param name="hfine_index" value="2"/>
+            <param name="hfine_matrix" value="[580 5  10 5   580 9 10  9   580]"/>
+            <param name="interaction" value="hyperfine"/>
+            <param name="hfine_index" value="3"/>
+            <param name="hfine_matrix" value="[(300/2)  3   4*10 ], [3  15*10 6-3+2]  ,[4  5   15 ]"/>
+            <param name="experiment_preset" value="custom"/>
+            <param name="time" value="range(0,8.0,1000)"/>
+            <output name="out_file" file="test_11.in" ftype="txt" compare="diff"/>
+        </test>
+        <!-- Test adding extra spins -->
+        <test expect_num_outputs="1">
+            <param name="out_file_prefix" value="test_12"/>
+            <param name="use_structure_file" value="true"/>
+            <param name="structure_file" value="Basic.magres" ftype="cell"/>
+            <param name="dipolar" value="true"/>
+            <param name="quadrupolar" value="true"/>
+            <param name="ignored_symbol" value="Si"/>
+            <param name="include_interatomic" value="false"/>
+            <param name="spin_preset" value="e"/>
+            <param name="spin_preset" value="custom"/>
+            <param name="spin" value="F"/>
+            <param name="atomic_mass" value="19"/>
+            <param name="interaction" value="hyperfine"/>
+            <param name="hfine_index" value="2"/>
+            <param name="hfine_matrix" value="[580 5  10 5   580 9 10  9   580]"/>
+            <param name="interaction" value="hyperfine"/>
+            <param name="hfine_index" value="3"/>
+            <param name="hfine_matrix" value="[(300/2)  3   4*10 ], [3  15*10 6-3+2]  ,[4  5   15 ]"/>
+            <param name="experiment_preset" value="custom"/>
+            <param name="time" value="range(0,8.0,1000)"/>
+            <output name="out_file" file="test_12.in" ftype="txt" compare="diff"/>
+        </test>
     </tests>
     <help><![CDATA[
     Tool to create input parameter file for MuSpinSim.
@@ -377,8 +426,6 @@
             }
         </citation>
         <citation type="doi">10.1103/PhysRevLett.56.2720</citation>
-        <citation type="bibtex">
-            @TOOL_CITATION@
-        </citation>
+        <citation type="doi">@MUSPINSIM_CITATION@</citation>
     </citations>
 </tool>