Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qcxms #421

Merged
merged 21 commits into from
Feb 22, 2024
Merged

Qcxms #421

Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tools/qcxms/.shed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: QCxMS
owner: recetox
remote_repository_url: "https://github.com/RECETOX/galaxytools/tree/master/tools/qcxms"
homepage_url: "https://github.com/grimme-lab/QCxMS"
categories:
- Computational chemistry
- Molecular Dynamics
description: "QCxMS is a quantum chemical (QC) based program that enables users to calculate mass spectra (MS) using Born-Oppenheimer Molecular Dynamics (MD)."
long_description: |
"QCxMS is a quantum chemical (QC) based program that enables users to calculate mass spectra (MS) using Born-Oppenheimer Molecular Dynamics (MD).
It is the successor of the QCEIMS program, in which the EI part is exchanged to x (x=EI, CID) to account for the greater general applicability of the program.
The program was originally developed to calculate Electron Ionization (EI) mass spectra,
in which a (typically 70 eV) electron beam is focused on a molecule in order to create an open-shell radical ion (uneven number of valence electrons).
This process not only ionizes the molecule, but simultaneously increases the internal energy of the species, which in turn leads to bond breaking,
fragmentation, rearrangement, etc of the ion."
auto_tool_repositories:
name_template: "{{ tool_id }}"
description_template: "{{ tool_name }} tool from the QCxMS package"
suite:
name: suite_qcxms
description: tools from QCxMS are used for molecular geometry optimization and in silico calculation of mass spectra using quantum chemistry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tools are only for spectrum prediction

type: repository_suite_definition
13 changes: 13 additions & 0 deletions tools/qcxms/macros.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<macros>
<token name="@TOOL_VERSION@">5.2.0</token>

<xml name="creator">
<creator>
<yield/>
<organization
url="https://www.recetox.muni.cz/"
email="[email protected]"
name="RECETOX MUNI" />
</creator>
</xml>
</macros>
145 changes: 145 additions & 0 deletions tools/qcxms/qcxms_neutral_run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<tool id="qcxms_neutral_run" name="QCxMS neutral run" version="@TOOL_VERSION@+galaxy0" python_template_version="3.5" profile="21.05">
hechth marked this conversation as resolved.
Show resolved Hide resolved
<description>required as first step to prepare for the production runs</description>

<macros>
<import>macros.xml</import>
</macros>

<expand macro="creator"/>

<edam_topics>
<edam_topic>topic_3332</edam_topic>
</edam_topics>
<edam_operations>
<edam_operation>operation_0297</edam_operation>
</edam_operations>

<requirements>
<requirement type="package" version="@TOOL_VERSION@">qcxms</requirement>
</requirements>

<command detect_errors="exit_code"><![CDATA[
ln $mol molecule.xyz &&
hechth marked this conversation as resolved.
Show resolved Hide resolved
cat qcxms.in &&
qcxms -i molecule.xyz >> $log &&
qcxms -i molecule.xyz >> $log &&
hechth marked this conversation as resolved.
Show resolved Hide resolved
python3 rename.py

]]></command>

<environment_variables>
<environment_variable name="OMP_NUM_THREADS">1</environment_variable>
</environment_variables>

<configfiles>
<configfile filename="qcxms.in"><![CDATA[
${QC_Level}
#if $keywords.ntraj
ntraj ${keywords.ntraj}
#end if
tmax ${keywords.tmax}
tinit ${keywords.tinit}
ieeatm ${keywords.ieeatm}]]>
</configfile>
<configfile filename="rename.py">
import os

def rename_files_with_folder_name(folder_path):
if not os.path.exists(folder_path):
print(f"The folder '{folder_path}' does not exist.")
return

for root, _, files in os.walk(folder_path):
for filename in files:
folder_name = os.path.basename(root)
new_filename = f"{folder_name}_{filename}"

old_path = os.path.join(root, filename)
new_path = os.path.join(root, new_filename)

os.rename(old_path, new_path)

path = os.getcwd() + "/TMPQCXMS"
rename_files_with_folder_name(path)
</configfile>
</configfiles>

