Mercurial > repos > fmercuri > packmol_daimoners
diff packmol.xml @ 0:db62543db01a draft
Uploaded
author | fmercuri |
---|---|
date | Wed, 23 Jun 2021 21:27:52 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/packmol.xml Wed Jun 23 21:27:52 2021 +0000 @@ -0,0 +1,178 @@ +<tool id="packmol_daimoners" name="PACKMOL daimoners version" version="18.169.1"> + <description>- initial configurations for molecular dynamics simulations by packing optimization</description> + <macros> + <import>macros_packmol.xml</import> + </macros> + <requirements> + <requirement type="package" version="18.169">packmol</requirement> + </requirements> + <command detect_errors="exit_code"> + <![CDATA[ + python3 '$packmol_script' '$inputs' && + packmol < '$parameteroutfile' + ]]> + </command> + <configfiles> + <inputs name="inputs" /> + <configfile name="packmol_script"><![CDATA[ + +import os +import sys +import json + +from jinja2 import Environment, FileSystemLoader + +input_json_path = sys.argv[1] +params = json.load(open(input_json_path, "r")) + +# get the inputs +input_iter = [] +#for $i, $s in enumerate( $packmol_inputs ) ## enumerate( $packmol_format.packmol_inputs ) +pmfile_index = $i +pmfile_path = "${s.input.file_name}" +input_iter.append(pmfile_path) +params["packmol_inputs"][pmfile_index]["file"] = pmfile_path ## params["packmol_format"]["packmol_inputs"] +params["packmol_inputs"][pmfile_index]["datasetname"] = "${s.input.name}" ## params["packmol_format"]["packmol_inputs"] +#end for + +params["outfile"] = "$outfile" + +currentpath = "$__tool_directory__" # should work generally +template_environment = Environment(loader=FileSystemLoader(currentpath),lstrip_blocks=True, trim_blocks=True) +template = template_environment.get_template('template.j2') +print(params) + +with open("$parameteroutfile",'w+') as f: + f.write(template.render(params)) + +]]> + </configfile> + </configfiles> + <inputs> + + <!-- <conditional name="packmol_format"> + <param name="selected_format" type="select" label="Select a file format:"> + <option value="pdb" selected="true">pdb</option> + <option value="xyz">xyz</option> + <option value="tinker">tinker</option> + <option value="moldy">moldy</option> + </param> + <when value="pdb"> + <expand macro="multiple_input" name="packmol_inputs" format="pdb" label="pdb input with molecule type" help_text="Select a pdb file in .pdb format"/> + </when> + <when value="xyz"> + <expand macro="multiple_input" name="packmol_inputs" format="xyz" label="xyz input with molecule type" help_text="Select a xyz file in .xyz format"/> + </when> + <when value="tinker"> + <expand macro="multiple_input" name="packmol_inputs" format="tinker" label="tinker input with molecule type" help_text="Select a tinker file in .tinker format"/> + </when> + <when value="moldy"> + <expand macro="multiple_input" name="packmol_inputs" format="moldy" label="moldy input with molecule type" help_text="Select a moldy file in .moldy format"/> + </when> + </conditional> --> + <expand macro="multiple_input" name="packmol_inputs" format="pdb" label="PDB input with molecule type" help_text="Select a PDB file in .pdb format"/> + <section name="allparams" title="General parameters" expanded="false"> + <param name="tolerance" type="float" value="2.0" label="Distance tolerance" min="0.0" max="100.0"/> + <param name="nloop" type="integer" value="20" label="Maximum number of optimisation loops" min="1" max="10000"/> + <param name="maxit" type="integer" value="20" label="Maximum number of gencan iterations per loop" min="1" max="10000"/> + <param name="seed" type="integer" value="-1" label="Random number generator seed, default of -1 uses the computer time to set the seed" /> + </section> + </inputs> + <outputs> + <data format="pdb" name="outfile" label="${tool.name}: structure output"> + <!-- <change_format> + <when input="selected_format" value="pdb" format="pdb"/> + <when input="selected_format" value="xyz" format="xyz"/> + <when input="selected_format" value="tinker" format="tinker"/> + <when input="selected_format" value="moldy" format="moldy"/> + </change_format> --> + </data> + <data format="txt" name="parameteroutfile" label="${tool.name}: parameter output"/> + </outputs> + <tests> + <test> + <param name="selected_format" value="pdb"/> + <param name="packmol_inputs_0|input" value="water.pdb" ftype="pdb"/> + <param name="allparams.seed" value="101"/> + <output name="outfile" file="packmol_outfile1.pdb" compare="sim_size" delta="100000"> + <assert_contents> + <has_text text="HETATM 300 O HOH"/> + </assert_contents> + </output> + <output name="parameteroutfile" file="packmol_parameteroutfile_1.txt" compare="diff" lines_diff="6"/> + </test> + <test> + <param name="selected_format" value="pdb"/> + <param name="packmol_inputs_0|input" value="water.pdb" ftype="pdb"/> + <param name="packmol_inputs_1|input" value="urea.pdb" ftype="pdb"/> + <param name="packmol_inputs_0|structureparams|number" value="1000"/> + <param name="packmol_inputs_1|structureparams|number" value="400"/> + <param name="packmol_inputs_0|structureparams|constraints_repeat_0|constraints|constraint" value="box"/> + <param name="packmol_inputs_0|structureparams|constraints_repeat_0|constraints|xmax" value="40.0"/> + <param name="packmol_inputs_0|structureparams|constraints_repeat_0|constraints|ymax" value="40.0"/> + <param name="packmol_inputs_0|structureparams|constraints_repeat_0|constraints|zmax" value="40.0"/> + <param name="packmol_inputs_1|structureparams|constraints_repeat_0|constraints|constraint" value="box"/> + <param name="packmol_inputs_1|structureparams|constraints_repeat_0|constraints|xmax" value="40.0"/> + <param name="packmol_inputs_1|structureparams|constraints_repeat_0|constraints|ymax" value="40.0"/> + <param name="packmol_inputs_1|structureparams|constraints_repeat_0|constraints|zmax" value="40.0"/> + <param name="allparams.seed" value="-1"/> + <output name="outfile" file="packmol_outfile2.pdb" compare="sim_size" delta="100000"> + <assert_contents> + <has_text text="HETATM 3000 O HOH"/> + <has_text text="HETATM 6200 H 2 B"/> + </assert_contents> + </output> + <output name="parameteroutfile" file="packmol_parameteroutfile_2.txt" compare="diff" lines_diff="6"/> + </test> + </tests> + <help><![CDATA[ +.. class:: infomark + +**What it does** + +Packmol creates initial MD configurations from input molecules - for example, creating a water and urea mixture. + +.. class:: infomark + +**How it works** + +- Select a molecule file type e.g. pdb, xyz +- Select a single molecule from your history (can select multiple) +- For each molecule: + - choose how many molecules to create (number variable) + - optionally choose: + - molecular radius + - how to number the molecules (resnumber variable) + - choose one or more placement constraint(s). Each constraint has different parameters: + - for example, specify placement inside a cube of size 40 Angstroms placed at the origin + - all units are in Angstroms for distances and degrees for angles + +.. class:: infomark + +**Outputs created** + +- A pdb file; view this in Galaxy by clicking on the 'visualize' icon and choosing a viewer. The NGLViewer works well for small molecules. +- A packmol input script (for debugging and repeatability) + +.. class:: infomark + +**User guide and documentation** + +- Packmol `userguide`_ +- Calculating the number of molecules using the `volume guesser`_ + +.. class:: infomark + +**Known issues** + +- fixed constraint only allows 1 atom but this is not set for the user. The user has to set this parameter. The job may fail. + +.. _`userguide`: http://m3g.iqm.unicamp.br/packmol/userguide.shtml#more +.. _`volume guesser`: http://m3g.iqm.unicamp.br/packmol/utilities.shtml + +]]> + </help> + <citations> + <citation type="doi">10.1002/jcc.21224</citation> + </citations> +</tool>