Skip to content

Commit

Permalink
Merge pull request RECETOX#557 from RECETOX/wverastegui/issue534
Browse files Browse the repository at this point in the history
Added boolean to retain molecule name
  • Loading branch information
hechth authored Jun 18, 2024
2 parents d42dca4 + 8e93f3b commit 070a3fd
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 11 deletions.
26 changes: 26 additions & 0 deletions tools/xtb/test-data/initial_mol_molname.xyz
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
24
Benzophenone
O -3.17218 -0.41637 0.20834
C -1.92531 0.00835 -0.27726
C -3.36523 -1.11584 1.43352
C -1.88297 0.68848 -1.50133
C -0.72594 -0.22648 0.42416
O -3.06572 0.92326 -2.20069
C -0.65923 1.13249 -2.01579
C 0.50769 0.20309 -0.09384
C 0.52725 0.89747 -1.31842
C 1.73873 -0.06269 0.69160
C 2.97242 -0.05540 0.17293
C 4.16274 -0.34771 1.02917
H -2.81699 -2.08136 1.41259
H -3.01686 -0.49574 2.28636
H -4.44664 -1.32462 1.56502
H -0.74440 -0.75083 1.37062
H -3.06924 1.41308 -3.08782
H -0.62733 1.66802 -2.95623
H 1.44772 1.28256 -1.73388
H 1.62368 -0.31644 1.73996
H 3.14017 0.13488 -0.87802
H 4.23889 0.40538 1.84179
H 5.08665 -0.30659 0.41501
H 4.07211 -1.36208 1.47220
File renamed without changes.
52 changes: 41 additions & 11 deletions tools/xtb/xtb_molecular_optimization.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<tool id="xtb_molecular_optimization" name="xtb molecular optimization" version="@TOOL_VERSION@+galaxy1" profile="21.09">
<tool id="xtb_molecular_optimization" name="xtb molecular optimization" version="@TOOL_VERSION@+galaxy2" profile="21.09">
<description>Semiempirical quantum mechanical molecular optimization method</description>
<macros>
<import>macros.xml</import>
Expand All @@ -10,7 +10,18 @@
<command detect_errors="exit_code"><![CDATA[
ln -s '${coordinates}' 'mol.${coordinates.ext}' &&
xtb 'mol.${coordinates.ext}' --opt '${opt_level}' &&
cp 'xtbopt.${coordinates.ext}' '${output}'
#if $replace_second_line == "FALSE":
cp 'xtbopt.${coordinates.ext}' '${output}'
#end if
#if $replace_second_line == "TRUE":
cp 'xtbopt.${coordinates.ext}' '${output}' &&
awk 'NR==FNR{if(NR==2) line=$0; next} {if(FNR==2) print line; else print $0}' '${coordinates}' '${output}' > final &&
mv final '${output}'
#end if
]]></command>
<inputs>
<param label="Atomic coordinates file" type="data" name="coordinates" format="xyz" help="Initial atomic coordinates file to be optimized."/>
Expand All @@ -24,29 +35,48 @@
<option value="vtight">vtight</option>
<option value="extreme">extreme</option>
</param>
<param type="boolean" name="replace_second_line" label = "Keep molecule name" truevalue="TRUE" falsevalue="FALSE" checked="false" help = "If YES, the molecule name from the coordinates file is preserved, if it exists. Otherwise, the energy, gnorm, and xtb version are printed." />
</inputs>
<outputs>
<data name="output" format_source="coordinates" />
</outputs>
<tests>
<test>
<param name="coordinates" value="initial_mol.xyz" ftype="xyz"/>
<param name="coordinates" value="initial_mol_molname.xyz" ftype="xyz"/>
<param name="replace_second_line" value="TRUE" />
<output name="output">
<assert_contents>
<has_text text="xtb"/>
<has_n_lines n="26"/>
<has_text text="Benzophenone"/>
</assert_contents>
</output>
</test>
<!-- <test>
<param name="coordinates" value="initial_mol.coord" ftype="coord"/>
<output name="output" file="optimized_mol.coord" ftype="coord">
<test>
<param name="coordinates" value="initial_mol_molname.xyz" ftype="xyz"/>
<param name="replace_second_line" value="FALSE" />
<output name="output">
<assert_contents>
<has_text text="energy"/>
</assert_contents>
</output>
</test>
<test>
<param name="coordinates" value="initial_mol_no_molname.xyz" ftype="xyz"/>
<param name="replace_second_line" value="TRUE" />
<output name="output">
<assert_contents>
<has_text text="$coord"/>
<has_n_lines min="26"/>
<not_has_text text="energy"/>
</assert_contents>
</output>
</test> -->
</test>
<test>
<param name="coordinates" value="initial_mol_no_molname.xyz" ftype="xyz"/>
<param name="replace_second_line" value="FALSE" />
<output name="output">
<assert_contents>
<has_text text="energy"/>
</assert_contents>
</output>
</test>
</tests>
<help>
<![CDATA[
Expand Down

0 comments on commit 070a3fd

Please sign in to comment.