MayaChemTools
Standup for science

Previous  TOC  NextOpenFECalculatePartialCharges.pyCode | PDF | PDFA4

NAME

OpenFECalculatePartialCharges.py - Generate ligand network

SYNOPSIS

OpenFECalculatePartialCharges.py [--charge <text>] [--chargeParams <Name,Value,..>] [--infileParams <Name,Value,...>] [--loggingLevel <Info or Warning>] [--outfileParams <Name,Value,...>] [--overwrite] [-w <dir>] -i <infile> -o <outfile>

OpenFECalculatePartialCharges.py -h | --help | -e | --examples

DESCRIPTION

Calculate partial atomic charges for molecules in an input file and write them out to a SD file.

The partial charges are written to SD file as values of the data field label 'atom.dprop.PartialCharge'. These values are automatically processed by RDKit during the loading of a SD file and assigned to atoms. You may retrieve these value using RDKit method Atom.GetDoubleProp('PartialCharge')

You must specify a valid input file containing 3D coordinates for all molecules. In addition, the hydrogens must be present for all molecules in the input file.

The supported input file formats are: Mol (.mol), SD (.sdf, .sd)

The supported output file formats is: SD (.sdf, .sd)

OPTIONS

-e, --examples

Print examples.

-h, --help

Print this help message.

-i, --infile <infile>

Input file name.

-c, --charge <text> [default: AM1BCC]

Type of partial atomic charges to calculate. Possible values: AM1BCC, AM1-Mulliken, Espaloma, Gasteiger, MMFF94, or NAGL.

--chargeParams <Name,Value,..> [default: auto]

A comma delimited list of parameter name and value pairs for calculating partial aromic charges.

The supported parameter names along with their default values are

naglModel, auto [ Possible value: A valid NAGL model name. By
     default, it corresponds to the latest AM1BCC production model ]
toolkit, auto [ Possible values: RDKit or AmberTools. Default value:
     RDKit for Gasteiger and MMFF94; AmberTools for AM1BCC and
     AM1-Mulliken; Not used for Espaloma and NAGL. ]

numProcessors, 1 [ Only used for AM1BCC, AM1-Mulliken, Espaloma,
     and NAGL ]

precision, 4
lineSize, 90

useConformer, auto [ Use current conformer. Possible values: yes or
     no. Default value: no for Gasteiger using AmberToolkit;
     otherwise, yes. ]

A brief description of parameters is provided below:

naglModel: NAGL model name. The latest AM1BCC NAGL production
     model is used by default. You must specify it explicitly in case no
     production model is available.
toolkit: Toolkit name. RDKit for Gasteiger and MMFF94; AmberTools
     for AM1BCC, AM1-Mulliken, and Gasteiger.

numProcessors: Number of processors. This is only used during the
     calculation of AM1BCC, AM1-Mulliken, Espaloma, and NAGL
     employing OpenFE method bulk_assign_partial_charges().

precision: Floating point precision for writing the calculated
     partial atomic charges.
lineSize: Line size for writing the calculated partial aromic
     charges to SD file as a string value for data field label
     'atom.dprop.PartialCharge'.

useConformer: Use current conformer. The current conformer is
     always used to calculate AM1BCC, Espaloma abd NAGL charges
     using OpenFE method bulk_assign_partial_charges() and this
     option is ignored. In addition, the option value is passed to
     OpenFF method assign_partial_charges() during the calculation
     of AM1-Mulliken, Gasteiger and MMFF94 charges employing
     AmberTools or RDKit. The RDKit functions, however, ignore the
     conformer during the calculation of Gasteiger and MMFF94
     charges. The current conformer appears not used to calculate
     Gasteiger charges employing AmberTools.
--infileParams <Name,Value,...> [default: auto]

A comma delimited list of parameter name and value pairs for reading molecules from files. The supported parameter names for different file formats, along with their default values, are shown below:

SD,MOL: removeHydrogens,no,sanitize,yes,strictParsing,yes
--loggingLevel <Info or Warning> [default: Warning]

Logging level to configure the 'root logger' via logging.basicConfig() function. The default logging level is changed from 'logging.INFO' to 'logging.WARNING'. Otherwise, OpenFE and its associated modules may generate a lot of informational messages.

-o, --outfile <outfile>

Output file name.

--outfileParams <Name,Value,...> [default: auto]

A comma delimited list of parameter name and value pairs for writing molecules to files. The supported parameter names for different file formats, along with their default values, are shown below:

SD: kekulize,yes,forceV3000,no
--overwrite

Overwrite existing files.

-w, --workingdir <dir>

Location of working directory which defaults to the current directory.

EXAMPLES

To calculate AM1BCC partial atomic charges for molecules in a SD file and file and write them out to a file, type:

% OpenFECalculatePartialCharges.py -i SampleTyk2Ligands.sdf -o SampleTyk2LigandsAM1BCCOut.sdf

To run the first example for calculating AM1-Mulliken charges using AmberTools, type:

% OpenFECalculatePartialCharges.py -i SampleTyk2Ligands.sdf -o SampleTyk2LigandsAM1MullikenOut.sdf -c AM1-Mulliken

To run the first example for calculating Gasteiger charges using RDKit, type:

% OpenFECalculatePartialCharges.py -i SampleTyk2Ligands.sdf -o SampleTyk2LigandsGasteigerRDKit.sdf -c Gasteiger

To run the first example for calculating Gasteiger charges using AmberTools, type:

% OpenFECalculatePartialCharges.py -i SampleTyk2Ligands.sdf -o SampleTyk2LigandsasteigerAmberTools.sdf -c Gasteiger --chargeParams "toolkit,AmberTools"

To run the first example for calculating NAGL charges using the default production AM1BCC model, type:

% OpenFECalculatePartialCharges.py -i SampleTyk2Ligands.sdf -o SampleTyk2LigandsNAGL.sdf -c NAGL

To run the first example for calculating NAGL charges using a specific model, type:

% OpenFECalculatePartialCharges.py -i SampleTyk2Ligands.sdf -o SampleTyk2LigandsNAGL.sdf -c NAGL --chargeParams "naglmodel, openff-gnn-am1bcc-0.1.0-rc.3.pt"

To run the first example by specifying explicit values for various parameters, type:

% OpenFECalculatePartialCharges.py -i SampleTyk2Ligands.sdf -o SampleTyk2LigandsAM1BCCOut.sdf -c AM1BCC --chargeParams "numProcessors, 4, precision, 4, lineSize, 90" --loggingLevel Warning

AUTHOR

Manish Sud

SEE ALSO

OpenFECalculateAbsoluteHydrationFreeEnergy.py, OpenFEGenerateLigandNetwork.py, OpenFECalculateRelativeBindingFreeEnergy.py, OpenFECalculateRelativeHydrationFreeEnergy.py

COPYRIGHT

Copyright (C) 2025 Manish Sud. All rights reserved.

The functionality available in this script is implemented using OpenMM, an open source molecuar for alchemical free energy calculations.

This file is part of MayaChemTools.

MayaChemTools is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

 

 

Previous  TOC  NextNovember 6, 2025OpenFECalculatePartialCharges.py