<inputs>
<param type="data" name="mol" label="Molecule 3D structure [.xzy]" format="xyz" />
<param name="QC_Level" type="select" display="radio" label="QC Method">
<option value="xtb2" selected="true">GFN2-xTB</option>
<option value="xtb">GFN-xTB</option>
</param>
<section name="keywords" title="Advanced method parameters" expanded="false"
help="List of advanced keywords to specify the method - for more information see [1].">
<param name="tmax" type="float" value="20.0" label="Maximum MD time (sampling) [ps]"
help="MD time for the mean-free-path (mfp) simulation in the EI mode. In the CID mode, this sets the number of time steps for the simulation
after fragmentation during internal energy scaling (implicit run type). For the explicit run type, the time for the collision MDs is fixed at 50 fs * number_of_atoms."/>
<param name="tinit" type="float" value="500.0" label="Initial Temperature [K]"/>
<param name="ieeatm" type="float" value="0.6" label="Impact excess energy (IEE) per atom [eV/atom]" />
<param name="ntraj" type="integer" optional="true" min="2" label="Number of trajectories[#]" help="Default is 25 * no. of atoms if unspecified."/>
</section>
<param name="store_extended_output" type="boolean" value="false" label="Store additional outputs?" help="Output the logfile and generated trajectory."/>
</inputs>

<outputs>
<data name="qcxms_out" format="txt" from_work_dir="qcxms.gs" label="qcxms.gs generated by ${tool.name} on ${on_string}">
<filter>store_extended_output</filter>
</data>
<data name="trajectory" from_work_dir="trjM" format="txt" label="trajectories generated by ${tool.name} on ${on_string}">
<filter>store_extended_output</filter>
</data>
<data name="log" format="txt" label="logfile of ${tool.name} on ${on_string}">
<filter>store_extended_output</filter>
</data>

<collection name="coords1" format="txt" type="list" label="coords in files generated by ${tool.name} on ${on_string}" >
<discover_datasets pattern="(?P&lt;designation&gt;.+)\.in" format="txt" directory="TMPQCXMS" recurse="true"/>
</collection>
<collection name="coords2" format="txt" type="list" label="coords start files generated by ${tool.name} on ${on_string}" >
<discover_datasets pattern="(?P&lt;designation&gt;.+)\.start" format="txt" directory="TMPQCXMS" recurse="true"/>
</collection>
<collection name="coords3" format="xyz" type="list" label="coords xyz files generated by ${tool.name} on ${on_string}" >
<discover_datasets pattern="(?P&lt;designation&gt;.+)\.xyz" format="xyz" ext="xyz" directory="TMPQCXMS" recurse="true"/>
</collection>
</outputs>

<tests>
<test expect_num_outputs="6">
<param name="mol" value="mol.xyz" ftype="xyz"/>
<section name="keywords">
<param name="ntraj" value="2"/>
</section>
<param name="store_extended_output" value="true"/>
<output_collection name="coords1" type="list" count="2"/>
<output_collection name="coords2" type="list" count="2"/>
<output_collection name="coords3" type="list" count="2"/>
<output name="qcxms_out">
<assert_contents>
<has_size value="174613" delta="300"/>
</assert_contents>
</output>
<output name="trajectory">
<assert_contents>
<has_size value="22150" delta="300"/>
</assert_contents>
</output>
<output name="log">
<assert_contents>
<has_size value="10518" delta="300"/>
</assert_contents>
</output>
</test>
</tests>

<help><![CDATA[]]>
</help>
hechth marked this conversation as resolved.
Show resolved Hide resolved

<citations>
<citation type="doi">10.1002/anie.201300158</citation>
<citation type="doi">10.1039/C4OB01668H</citation>
<citation type="doi">10.1021/jp5096618</citation>
<citation type="doi">10.1255/ejms.1313</citation>
<citation type="doi">10.1021/acs.jpca.6b02907</citation>
</citations>
</tool>
90 changes: 90 additions & 0 deletions tools/qcxms/qcxms_prod_run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<tool id="qcxms_prod_run" name="QCxMS prod run" version="@TOOL_VERSION@+galaxy0" python_template_version="3.5" profile="21.05">
hechth marked this conversation as resolved.
Show resolved Hide resolved
<description>production runs</description>
hechth marked this conversation as resolved.
Show resolved Hide resolved

<macros>
<import>macros.xml</import>
</macros>

<expand macro="creator"/>

<edam_topics>
<edam_topic>topic_3332</edam_topic>
</edam_topics>
<edam_operations>
<edam_operation>operation_0297</edam_operation>
</edam_operations>
hechth marked this conversation as resolved.
Show resolved Hide resolved

