Coverage for biobb_chemistry/acpype/acpype_params_ac.py: 82%

11 statements  

« prev     ^ index     » next       coverage.py v7.18.0, created at 2026-12-02 09:19 +0000

1#!/usr/bin/env python3 

2 

3"""Module containing the AcpypeParamsAC class and the command line interface.""" 

4from typing import Optional 

5from biobb_common.generic.biobb_object import launcher 

6from biobb_chemistry.acpype import common 

7 

8 

9class AcpypeParamsAC(common.AcpypeBase): 

10 """ 

11 | biobb_chemistry AcpypeParamsAC 

12 | This class is a wrapper of `Acpype <https://github.com/alanwilter/acpype>`_ tool for small molecule parameterization for AMBER MD package. 

13 | Generation of topologies for Antechamber. 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>`_. 

14 

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_frcmod (str): Path to the FRCMOD output file. File type: output. `Sample file <https://github.com/bioexcel/biobb_chemistry/raw/master/biobb_chemistry/test/reference/acpype/ref_acpype.ac.frcmod>`_. Accepted formats: frcmod (edam:format_3888). 

18 output_path_inpcrd (str): Path to the INPCRD output file. File type: output. `Sample file <https://github.com/bioexcel/biobb_chemistry/raw/master/biobb_chemistry/test/reference/acpype/ref_acpype.ac.inpcrd>`_. Accepted formats: inpcrd (edam:format_3878). 

19 output_path_lib (str): Path to the LIB output file. File type: output. `Sample file <https://github.com/bioexcel/biobb_chemistry/raw/master/biobb_chemistry/test/reference/acpype/ref_acpype.ac.lib>`_. Accepted formats: lib (edam:format_3889). 

20 output_path_prmtop (str): Path to the PRMTOP output file. File type: output. `Sample file <https://github.com/bioexcel/biobb_chemistry/raw/master/biobb_chemistry/test/reference/acpype/ref_acpype.ac.prmtop>`_. Accepted formats: prmtop (edam:format_3881). 

21 properties (dic - Python dictionary object containing the tool parameters, not input/output files): 

22 * **basename** (*str*) - ("BBB") A basename for the project (folder and output files). 

23 * **charge** (*int*) - (None) [-20~20|1] Net molecular charge, for gas default is 0. If None the charge is guessed by acpype. 

24 * **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). 

25 * **multiplicity** (*int*) - (1) [1~10|1] Multiplicity (2S+1) of the molecule. 

26 * **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). 

27 * **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). 

28 * **qprog** (*str*) - ("sqm") AM1-BCC charges engine; mopac and divcon need a full external AmberTools. Values: sqm (sqm), mopac (MOPAC), divcon (DivCon). 

29 * **keyword** (*str*) - (None) Keyword of the mopac or sqm engine, ie: "qm_theory='AM1', grms_tol=0.0005, scfconv=1.d-10". 

30 * **max_time** (*int*) - (10800) [1~1000000|1] Maximum time (in seconds) for the sqm or mopac execution. 

31 * **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). 

32 * **binary_path** (*str*) - ("acpype") Path to the acpype executable binary. 

33 * **remove_tmp** (*bool*) - (True) [WF property] Remove temporal files. 

34 * **restart** (*bool*) - (False) [WF property] Do not execute if output files exist. 

35 * **sandbox_path** (*str*) - ("./") [WF property] Parent path to the sandbox directory. 

36 * **container_path** (*str*) - (None) Container path definition. 

37 * **container_image** (*str*) - ('acpype/acpype:2022.7.21') Container image definition. 

38 * **container_volume_path** (*str*) - ('/tmp') Container volume path definition. 

39 * **container_user_id** (*str*) - (None) Container user_id definition. 

40 * **container_shell_path** (*str*) - ('/bin/bash') Path to default shell inside the container. 

41 

42 Examples: 

43 This is a use example of how to use the building block from Python:: 

44 

45 from biobb_chemistry.acpype.acpype_params_ac import acpype_params_ac 

46 prop = { 

47 'basename': 'BBB', 

48 'charge': 0 

49 } 

50 acpype_params_ac(input_path='/path/to/myStructure.mol2', 

51 output_path_frcmod='/path/to/newFRCMOD.frcmod', 

52 output_path_inpcrd='/path/to/newINPCRD.inpcrd', 

53 output_path_lib='/path/to/newLIB.lib', 

54 output_path_prmtop='/path/to/newPRMTOP.prmtop', 

55 properties=prop) 

56 

57 Info: 

58 * wrapped_software: 

59 * name: Acpype 

60 * version: 2019.10.05.12.26 

61 * license: GNU 

62 * ontology: 

63 * name: EDAM 

64 * schema: http://edamontology.org/EDAM.owl 

65 

66 """ 

67 

68 acpype_options = common.PARAMS_OPTIONS 

69 acpype_outputs = {'output_path_frcmod': '_AC.frcmod', 'output_path_inpcrd': '_AC.inpcrd', 

70 'output_path_lib': '_AC.lib', 'output_path_prmtop': '_AC.prmtop'} 

71 

72 def __init__(self, input_path: str, output_path_frcmod: str, output_path_inpcrd: str, output_path_lib: str, output_path_prmtop: str, 

73 properties: Optional[dict] = None, **kwargs) -> None: 

74 super().__init__(**locals()) 

75 

76 

77acpype_params_ac = launcher(AcpypeParamsAC) 

78 

79if __name__ == '__main__': 

80 AcpypeParamsAC.main()