Skip to content

Commit

Permalink
IsoSimulation: pretty print pairwise features
Browse files Browse the repository at this point in the history
  • Loading branch information
axsk committed Aug 13, 2024
1 parent 016c4de commit ff06985
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/simulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,13 @@ function resample_kde(data, model, n; padding=0.0, bandwidth=0.02)
end

function Base.show(io::IO, mime::MIME"text/plain", d::SimulationData)#
simstr = sprint() do io
show(io, mime, d.sim)
end
println(
io, """
SimulationData(;
sim=$(d.sim),
sim=$(simstr),
features=$(size.(d.features)), $(split(string(typeof(d.features[1])),",")[1]),
coords=$(size.(d.coords)), $(split(string(typeof(d.coords[1])),",")[1]),
featurizer=$(d.featurizer))"""
Expand Down
8 changes: 7 additions & 1 deletion src/simulators/openmm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,11 @@ Base.convert(::Type{OpenMMSimulation}, a::OpenMMSimulationSerialized) =
mmthreads=a.mmthreads)

function Base.show(io::IO, mime::MIME"text/plain", sim::OpenMMSimulation)#
featstr = if sim.features isa Vector{Tuple{Int,Int}}
"{$(length(sim.features)) pairwise distances}"
else
sim.features
end
println(
io, """
OpenMMSimulation(;
Expand All @@ -364,7 +369,8 @@ function Base.show(io::IO, mime::MIME"text/plain", sim::OpenMMSimulation)#
friction=$(sim.friction),
step=$(sim.step),
steps=$(sim.steps),
features=$(sim.features))"""
features=$featstr)
with $(div(length(getcoords(sim)),3)) atoms"""
)
end

Expand Down

0 comments on commit ff06985

Please sign in to comment.