molsysmt.physchem.get_charge#
- molsysmt.physchem.get_charge(molecular_system, element='group', selection='all', definition='physical_pH7', forcefield='AMBER14', water_model=None, syntax='MolSysMT', skip_digestion=False)[source]#
Electric charge for the selected elements.
Returns the electric charge aggregated at the requested hierarchical level. Two families of definitions are supported:
'physical_pH7'and'collantes'— residue-based tabulated scales that assign a fixed charge to each amino acid group. The charge is then summed across all groups within the requested element.'OpenMM'— reads partial charges from anopenmm.Systemoropenmm.Simulationobject’sNonbondedForce. If a different form is provided, the system is first converted toopenmm.Systemusing the specifiedforcefield.
- Parameters:
molecular_system (molecular system) – Input system in any supported form.
element ({'atom', 'group', 'component', 'molecule', 'chain', 'entity', 'system'}, default 'group') – Hierarchical element for which charge is returned. When
definitionis'physical_pH7'or'collantes',elementmust be'group'or coarser ('atom'raises an error). Whendefinitionis'OpenMM'and the form isopenmm.System, only'atom'and'system'are supported.selection (str, list, tuple or numpy.ndarray, default 'all') – Selection of elements to include in the output.
definition ({'physical_pH7', 'collantes', 'OpenMM'}, default 'physical_pH7') –
Charge definition to use.
'physical_pH7': fixed integer charges at pH 7 for the 20 standard amino acids (e.g. Arg +1, Asp −1).'collantes': alternative tabulated scale from Collantes et al.'OpenMM': partial charges extracted from an OpenMMNonbondedForce.
forcefield (str, default 'AMBER14') – Force field used to build the
openmm.Systemwhendefinition='OpenMM'and the input is not already an OpenMM system object.water_model (str or None, default None) – Water model passed to the OpenMM system builder (when applicable).
syntax (str, default 'MolSysMT') – Selection syntax.
skip_digestion (bool, default False) – If
True, bypass argument validation (for internal use only).
- Returns:
Electric charge as a PyUnitWizard quantity in elementary charge units (e). Shape is
(n_elements,)for atom/group/component/ molecule/chain/entity elements, or a scalar forelement='system'.- Return type:
quantity
- Raises:
NotImplementedMethodError – If an unsupported
definitionis requested.ArgumentChoiceError – If
element='atom'is combined with a residue-based definition, or if a mid-hierarchy element is combined with theopenmm.Systemform.
Notes
Values are rounded to 4 decimal places for the
'OpenMM'definition to avoid floating-point noise from unit conversions.Added in version 1.0.0.