comparison packmol.xml @ 0:db62543db01a draft

Uploaded
author fmercuri
date Wed, 23 Jun 2021 21:27:52 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:db62543db01a
1 <tool id="packmol_daimoners" name="PACKMOL daimoners version" version="18.169.1">
2 <description>- initial configurations for molecular dynamics simulations by packing optimization</description>
3 <macros>
4 <import>macros_packmol.xml</import>
5 </macros>
6 <requirements>
7 <requirement type="package" version="18.169">packmol</requirement>
8 </requirements>
9 <command detect_errors="exit_code">
10 <![CDATA[
11 python3 '$packmol_script' '$inputs' &&
12 packmol < '$parameteroutfile'
13 ]]>
14 </command>
15 <configfiles>
16 <inputs name="inputs" />
17 <configfile name="packmol_script"><![CDATA[
18
19 import os
20 import sys
21 import json
22
23 from jinja2 import Environment, FileSystemLoader
24
25 input_json_path = sys.argv[1]
26 params = json.load(open(input_json_path, "r"))
27
28 # get the inputs
29 input_iter = []
30 #for $i, $s in enumerate( $packmol_inputs ) ## enumerate( $packmol_format.packmol_inputs )
31 pmfile_index = $i
32 pmfile_path = "${s.input.file_name}"
33 input_iter.append(pmfile_path)
34 params["packmol_inputs"][pmfile_index]["file"] = pmfile_path ## params["packmol_format"]["packmol_inputs"]
35 params["packmol_inputs"][pmfile_index]["datasetname"] = "${s.input.name}" ## params["packmol_format"]["packmol_inputs"]
36 #end for
37
38 params["outfile"] = "$outfile"
39
40 currentpath = "$__tool_directory__" # should work generally
41 template_environment = Environment(loader=FileSystemLoader(currentpath),lstrip_blocks=True, trim_blocks=True)
42 template = template_environment.get_template('template.j2')
43 print(params)
44
45 with open("$parameteroutfile",'w+') as f:
46 f.write(template.render(params))
47
48 ]]>
49 </configfile>
50 </configfiles>
51 <inputs>
52
53 <!-- <conditional name="packmol_format">
54 <param name="selected_format" type="select" label="Select a file format:">
55 <option value="pdb" selected="true">pdb</option>
56 <option value="xyz">xyz</option>
57 <option value="tinker">tinker</option>
58 <option value="moldy">moldy</option>
59 </param>
60 <when value="pdb">
61 <expand macro="multiple_input" name="packmol_inputs" format="pdb" label="pdb input with molecule type" help_text="Select a pdb file in .pdb format"/>
62 </when>
63 <when value="xyz">
64 <expand macro="multiple_input" name="packmol_inputs" format="xyz" label="xyz input with molecule type" help_text="Select a xyz file in .xyz format"/>
65 </when>
66 <when value="tinker">
67 <expand macro="multiple_input" name="packmol_inputs" format="tinker" label="tinker input with molecule type" help_text="Select a tinker file in .tinker format"/>
68 </when>
69 <when value="moldy">
70 <expand macro="multiple_input" name="packmol_inputs" format="moldy" label="moldy input with molecule type" help_text="Select a moldy file in .moldy format"/>
71 </when>
72 </conditional> -->
73 <expand macro="multiple_input" name="packmol_inputs" format="pdb" label="PDB input with molecule type" help_text="Select a PDB file in .pdb format"/>
74 <section name="allparams" title="General parameters" expanded="false">
75 <param name="tolerance" type="float" value="2.0" label="Distance tolerance" min="0.0" max="100.0"/>
76 <param name="nloop" type="integer" value="20" label="Maximum number of optimisation loops" min="1" max="10000"/>
77 <param name="maxit" type="integer" value="20" label="Maximum number of gencan iterations per loop" min="1" max="10000"/>
78 <param name="seed" type="integer" value="-1" label="Random number generator seed, default of -1 uses the computer time to set the seed" />
79 </section>
80 </inputs>
81 <outputs>
82 <data format="pdb" name="outfile" label="${tool.name}: structure output">
83 <!-- <change_format>
84 <when input="selected_format" value="pdb" format="pdb"/>
85 <when input="selected_format" value="xyz" format="xyz"/>
86 <when input="selected_format" value="tinker" format="tinker"/>
87 <when input="selected_format" value="moldy" format="moldy"/>
88 </change_format> -->
89 </data>
90 <data format="txt" name="parameteroutfile" label="${tool.name}: parameter output"/>
91 </outputs>
92 <tests>
93 <test>
94 <param name="selected_format" value="pdb"/>
95 <param name="packmol_inputs_0|input" value="water.pdb" ftype="pdb"/>
96 <param name="allparams.seed" value="101"/>
97 <output name="outfile" file="packmol_outfile1.pdb" compare="sim_size" delta="100000">
98 <assert_contents>
99 <has_text text="HETATM 300 O HOH"/>
100 </assert_contents>
101 </output>
102 <output name="parameteroutfile" file="packmol_parameteroutfile_1.txt" compare="diff" lines_diff="6"/>
103 </test>
104 <test>
105 <param name="selected_format" value="pdb"/>
106 <param name="packmol_inputs_0|input" value="water.pdb" ftype="pdb"/>
107 <param name="packmol_inputs_1|input" value="urea.pdb" ftype="pdb"/>
108 <param name="packmol_inputs_0|structureparams|number" value="1000"/>
109 <param name="packmol_inputs_1|structureparams|number" value="400"/>
110 <param name="packmol_inputs_0|structureparams|constraints_repeat_0|constraints|constraint" value="box"/>
111 <param name="packmol_inputs_0|structureparams|constraints_repeat_0|constraints|xmax" value="40.0"/>
112 <param name="packmol_inputs_0|structureparams|constraints_repeat_0|constraints|ymax" value="40.0"/>
113 <param name="packmol_inputs_0|structureparams|constraints_repeat_0|constraints|zmax" value="40.0"/>
114 <param name="packmol_inputs_1|structureparams|constraints_repeat_0|constraints|constraint" value="box"/>
115 <param name="packmol_inputs_1|structureparams|constraints_repeat_0|constraints|xmax" value="40.0"/>
116 <param name="packmol_inputs_1|structureparams|constraints_repeat_0|constraints|ymax" value="40.0"/>
117 <param name="packmol_inputs_1|structureparams|constraints_repeat_0|constraints|zmax" value="40.0"/>
118 <param name="allparams.seed" value="-1"/>
119 <output name="outfile" file="packmol_outfile2.pdb" compare="sim_size" delta="100000">
120 <assert_contents>
121 <has_text text="HETATM 3000 O HOH"/>
122 <has_text text="HETATM 6200 H 2 B"/>
123 </assert_contents>
124 </output>
125 <output name="parameteroutfile" file="packmol_parameteroutfile_2.txt" compare="diff" lines_diff="6"/>
126 </test>
127 </tests>
128 <help><![CDATA[
129 .. class:: infomark
130
131 **What it does**
132
133 Packmol creates initial MD configurations from input molecules - for example, creating a water and urea mixture.
134
135 .. class:: infomark
136
137 **How it works**
138
139 - Select a molecule file type e.g. pdb, xyz
140 - Select a single molecule from your history (can select multiple)
141 - For each molecule:
142 - choose how many molecules to create (number variable)
143 - optionally choose:
144 - molecular radius
145 - how to number the molecules (resnumber variable)
146 - choose one or more placement constraint(s). Each constraint has different parameters:
147 - for example, specify placement inside a cube of size 40 Angstroms placed at the origin
148 - all units are in Angstroms for distances and degrees for angles
149
150 .. class:: infomark
151
152 **Outputs created**
153
154 - A pdb file; view this in Galaxy by clicking on the 'visualize' icon and choosing a viewer. The NGLViewer works well for small molecules.
155 - A packmol input script (for debugging and repeatability)
156
157 .. class:: infomark
158
159 **User guide and documentation**
160
161 - Packmol `userguide`_
162 - Calculating the number of molecules using the `volume guesser`_
163
164 .. class:: infomark
165
166 **Known issues**
167
168 - 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.
169
170 .. _`userguide`: http://m3g.iqm.unicamp.br/packmol/userguide.shtml#more
171 .. _`volume guesser`: http://m3g.iqm.unicamp.br/packmol/utilities.shtml
172
173 ]]>
174 </help>
175 <citations>
176 <citation type="doi">10.1002/jcc.21224</citation>
177 </citations>
178 </tool>