Coverage for biobb_chemistry/acpype/acpype_params_cns.py: 83%

12 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 AcpypeParamsCNS 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 AcpypeParamsCNS(common.AcpypeBase): 

10 """ 

11 | biobb_chemistry AcpypeParamsCNS 

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

13 | Generation of topologies for CNS/XPLOR. 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_par (str): Path to the PAR output file. File type: output. `Sample file <https://github.com/bioexcel/biobb_chemistry/raw/master/biobb_chemistry/test/reference/acpype/ref_acpype.cns.par>`_. Accepted formats: par (edam:format_3881). 

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

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.cns.top>`_. Accepted formats: top (edam:format_3881). 

20 output_path_pdb (str): Path to the PDB output file. File type: output. `Sample file <https://github.com/bioexcel/biobb_chemistry/raw/master/biobb_chemistry/test/reference/acpype/ref_acpype.cns.pdb>`_. Accepted formats: pdb (edam:format_1476). 

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 * **cnstop** (*bool*) - (False) Write the CNS topology with allhdg-like parameters (experimental). 

33 * **chiral** (*bool*) - (False) Create improper dihedral parameters for chiral atoms in CNS. 

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. 

43 

44 Examples: 

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

46 

47 from biobb_chemistry.acpype.acpype_params_cns import acpype_params_cns 

48 prop = { 

49 'basename': 'BBB', 

50 'charge': 0 

51 } 

52 acpype_params_cns(input_path='/path/to/myStructure.mol2', 

53 output_path_par='/path/to/newPAR.par', 

54 output_path_inp='/path/to/newINP.inp', 

55 output_path_top='/path/to/newTOP.top', 

56 output_path_top='/path/to/newPDB.pdb', 

57 properties=prop) 

58 

59 Info: 

60 * wrapped_software: 

61 * name: Acpype 

62 * version: 2019.10.05.12.26 

63 * license: GNU 

64 * ontology: 

65 * name: EDAM 

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

67 

68 """ 

69 

70 acpype_options = common.PARAMS_OPTIONS + common.CNS_OPTIONS 

71 acpype_outputs = {'output_path_par': '_CNS.par', 'output_path_inp': '_CNS.inp', 

72 'output_path_top': '_CNS.top', 'output_path_pdb': '_NEW.pdb'} 

73 acpype_includes = {'output_path_inp': {'_CNS.top': 'output_path_top', '_CNS.par': 'output_path_par', 

74 '_NEW.pdb': 'output_path_pdb'}} 

75 

76 def __init__(self, input_path: str, output_path_par: str, output_path_inp: str, output_path_top: str, output_path_pdb: str, 

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

78 super().__init__(**locals()) 

79 

80 

81acpype_params_cns = launcher(AcpypeParamsCNS) 

82 

83if __name__ == '__main__': 

84 AcpypeParamsCNS.main()