Electrostatics
The following section goes into detail on how ProtoSyn aims to evaluate electrostatic interactions, divided in the following topics:
Adding charges
The first step in any eletrostatic energy calculation is the attribution of charges to each point-like particle (i.e.: each Atom
instance). Users are free to manually define each Atom
's charge (by setting the corresponting pose.state[atom].δ
field). More automation purposes, ProtoSyn makes available several methods to automatically set-up charges in a Pose
:
ProtoSyn.Calculators.Electrostatics.assign_default_charges!
— Functionassign_default_charges!(pose::Pose, res_lib::LGrammar, [selection::Opt{AbstractSelection}]; [supress_warn::Bool = false])
Assign default charges to Pose
pose
from the given LGrammar
res_lib
entry, by Atom
name. If an AbstractSelection
selection
is provided, only apply charges to the selected Atom
instances. For non-canonical aminoacids and ligands (any Residue
without an entry on ProtoSyn.three_2_one
dictionary) and any Residue
whose template have different Atom
names, a warning is shown. Set supress_warn
to an AbstractSelection (or a boolean true
) to ignore these warnings for the selected Atom
instances (or all atoms, if true
, is set to false
, by default).
Consider setting default atom names (from the same LGrammar
), for example, using the assign_default_atom_names!
method.
See also
assign_acc2_eem_charges_from_file!
Examples
julia> ProtoSyn.Calculators.Electrostatics.assign_default_charges!(pose, ProtoSyn.Peptides.grammar)
1143-element Vector{Float64}:
-0.025115728872692304
-0.025115728872692304
-0.025115728872692304
(...)
ProtoSyn.Calculators.Electrostatics.assign_acc2_eem_charges_from_file!
— Functionassign_acc2_eem_charges_from_file!(pose::Pose, filename::String, [selection::Opt{AbstractSelection}])
Open and load ACC2 charges from a file filename
, apply them to the given Pose
pose
. If an AbstractSelection
selection
is provided, the loaded charge are only applied to the selected Atom
instances (note that both the number of loaded charge values and number of selected atoms must match). For more information on ACC2 charges, check https://acc2.ncbr.muni.cz/
See also
Examples
julia> ProtoSyn.Calculators.Electrostatics.assign_acc2_eem_charges_from_file!(pose, "charges.txt", aid"1:30")
30-element Vector{Float64}:
0.26429
-0.1422
-0.17175
(...)
Coulomb EnergyFunctionComponent
As long as a Pose
has charges attributed, the default Electrostatics coulomb EnergyFunctionComponent
can be applied.
ProtoSyn.Calculators.Electrostatics.calc_coulomb
— Functioncalc_coulomb([::A], pose::Pose, selection::Opt{AbstractSelection}, update_forces::Bool = false; [mask::MaskMap = nothing], [vlist::Opt{VerletList} = nothing], [potential::Function = (x) -> 0.0]) where {A}
Calculate the Pose
pose
Coulomb energy according to the given potential
function, based on the cartesian coordinates (make sure the Pose
pose
is synched, see sync!
). By default, the potential
returns 0.0 for each atom-pair. This function iterates over all Atom
instances in the provided Pose
pose
(See Counters and Iterators), unless an AbstractSelection
selection
is provided, limiting the selected Atom
instances. If the update_forces
flag is set to true
(false
, by default), also return the calculated forces based on this potential. Note that this function assumes Atom
.id
entries are synched between the Graph and State (See Indexation). An optional parameter Type{<: AbstractAccelerationType}
can be provided, stating the acceleration type used to calculate this energetic contribution (See ProtoSyn acceleration types). Uses ProtoSyn.acceleration.active
by default. This function makes use of the apply_potential!
framework. As such, an optional mask
and VerletList
vlist
can be provided to limit the calculation. Make sure the Pose
pose
has charges assigned (see assign_acc2_eem_charges_from_file!
and assign_default_charges!
).
See also
Examples
julia> ProtoSyn.Calculators.Electrostatics.calc_coulomb(pose, nothing, false)
(0.0, [0.0 0.0 … 0.0 0.0; 0.0 0.0 … 0.0 0.0; 0.0 0.0 … 0.0 0.0])
julia> ProtoSyn.Calculators.Electrostatics.calc_coulomb(pose, nothing, false, mask = ProtoSyn.Calculators.get_intra_residue_mask, potential = ProtoSyn.Calculators.get_bump_potential_charges(c = 0.0, r = 20.0))
(-2.6046789109428206, nothing)
ProtoSyn.Calculators.Electrostatics.get_default_coulomb
— Functionget_default_coulomb(;[α::T = 1.0]) where {T <: AbstractFloat}
Return the default Coulomb EnergyFunctionComponent
. α
sets the component weight (on an EnergyFunction
instance). This component employs the calc_coulomb
method, therefore defining a Pose
energy based on a given potential. By default, this EnergyFunctionComponent
uses the get_bump_potential_charges
potential, with an intra-residue mask (see get_intra_residue_mask
).
Settings
mask::Function
- Defines which atom-pairs to mask out of the result;vlist::VerletList
- If defined, theapply_potential!
method will only calculate the given atom-pairs in theVerletList
;potential::Function
- Which potential to apply to each atom-pair;
Examples
julia> ProtoSyn.Calculators.Electrostatics.get_default_coulomb()
🞧 Energy Function Component:
+---------------------------------------------------+
| Name | Coulomb |
| Alpha (α) | 1.0 |
| Update forces | true |
| Calculator | calc_coulomb |
+---------------------------------------------------+
| +----------------------------------------------------------------------------------+
├── ● Settings | Value |
| +----------------------------------------------------------------------------------+
| | potential | bump_potential_charges |
| | vlist | nothing |
| | mask | get_intra_residue_mask |
| +----------------------------------------------------------------------------------+
|
└── ○ Selection: nothing