ProteinMotion
Reference navigation
On this page

CLASS · v0.9.1

Electrostatics

Compute screened Coulomb pair energies and electrostatic potential.

python
from proteinmotion import Electrostatics

Constructor

python
Electrostatics(
    protein,
    charges='formal',
    *,
    dielectric=80,
    screening_length=8,
    cutoff=12,
    min_energy=0.05,
    exclude_same_residue=True,
    exclude_bonded=True,
)

Parameters

ParameterDefaultDescription
proteinRequiredProtein object to read or animate.
charges'formal'"formal" side-chain templates or one charge per atom, in elementary charge units.
dielectrickeyword only80Positive relative dielectric constant.
screening_lengthkeyword only8Positive exponential screening length in ångströms; None disables screening.
cutoffkeyword only12Distance cutoff in ångströms.
min_energykeyword only0.05Minimum absolute pair energy to include, in kcal/mol.
exclude_same_residuekeyword onlyTrueExclude pairs within the same residue.
exclude_bondedkeyword onlyTrueExclude directly bonded pairs.

Notes

Energy units are kcal/mol; potential units are kcal/mol per elementary charge. Formal charge templates illustrate charged side chains. Import atom charges for a prepared protonation state. This model uses a uniform dielectric and exponential screening.

Example and output

This excerpt runs inside a scene’s construct() method. The full example file includes imports, structure loading, and camera setup. Run it from a repository checkout.

Code Scene excerpt
python
p = ubiquitin().ball_and_stick()
field = Electrostatics(
    p,
    charges="formal",
    dielectric=80,
    screening_length=8,
    cutoff=6,
    min_energy=0.08,
)
pair = field.pairs[0]
endpoints = Region(p, [pair.a, pair.b])
residues = [p.topology.atoms[i].resid for i in (pair.a, pair.b)]
selected = p.select(residues=residues)
other = Region(p, np.setdiff1d(np.arange(len(p.topology.atoms)), selected.atom_indices))
other.set_opacity(0.06)
frame(self, p, endpoints, margin=4.5)
contacts = field.highlight(
    mode="2d",
    max_pairs=1,
    show_distances=True,
    font_size=42,
    style="solid",
    line_width=2,
)
self.play(Write(contacts), run_time=1.5)
self.play(self.camera.animate.orbit(0.5), run_time=3)
self.wait(1)
Output Preview · 5.5 s · 60 fps
Electrostatic contact

Screened Coulomb estimate using example formal charges.

Methods and properties

NameDescription
from_pqr()class methodLoad exact-identity PQR charges and create an electrostatic analysis.
pair_energy()methodEvaluate screened Coulomb energy for two atom indices.
potential()methodSum the electrostatic potential from all charges at sample points.
pairsproperty · inherited from _AnalysisTuple of Interaction records recomputed when coordinates or analysis settings change.
highlight()method · inherited from _AnalysisCreate styled electrostatic contact lines. Options go to InteractionHighlight.
python
Electrostatics.from_pqr(protein, path, *, allow_extra=False, **kwargs)

Load exact-identity PQR charges and create an electrostatic analysis.

ParameterDefaultDescription
proteinRequiredProtein object to read or animate.
pathRequiredInput or output file path, as specified by the operation.
allow_extrakeyword onlyFalsePermit additional PQR records after every protein atom has an exact match.
**kwargsAdditional keyword options described below or in the linked constructor.

Returns: Electrostatics

python
Electrostatics.pair_energy(a, b)

Evaluate screened Coulomb energy for two atom indices.

ParameterDefaultDescription
aRequiredZero-based first atom index.
bRequiredZero-based second atom index.

Returns: Energy in kcal/mol.

python
Electrostatics.potential(points, *, softening=1.0, chunk_size=2048)

Sum the electrostatic potential from all charges at sample points.

ParameterDefaultDescription
pointsRequiredCoordinates with shape (points, 3), in model ångströms.
softeningkeyword only1.0Plummer softening length in ångströms.
chunk_sizekeyword only2048Number of potential sample points processed together.

Returns: Array in kcal/mol per elementary charge.

Uses Plummer softening and includes all charges, independently of the pair cutoff.

Inherited from interactions._Analysis.

python
Electrostatics.pairs

Tuple of Interaction records recomputed when coordinates or analysis settings change.

Inherited from interactions._Analysis.

python
Electrostatics.highlight(**kwargs)

Create styled electrostatic contact lines. Options go to InteractionHighlight.

ParameterDefaultDescription
**kwargsAdditional keyword options described below or in the linked constructor.

Returns: InteractionHighlight