Common
The Common module is a special type of module, in ProtoSyn. Its objective is to group commonly performed tasks, such as defining a default EnergyFunction
instances or defining commonly used Callback
instances.
Default Energy Function
ProtoSyn.Common.default_energy_function
โ Functiondefault_energy_function(::Type{T}) where {T <: AbstractFloat}
default_energy_function()
Returns a default EnergyFunction
for ProtoSyn. If no Type{T}
is provided, will use ProtoSyn.Units.defaultFloat
. This EnergyFunction
is optimized for evaluating protein systems.
Examples
julia> ProtoSyn.Common.default_energy_function()
๐ฒ Energy Function (7 components):
+----------------------------------------------------------------------+
| Index | Component name | Weight (ฮฑ) |
+----------------------------------------------------------------------+
| 1 | TorchANI_ML_Model | 1.00 |
| 2 | All_Atom_Clash_Rest | 1.00 |
| 3 | Hydrogen_Bonds | 0.50 |
| 4 | Coulomb | 0.60 |
| 5 | TorchANI_Ref_Energy | 1.00 |
| 6 | GB_Solvation | 1.00 |
| 7 | SASA_Solvation | 5.00e-04 |
+----------------------------------------------------------------------+
โ Update forces: false
โ Selection: Set
โโโ TrueSelection (Atom)
Default Callbacks
ProtoSyn.Common.default_energy_step_callback
โ Functiondefault_energy_step_callback(n::Int)::Callback
Returns a simple Callback
that prints the current step and total energy value of the Pose
every n
steps.
Examples
julia> ProtoSyn.Common.default_energy_step_callback(100)
โ Callback:
+----------------------------------------------------------------------+
| Index | Field | Value |
+----------------------------------------------------------------------+
| 1 | Event | energy_step |
| 2 | Frequency | 100 |
+----------------------------------------------------------------------+
ProtoSyn.Common.default_energy_step_frame_callback
โ Functiondefault_energy_step_frame_callback(n::Int, filename::String)::Callback
Returns a simple Callback
that prints the current step and total energy value of the Pose
every n
steps, while printing the current structure to the given filename
(format infered from filename
extension).
Examples
julia> ProtoSyn.Common.default_energy_step_frame_callback(100, "test.pdb")
โ Callback:
+----------------------------------------------------------------------+
| Index | Field | Value |
+----------------------------------------------------------------------+
| 1 | Event | energy_step_frame |
| 2 | Frequency | 100 |
+----------------------------------------------------------------------+
ProtoSyn.Common.default_energy_step_detailed
โ Functiondefault_energy_step_detailed(n::Int, msg::String = "Callback", color::Symbol = :none, file_out::Opt{String} = nothing, print_to_sdtout::Bool = true)::Callback
Returns a detailed Callback
that prints the current step and all energy components of the Pose
every n
steps. An optional msg
String can be provided as a header. Output can be colored by setting the color
flag. For a list of available colors, check the printstyled
documentation. By default, default_energy_step_detailed
prints the output to the stdout. This can be toggled by setting the print_to_sdtout
flag. Optionally, if a file_out
is provided (as a String), output is also printed to that file.
Examples
julia> ProtoSyn.Common.default_energy_step_detailed(1)
โ Callback:
+----------------------------------------------------------------------+
| Index | Field | Value |
+----------------------------------------------------------------------+
| 1 | Event | energy_step_detailed |
| 2 | Frequency | 1 |
+----------------------------------------------------------------------+
ProtoSyn.Common.default_energy_step_frame_detailed
โ Functiondefault_energy_step_frame_detailed(n::Int, output_frame::String, msg::String = "Callback", color::Symbol = :none, output_log::Opt{String} = nothing, print_to_sdtout::Bool = true)::Callback
Returns a detailed Callback
that prints the current step and all energy components of the Pose
every n
steps, while printing the current structure to the given filename
(format infered from filename
extension). An optional msg
String can be provided as a header. Output can be colored by setting the color
flag. For a list of available colors, check the printstyled
documentation. By default, default_energy_step_detailed
prints the output to the stdout. This can be toggled by setting the print_to_sdtout
flag. Optionally, if a file_out
is provided (as a String), output is also printed to that file.
Examples
julia> ProtoSyn.Common.default_energy_step_detailed(1)
โ Callback:
+----------------------------------------------------------------------+
| Index | Field | Value |
+----------------------------------------------------------------------+
| 1 | Event | energy_step_detailed |
| 2 | Frequency | 1 |
+----------------------------------------------------------------------+
ProtoSyn.Common.detailed_message
โ Functiondetailed_message(msg::String; color::Symbol = :none, file_out::Opt{String} = nothing, print_to_sdtout::Bool = true, N::Int = 100)
Print a detailed message msg
in the same style as default_energy_step_detailed
, with the given color
(uses the printstyled
method). If file_out
is set to a String
(nothing
, by default), also print to a file with the given file name. If print_to_stdout
is set to false
(true
, by default), skip printing to the stdout. N
sets the length of the final stylized message.
Examples
julia> ProtoSyn.Common.detailed_message("Simulation (Stage 3) ...", color = :blue, N = 120)
| --------------------------------------------- Simulation (Stage 3) ... --------------------------------------------- |