Custom reference energy
Similarly to the logic behind TorchANI reference energy EnergyFunctionComponent, it is often useful to attribute a custom reference energy to a Residue
type (by name). This can be, for example, to promote a positive bias towards a certain sub-set of aminoacids during mutation/design processes. The following methods allow the introduction of custom reference energies in ProtoSyn energy evaluations.
ProtoSyn.Calculators.calc_custom_ref_energy
— FunctionCalculators.calc_custom_ref_energy([::A], pose::Pose, selection::Opt{AbstractSelection}, update_forces::Bool = false; [map::Opt{Dict{AbstractSelection, T}} = nothing]) where {A, T <: AbstractFloat}
Calculate and return the Pose
pose
energy according to the given map
. The map
is a 1 to 1 correspondence between AbstractSelection
instances and energy values. If provided, an AbstractSelection
selection
limits the selected range of Atom
instances considered for this EnergyFunctionComponent
calculation. Note that any provided selection
and map
AbstractSelection
type are promoted to the biggest value: selection
is promoted to the AbstractSelection
type of map
if the map
type is larger or vice-versa. update_forces
Bool
has no effect in this EnergyFunctionComponent
calculation and is only included to provide a standard function signature between all EnergyFunctionComponent
instances. If no map
is provided, returns 0.0.
Examples
julia> ProtoSyn.Calculators.calc_custom_ref_energy(pose, nothing, false)
(0.0, nothing)
julia> ProtoSyn.Calculators.calc_custom_ref_energy(pose, nothing, false, map = Dict{AbstractSelection, Float64}(rn"ALA" => 3.0, rn"GLU" => 2.4))
(71.4, nothing)
ProtoSyn.Calculators.get_default_custom_ref_energy
— Functionget_default_custom_ref_energy(;[α::T = 1.0]) where {T <: AbstractFloat}
Return the default custom reference energy EnergyFunctionComponent
. α
sets the component weight (on an EnergyFunction
instance). This component employs the calc_custom_ref_energy
method, therefore defining a Pose
energy based on a user-defined map between AbstractSelection
instances and energy values.
Settings
map::Dict{AbstractSelection, T}
- Defines which map the custom reference energy should use;
Examples
julia> ProtoSyn.Calculators.get_default_custom_ref_energy()
🞧 Energy Function Component:
+---------------------------------------------------+
| Name | Custom_Ref_Energy |
| Alpha (α) | 1.0 |
| Update forces | true |
| Calculator | calc_custom_ref_energy |
+---------------------------------------------------+
| +----------------------------------------------------------------------------------+
├── ● Settings | Value |
| +----------------------------------------------------------------------------------+
| | map | Dict{AbstractSelection, Float64}(0 components) |
| +----------------------------------------------------------------------------------+
|
└── ○ Selection: nothing