<requirements>
<requirement type="package" version="@TOOL_VERSION@">qcxms</requirement>
</requirements>

<command detect_errors="exit_code"><![CDATA[
python3 ${create_folder} &&
hechth marked this conversation as resolved.
Show resolved Hide resolved
find TMPQCXMS/*/ -type d | xargs -I {} -P 4 sh -c 'cd {} && qcxms --prod >> $log' &&
getres &&
plotms
]]></command>

<environment_variables>
<environment_variable name="OMP_NUM_THREADS">1</environment_variable>
</environment_variables>

<configfiles>
<configfile name="create_folder">
import os
import shutil

#set folder1_files = str("', '").join([str($f) for $f in $in_files])
#set folder2_files = str("', '").join([str($f) for $f in $start_files])
#set folder3_files = str("', '").join([str($f) for $f in $xyz_files])

#set names = str("', '").join([str($f.name) for $f in $xyz_files])
names = '$names'
folder_names = [x.split("_")[0] for x in names]

folder1_files = '$folder1_files'
folder2_files = '$folder2_files'
folder3_files = '$folder3_files'
hechth marked this conversation as resolved.
Show resolved Hide resolved

# Create a new output folder to store the result
output_path = 'TMPQCXMS'
os.makedirs(output_path, exist_ok=True)

for fname, filename1, filename2, filename3 in zip(folder_names, folder1_files, folder2_files, folder3_files):
hechth marked this conversation as resolved.
Show resolved Hide resolved
new_folder_path = os.path.join(output_path, fname)
os.makedirs(new_folder_path, exist_ok=True)

shutil.copy2(os.path.join(os.path.dirname(folder1_files[0]), filename1), os.path.join(new_folder_path, 'qcxms.in'))
shutil.copy2(os.path.join(os.path.dirname(folder2_files[0]), filename2), os.path.join(new_folder_path, 'qcxms.start'))
shutil.copy2(os.path.join(os.path.dirname(folder3_files[0]), filename3), os.path.join(new_folder_path, 'start.xyz'))

</configfile>
</configfiles>

<inputs>
<param type="data_collection" collection_type="list" name="in_files" label="in files [.in]" format="in,txt,text"/>
<param type="data_collection" collection_type="list" name="start_files" label="start files [.start]" format="start,txt,text"/>
<param type="data_collection" collection_type="list" name="xyz_files" label="xyz files [.xyz]" format="xyz,txt,text"/>
</inputs>

<outputs>
<data name="result" format="txt" from_work_dir="result.jdx" label="results.jdx generated by ${tool.name} on ${on_string}"/>

<data name="log" format="txt" label="logfile of ${tool.name} on ${on_string}"/>
</outputs>

<tests>
<test expect_failure="true" />
</tests>

<help><![CDATA[]]>
</help>

<citations>
<citation type="doi">10.1002/anie.201300158</citation>
<citation type="doi">10.1039/C4OB01668H</citation>
<citation type="doi">10.1021/jp5096618</citation>
<citation type="doi">10.1255/ejms.1313</citation>
<citation type="doi">10.1021/acs.jpca.6b02907</citation>
</citations>
</tool>
20 changes: 20 additions & 0 deletions tools/qcxms/test-data/mol.xyz
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
18
Lindane
CL -2.3574740887 0.2795224786 1.4453580379
C -1.5060254335 -0.0564753152 -0.1808833480
C -0.7409992814 1.1908990145 -0.6060928106
C -0.6154388189 -1.2913844585 -0.1359211653
CL -0.4997346103 1.0723730326 -2.4801609516
C 0.6426193118 1.3751488924 0.0051864041
CL -1.5938731432 -2.7512128353 0.4462303221
C 0.6645445824 -1.0841370821 0.6675278544
CL 0.4618762434 2.1580321789 1.6895099878
C 1.4344482422 0.0744384378 0.0415960811
CL 1.6999230385 -2.6236054897 0.5561774969
CL 3.0750505924 0.3596521318 0.8505522013
H -2.3252866268 -0.2277424186 -0.8540474772
H -1.3395941257 2.0737268925 -0.4863004684
H -0.3587814867 -1.5482350588 -1.1510624886
H 1.1898183823 2.1143426895 -0.5496439934
H 0.4745289683 -0.9351251125 1.7152343988
H 1.6943985224 -0.1802178770 -0.9732601047