Hydrogen bonds
Computes the number of hydrogen bonds of a set of atoms, or between two sets of atoms, for each frame in a simulation.
This is an experimental feature. Breaking changes may occur without a breaking package release.
PDBTools.hydrogen_bonds
— Functionhydrogen_bonds(
sim::Simulation,
sel1::Union{String,Function}=at -> true,
sel2::Union{Nothing,String,Function}=nothing;
nthreads=Threads.nthreads(),
show_progress::Bool=true,
parallel::Bool=true,
kargs...
)
Compute the number of hydrogen bonds for each frame of a simulation.
For further details on kargs...
see the help entry of PDBTools.hydrogen_bonds
.
Example
julia> using MolSimToolkit, MolSimToolkit.Testing
julia> sim = Simulation(Testing.namd_pdb, Testing.namd_traj);
julia> hbs = hydrogen_bonds(sim, "protein")
5-element Vector{Int64}:
32
28
27
27
26
julia> hbs = hydrogen_bonds(sim, "protein", "water")
5-element Vector{Int64}:
75
81
76
68
80
Example
using MolSimToolkit, PDBTools
using MolSimToolkit.Testing # to load test files
using Plots
# Build Simulation object
sim = Simulation(Testing.namd_pdb, Testing.namd_traj)
# Compute h-bonds of the protein with itself
hbs_prot = hydrogen_bonds(sim, "protein")
# Compute h-bonds between protein and water
hbs_prot_water = hydrogen_bonds(sim, "protein", "water")
# Plot
plot(MolSimStyle,
[hbs_prot hbs_prot_water];
xlabel="frame",
ylabel="number of hydrogen bonds",
label=["protein-protein" "protein-water"],
legend=:outertopright,
)