view pm_yaml_config.xml @ 2:2d9b2ffec9d5 draft

planemo upload for repository https://github.com/muon-spectroscopy-computational-project/muon-galaxy-tools/main/pm_yaml_config commit 4f06b404d8b7fb83995f3052faa7e2ec7811f507
author muon-spectroscopy-computational-project
date Fri, 03 Feb 2023 15:40:12 +0000
parents 6f271bc31aa8
children 03f4f2aaa91c
line wrap: on
line source

<tool id="pm_yaml_config" name="PyMuonSuite AIRSS Configure" version="@TOOL_VERSION@+galaxy@WRAPPER_VERSION@" python_template_version="3.5" profile="22.05" license="MIT">
    <description>define AIRSS parameters</description>
    <macros>
        <!-- version of underlying tool (PEP 440) -->
        <!-- this wrapper doesn't have pymuonsuite as a dependency, but it will change according
             to the pymuonsuite interface, so follow the same versioning pattern -->
        <token name="@TOOL_VERSION@">0.2.3</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{Sturniolo_pymuon-suite_2022,
                author = {Sturniolo, Simone and Liborio, Leandro and Chadwick, Eli and Murgatroyd, Laura and Laverack, Adam and Mudaraddi, Anish and {Muon Spectroscopy Computational Project}},
                license = {GPL-3.0},
                month = {8},
                title = {{pymuon-suite}},
                url = {https://github.com/muon-spectroscopy-computational-project/pymuon-suite},
                version = {v0.2.3},
                doi = {10.5281/zenodo.7025644},
                year = {2022}
            }
        </token>
        <import>muon_macros.xml</import>
    </macros>
    <creator>
        <person givenName="Jyothish" familyName="Thomas" identifier="https://orcid.org/0000-0003-4724-6924"/>
        <person givenName="Eli" familyName="Chadwick" url="https://github.com/elichad" identifier="https://orcid.org/0000-0002-0035-6475"/>
        <organization url="https://muon-spectroscopy-computational-project.github.io/index.html" name="The Muon Spectroscopy Computational Project"/>
    </creator>
    <requirements>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
        touch outputx.yaml &&
        ([[ ! -z '$general_params.poisson_r' ]] && printf 'poisson_r: $general_params.poisson_r\n'>>outputx.yaml || ( >&2 echo "poisson_r empty" && exit 2)) &&
        ([[ ! -z '$general_params.name' ]] && printf 'name: $general_params.name\n'>>outputx.yaml || ( >&2 echo "structure name is empty" && exit 2)) &&
        ([[ ! -z '$general_params.charged' ]] && printf 'charged: $general_params.charged\n'>>outputx.yaml || ( >&2 echo "charged muon empty" && exit 2)) &&
        ([[ ! -z '$general_params.geom_steps' ]] && printf 'geom_steps: $general_params.geom_steps\n'>>outputx.yaml || ( >&2 echo "geom_steps empty" && exit 2)) &&
        ([[ ! -z '$general_params.vdw_scale' ]] && printf 'vdw_scale: $general_params.vdw_scale\n'>>outputx.yaml || ( >&2 echo "vdw_scale empty" && exit 2)) &&
        ([[ ! -z '$calculator_params.calculator_cond.calculator' ]] && printf 'calculator: $calculator_params.calculator_cond.calculator\n'>>outputx.yaml || ( >&2 echo "calculator unselected" && exit 2)) &&
        ([[ ! -z '$general_params.geom_force_tol' ]] && printf 'geom_force_tol: $general_params.geom_force_tol\n'>>outputx.yaml || ( >&2 echo "geom_force_tol empty" && exit 2)) &&
        ([[ ! -z '$general_params.out_folder' ]] && printf 'out_folder: $general_params.out_folder\n'>>outputx.yaml || printf "out_folder: muon-airss-out\n">>outputx.yaml) &&
        ([[ ! -z '$general_params.random_seed' ]] && printf 'random_seed: $general_params.random_seed\n'>>outputx.yaml || ( echo "random_seed empty")) &&
        ([[ ! -z '$clustering_params.supercell' ]] && (printf 'supercell: $clustering_params.supercell\n' | sed "s/__ob__/[/g" | sed "s/__cb__/]/g" )>>outputx.yaml || ( >&2 echo "supercell empty" && exit 2)) &&
        ([[ ! -z '$clustering_params.k_points_grid' ]] && (printf 'k_points_grid: $clustering_params.k_points_grid\n' | sed "s/__ob__/[/g" | sed "s/__cb__/]/g" ) >>outputx.yaml || ( >&2 echo "k_points_grid empty" && exit 2)) &&
        ([[ ! -z '$clustering_params.max_scc_steps' ]] && printf 'max_scc_steps: $clustering_params.max_scc_steps\n'>>outputx.yaml || ( >&2 echo "max_scc_steps empty")) &&
        #if str($calculator_params.calculator_cond.calculator)=="uep":
            ([[ ! -z '$calculator_params.calculator_cond.uep_gw_factor' ]] && printf 'uep_gw_factor: $calculator_params.calculator_cond.uep_gw_factor\n'>>outputx.yaml || ( >&2 echo "uep gaussian width unset" && exit 2)) &&
            ([[ ! -z '$calculator_params.calculator_cond.uep_chden' ]] && printf 'uep_chden: $calculator_params.calculator_cond.uep_chden.value\n'>>outputx.yaml || echo "den_fmt path unset") &&
        #else if str($calculator_params.calculator_cond.calculator)=="CASTEP":
            ([[ ! -z '$calculator_params.calculator_cond.castep_command' ]] && printf 'castep_command: $calculator_params.calculator_cond.castep_command\n'>>outputx.yaml || echo "CASTEP command unset") &&
            ([[ ! -z '$calculator_params.calculator_cond.castep_param' ]] && printf 'castep_param: $calculator_params.calculator_cond.castep_param\n'>>outputx.yaml || echo "CASTEP param unset") &&
            ([[ ! -z '$calculator_params.calculator_cond.mu_symbol' ]] && printf 'mu_symbol: $calculator_params.calculator_cond.mu_symbol\n'>>outputx.yaml || echo "mu symbol unset") &&
        #else if str($calculator_params.calculator_cond.calculator)=="dftb+":
            ([[ ! -z '$calculator_params.calculator_cond.dftb_set' ]] && printf 'dftb_set: $calculator_params.calculator_cond.dftb_set\n'>>outputx.yaml || ( >&2 echo "dftb parameter set unselected" && exit 2)) &&
            ([[ ! -z '$calculator_params.calculator_cond.dftb_optionals' ]] && (printf 'dftb_optionals: $calculator_params.calculator_cond.dftb_optionals\n' | sed "s/__ob__/[/g" | sed "s/__cb__/]/g" ) >>outputx.yaml || echo "dftb optional json files unset") &&
            ([[ ! -z '$calculator_params.calculator_cond.dftb_pbc' ]] && printf 'dftb_pbc: $calculator_params.calculator_cond.dftb_pbc\n'>>outputx.yaml || echo "dftb periodic boundary condition unselected") &&
        #else if str($calculator_params.calculator_cond.calculator)=="all":
            ([[ ! -z '$calculator_params.calculator_cond.uep_gw_factor' ]] && printf 'uep_gw_factor: $calculator_params.calculator_cond.uep_gw_factor\n'>>outputx.yaml || echo "uep gaussian width unset") &&
            ([[ ! -z '$calculator_params.calculator_cond.uep_chden' ]] && printf 'uep_chden: $calculator_params.calculator_cond.uep_chden\n'>>outputx.yaml || echo "den_fmt path unset") &&
            ([[ ! -z '$calculator_params.calculator_cond.castep_command' ]] && printf 'castep_command: $calculator_params.calculator_cond.castep_command\n'>>outputx.yaml || echo "CASTEP command unset") &&
            ([[ ! -z '$calculator_params.calculator_cond.castep_param' ]] && printf 'castep_param: $calculator_params.calculator_cond.castep_param\n'>>outputx.yaml || echo "CASTEP param unset") &&
            ([[ ! -z '$calculator_params.calculator_cond.mu_symbol' ]] && printf 'mu_symbol: $calculator_params.calculator_cond.mu_symbol\n'>>outputx.yaml || echo "mu symbol unset") &&
            ([[ ! -z '$calculator_params.calculator_cond.dftb_set' ]] && printf 'dftb_set: $calculator_params.calculator_cond.dftb_set\n'>>outputx.yaml || echo "dftb parameter set unselected") &&
            ([[ ! -z '$calculator_params.calculator_cond.dftb_optionals' ]] && (printf 'dftb_optionals: $calculator_params.calculator_cond.dftb_optionals\n' | sed "s/__ob__/[/g" | sed "s/__cb__/]/g" ) >>outputx.yaml || echo "dftb optional json files unset") &&
            ([[ ! -z '$calculator_params.calculator_cond.dftb_pbc' ]] && printf 'dftb_pbc: $calculator_params.calculator_cond.dftb_pbc\n'>>outputx.yaml || echo "dftb periodic boundary condition unselected") &&
        #end if
        ([[ ! -z '$clustering_params.clustering.clustering_method' ]] && printf 'clustering_method: $clustering_params.clustering.clustering_method\n'>>outputx.yaml || ( echo "clustering method unselected" && exit 2)) &&
        #if str($clustering_params.clustering.clustering_method)=="hier":
            ([[ ! -z '$clustering_params.clustering.clustering_hier_t' ]] && printf 'clustering_hier_t: $clustering_params.clustering.clustering_hier_t\n'>>outputx.yaml || echo "clustering_hier_t unset") &&
        #else if str($clustering_params.clustering.clustering_method)=="kmeans":
            ([[ ! -z '$clustering_params.clustering.clustering_kmeans_k' ]] && printf 'clustering_kmeans_k: $clustering_params.clustering.clustering_kmeans_k\n'>>outputx.yaml || echo "clustering_kmeans_k unset") &&
        #end if
        ln -s outputx.yaml output.yaml
    ]]></command>
    <inputs>
        <section name="general_params" expanded="true" title="General Parameters">
            <param type="float" argument="poisson_r" value="0.8" min="0.0" label="Poisson radius" help=" Poisson sphere radius to use for random generation. No two starting muon positions will be closer than this distance. Smaller values make for bigger structure sets."/>
            <param type="text" argument="name" value="struct" label="Name" help="Name of the structure. This name will be postfixed with a unique number, e.g. struct_001 for each generated structure."/>
            <param argument="charged" type="boolean" checked="true" label="Charged muon" help="If true, the muon will be charged. Otherwise, will be muonium (with an accompanying electron). Must be true for UEP calculations."/>
            <param type="integer" argument="geom_steps" value="30" min="0" label="Geometry optimization steps" help="Maximum number of geometry optimisation steps."/>
            <param type="float" argument="vdw_scale" value="0.5" min="0.0" label="Van der Waals scale" help="Van der Waals scaling factor to use when generating muon sites to avoid existing atoms. Smaller values will allow muons to get closer to the other ions."/>
            <param type="text" argument="out_folder" optional="true" value="muon-airss-out" label="Output folder name" help="Name to call the output folder used to store the files that the script generates."/>
            <param type="float" argument="geom_force_tol" value="0.05" min="0.0" label="Geometry optimization tolerance" help="Tolerance on geometry optimisation in units of eV/Å."/>
            <param type="integer" argument="random_seed" label="Random Seed" optional="true" help="Random seed for pymuonsuite."/>
        </section>
        <section name="calculator_params" expanded="true" title="Calculator parameters">
            <conditional name="calculator_cond">
                <param type="select" display="radio" label="Optimization calculator" argument="calculator" value="uep" help="Calculator to generate structure files for. Must be a single word or a comma seperated list of values. Currently supported calculators are CASTEP, DFTB+ and UEP. Can also select 'all' to generate files for all calculators.">
                    <option value="uep">UEP</option>
                    <option value="castep">CASTEP</option>
                    <option value="dftb+">DFTB+</option>
                    <option value="all">all</option>
                </param>
                <when value="uep">
                    <param type="float" argument="uep_gw_factor" optional="true" value="5.0" min="0.0" label="Gaussian width factor" help="Gaussian width factor for UEP calculation. Higher values will make the potential of atomic nuclei closer to the point-like approximation but may introduce artifacts."/>
                    <param type="text" argument="uep_chden" optional="true" label="Path to .den_fmt and .castep files" help="Name of the .den_fmt file containing the electronic density for an Unperturbed Electrostatic Potential optimisation. The corresponding .castep file must be with the same seedname. Only required for use outside Muon Galaxy"/>
                </when>
                <when value="castep">
                    <param type="text" argument="castep_command" optional="true" value="castep.serial" label="CASTEP command" help="Command to use to run CASTEP."/>
                    <param type="text" argument="castep_param" optional="true" label="PARAM path" help="File path to the CASTEP parameter file."/>
                    <param type="text" argument="mu_symbol" optional="true" label="Muon symbol" value="H:mu" help="The symbol to use for the muon when writing out the CASTEP custom species."/>
                </when>
                <when value="dftb+">
                    <expand macro="dftb+"/>
                    <expand macro="dftb_optionals"/>
                </when>
                <when value="all">
                    <param type="float" argument="uep_gw_factor" optional="true" value="5.0" min="0.0" label="Gaussian width factor" help="Gaussian width factor for UEP calculation. Higher values will make the potential of atomic nuclei closer to the point-like approximation but may introduce artifacts."/>
                    <param type="text" argument="uep_chden" optional="true" label="Path to .den_fmt and CASTEP files" help="Name of the .den_fmt file containing the electronic density for an Unperturbed Electrostatic Potential optimisation. The corresponding .castep file must be with the same seedname. Only required for use outside Muon Galaxy"/>
                    <param type="text" argument="castep_command" optional="true" value="castep.serial" label="CASTEP command" help="Command to use to run CASTEP."/>
                    <param type="text" argument="castep_param" optional="true" label="PARAM path" help="File path to the CASTEP parameter file."/>
                    <param type="text" argument="mu_symbol" optional="true" label="Muon symbol" value="H:mu" help="The symbol to use for the muon when writing out the CASTEP custom species."/>
                    <expand macro="dftb+"/>
                    <expand macro="dftb_optionals"/>
                </when>
            </conditional>
        </section>
        <section name="clustering_params" expanded="true" title="Clustering Parameters">
            <conditional name="clustering">
                <param type="select" argument="clustering_method" display="radio" label="Clustering method" value="hier">
                    <option value="hier">hierarchical</option>
                    <option value="kmeans">k-means</option>
                </param>
                <when value="hier">
                    <param type="float" argument="clustering_hier_t" value="0.3" min="0.0" optional="true" label="t parameter for hierarchical clustering"/>
                </when>
                <when value="kmeans">
                    <param type="integer" argument="clustering_kmeans_k" value="4" min="0" optional="true" label="Number of clusters for k-means clustering"/>
                </when>
            </conditional>
            <param type="text" argument="supercell" value="1" label="Supercell" help="Supercell size and shape to use. 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.">
                <validator type="regex" message="Input should only contain whitespace, '[', ']', ',' and digits.">^[\s\d,\[\]]+$</validator>
            </param>
            <expand macro="k_points_grid"/>
            <param type="integer" argument="max_scc_steps" value="200" min="0" optional="true" label="Max SCC steps" help="If applicable, max number of SCC steps to perform before giving up. Default is 200 for DFTB+ and 30 for CASTEP."/>
        </section>
    </inputs>
    <outputs>
        <data label="Configuration for $general_params.name" name="out_yaml" format="yaml" from_work_dir="output.yaml"/>
    </outputs>
    <tests>
        <test expect_num_outputs="1">
            <section name="general_params">
                <param name="poisson_r" value="0.8"/>
                <param name="name" value="Si"/>
                <param name="charged" value="true"/>
                <param name="geom_steps" value="300"/>
                <param name="vwd_scale" value="0.25"/>
                <param name="out_folder" value="Si-out"/>
                <param name="geom_force_tol" value="0.05"/>
            </section>
            <section name="calculator_params">
                <conditional name="calculator_cond">
                    <param name="calculator" value="uep"/>
                    <param name="uep_gw_factor" value="0.4"/>
                    <param name="uep_chden" value="test.den_fmt"/>
                </conditional>
            </section>
            <section name="clustering_params">
                <conditional name="clustering">
                    <param name="clustering_method" value="hier"/>
                    <param name="clustering_hier_t" value="0.2"/>
                </conditional>
                <param name="supercell" value="1"/>
                <param name="k_points_grid" value="[1,1,1]"/>
                <param name="max_scc_steps" value="200"/>
            </section>
            <output name="out_yaml" file="config.yaml" ftype="yaml" delta="100"/>
        </test>
        <test expect_num_outputs="1">
            <section name="general_params">
            </section>
            <section name="calculator_params">
            </section>
            <section name="clustering_params">
            </section>
            <output name="out_yaml" file="config-default.yaml" ftype="yaml" delta="100"/>
        </test>
        <test expect_num_outputs="1">
            <section name="general_params">
            </section>
            <section name="calculator_params">
                <conditional name="calculator_cond">
                    <param name="calculator" value="dftb+"/>
                </conditional>
            </section>
            <section name="clustering_params">
            </section>
            <output name="out_yaml" file="config-dftb.yaml" ftype="yaml" delta="100"/>
        </test>
        <test expect_num_outputs="1">
            <section name="general_params">
            </section>
            <section name="calculator_params">
                <conditional name="calculator_cond">
                    <param name="calculator" value="all"/>
                </conditional>
            </section>
            <section name="clustering_params">
            </section>
            <output name="out_yaml" file="config-all.yaml" ftype="yaml" delta="100"/>
        </test>
        <test expect_failure="true">
            <section name="general_params">
            </section>
            <section name="calculator_params">
            </section>
            <section name="clustering_params">
                <param name="supercell" value="bad format"/>
            </section>
        </test>
        <test expect_failure="true">
            <section name="general_params">
            </section>
            <section name="calculator_params">
            </section>
            <section name="clustering_params">
                <param name="k_points_grid" value="bad format"/>
            </section>
        </test>
    </tests>
    <help><![CDATA[
        Creates a YAML configuration file from input parameters.

        PyMuonSuite is distributed under the GPLv3 license. This tool wrapper is distributed under the MIT license.

      **DFTB+ parameter sets:**

    +------------+-------------------------------------+-----------------------------------+
    | set        |                elements             |       context                     |
    +============+=====================================+===================================+
    |  3ob-3-1   | Br-C-Ca-Cl-F-H-I-K-Mg-N-Na-O-P-S-Zn | DFTB3 files for bio and organic   |
    |            |                                     | molecules                         |
    +------------+-------------------------------------+-----------------------------------+
    |  pbc-0-3   | Si - F - O - N - C - H / Fe         | SCC files for solids and surfaces |
    +------------+-------------------------------------+-----------------------------------+
    ]]></help>
    <citations>
        <citation type="bibtex">
            @TOOL_CITATION@
        </citation>
    </citations>
</tool>