Coverage for biobb_chemistry/acpype/acpype_params_gmx.py: 83%
12 statements
« prev ^ index » next coverage.py v7.18.0, created at 2026-12-02 09:19 +0000
« prev ^ index » next coverage.py v7.18.0, created at 2026-12-02 09:19 +0000
1#!/usr/bin/env python3
3"""Module containing the AcpypeParamsGMX class and the command line interface."""
4from typing import Optional
5from biobb_common.generic.biobb_object import launcher
6from biobb_chemistry.acpype import common
9class AcpypeParamsGMX(common.AcpypeBase):
10 """
11 | biobb_chemistry AcpypeParamsGMX
12 | This class is a wrapper of `Acpype <https://github.com/alanwilter/acpype>`_ tool for generation of topologies for GROMACS.
13 | Generation of topologies for GROMACS. Acpype is a tool based in Python to use Antechamber to generate topologies for chemical compounds and to interface with others python applications like CCPN or ARIA. `Visit the official page <https://github.com/alanwilter/acpype>`_.
15 Args:
16 input_path (str): Path to the input file. File type: input. `Sample file <https://github.com/bioexcel/biobb_chemistry/raw/master/biobb_chemistry/test/data/acpype/acpype.params.mol2>`_. Accepted formats: pdb (edam:format_1476), mdl (edam:format_3815), mol2 (edam:format_3816).
17 output_path_gro (str): Path to the GRO output file. File type: output. `Sample file <https://github.com/bioexcel/biobb_chemistry/raw/master/biobb_chemistry/test/reference/acpype/ref_acpype.gmx.gro>`_. Accepted formats: gro (edam:format_2033).
18 output_path_itp (str): Path to the ITP output file. File type: output. `Sample file <https://github.com/bioexcel/biobb_chemistry/raw/master/biobb_chemistry/test/reference/acpype/ref_acpype.gmx.itp>`_. Accepted formats: itp (edam:format_3883).
19 output_path_top (str): Path to the TOP output file. File type: output. `Sample file <https://github.com/bioexcel/biobb_chemistry/raw/master/biobb_chemistry/test/reference/acpype/ref_acpype.gmx.top>`_. Accepted formats: top (edam:format_3880).
20 properties (dic - Python dictionary object containing the tool parameters, not input/output files):
21 * **basename** (*str*) - ("BBB") A basename for the project (folder and output files).
22 * **charge** (*int*) - (None) [-20~20|1] Net molecular charge, for gas default is 0. If None the charge is guessed by acpype.
23 * **charge_method** (*str*) - ("bcc") Charge method. Values: gas (Gasteiger charges), bcc (AM1-BCC charges), abcg2 (ABCG2 charges; recommended for GAFF2; not available in acpype 2023.10.27), user (charges read from the mol2 input file).
24 * **multiplicity** (*int*) - (1) [1~10|1] Multiplicity (2S+1) of the molecule.
25 * **atom_type** (*str*) - ("gaff2") Atom type. Values: gaff (General AMBER Force Field), amber (protein force field set in protein_ff + GAFF), gaff2 (General AMBER Force Field 2), amber2 (protein force field set in protein_ff + GAFF2).
26 * **protein_ff** (*str*) - ("ff14SB") Protein force field used with the amber and amber2 atom types; only written to the command line when it is not the default value, not available in acpype 2023.10.27. Values: ff14SB (AMBER ff14SB), ff99SB (AMBER ff99SB).
27 * **qprog** (*str*) - ("sqm") AM1-BCC charges engine; mopac and divcon need a full external AmberTools. Values: sqm (sqm), mopac (MOPAC), divcon (DivCon).
28 * **keyword** (*str*) - (None) Keyword of the mopac or sqm engine, ie: "qm_theory='AM1', grms_tol=0.0005, scfconv=1.d-10".
29 * **max_time** (*int*) - (10800) [1~1000000|1] Maximum time (in seconds) for the sqm or mopac execution.
30 * **predindex** (*int*) - (4) [0~5|1] Antechamber atom and bond type prediction index, the antechamber -j flag; only 1, 4 and 5 produce a topology. Only written to the command line when it is not the default value, not available in acpype 2023.10.27. Values: 0 (no prediction), 1 (atom type), 2 (full bond types), 3 (part bond types), 4 (atom and full bond type), 5 (atom and part bond type).
31 * **gmx4** (*bool*) - (False) Write Ryckaert-Bellemans dihedrals for the old GROMACS 4.0.
32 * **merge** (*bool*) - (False) Merge lower and uppercase atom types in the GROMACS topology if their parameters match.
33 * **sorted** (*bool*) - (False) Sort atoms for the GROMACS ordering.
34 * **binary_path** (*str*) - ("acpype") Path to the acpype executable binary.
35 * **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files.
36 * **restart** (*bool*) - (False) [WF property] Do not execute if output files exist.
37 * **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory.
38 * **container_path** (*str*) - (None) Container path definition.
39 * **container_image** (*str*) - ('acpype/acpype:2022.7.21') Container image definition.
40 * **container_volume_path** (*str*) - ('/tmp') Container volume path definition.
41 * **container_user_id** (*str*) - (None) Container user_id definition.
42 * **container_shell_path** (*str*) - ('/bin/bash') Path to default shell inside the container.
44 Examples:
45 This is a use example of how to use the building block from Python::
47 from biobb_chemistry.acpype.acpype_params_gmx import acpype_params_gmx
48 prop = {
49 'basename': 'BBB',
50 'charge': 0
51 }
52 acpype_params_gmx(input_path='/path/to/myStructure.mol2',
53 output_path_gro='/path/to/newGRO.gro',
54 output_path_itp='/path/to/newITP.itp',
55 output_path_top='/path/to/newTOP.top',
56 properties=prop)
58 Info:
59 * wrapped_software:
60 * name: Acpype
61 * version: 2019.10.05.12.26
62 * license: GNU
63 * ontology:
64 * name: EDAM
65 * schema: http://edamontology.org/EDAM.owl
67 """
69 acpype_options = common.PARAMS_OPTIONS + common.GMX_OPTIONS
70 acpype_outputs = {'output_path_gro': '_GMX.gro', 'output_path_itp': '_GMX.itp', 'output_path_top': '_GMX.top'}
71 acpype_includes = {'output_path_top': {'_GMX.itp': 'output_path_itp'}}
73 def __init__(self, input_path: str, output_path_gro: str, output_path_itp: str, output_path_top: str,
74 properties: Optional[dict] = None, **kwargs) -> None:
75 super().__init__(**locals())
78acpype_params_gmx = launcher(AcpypeParamsGMX)
80if __name__ == '__main__':
81 AcpypeParamsGMX.main()