Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions src/ParticlesMC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,24 @@ function compute_energy_particle(system::Particles, ids::AbstractVector)
return map(i -> compute_energy_particle(system, i), ids)
end

"""
Helper for building scheduler based on TOML schedul parameters
"""

function parse_schedule(scheduler_params, steps, burn)
if haskey(scheduler_params, "multi_origins")
tw = scheduler_params["multi_origins"]["tw"]
N = scheduler_params["multi_origins"]["N"]
return build_schedule(steps, MultiOrigins(tw, N), burn=burn)
elseif haskey(scheduler_params, "log_base")
interval = get(scheduler_params, "linear_interval", 1)
block = build_schedule(interval, 0, 2.0)
return build_schedule(steps, burn, block)
else
interval = get(scheduler_params, "linear_interval", 1)
return build_schedule(steps, burn, interval)
end
end

export energy
#export nearest_image_distance
Expand Down Expand Up @@ -256,13 +274,7 @@ ParticlesMC implemented in Comonicon.
for observable in get(sim, "observable", [])
alg = observable["algorithm"]
scheduler_params = observable["scheduler_params"]
interval = get(scheduler_params, "linear_interval", 1)
if "log_base" in keys(scheduler_params)
block = build_schedule(interval, 0, 2.0)
sched = build_schedule(steps, burn, block)
else
sched = build_schedule(steps, burn, interval)
end
sched = parse_schedule(scheduler_params, steps, burn)
if alg == "ComputeRotation"
parameters = get(observable, "parameters", Dict())
theta_T = Float64.(get(parameters, "theta_T", [π/4]))
Expand All @@ -284,13 +296,7 @@ ParticlesMC implemented in Comonicon.
dependencies = get(output, "dependencies", nothing)
callbacks = get(output, "callbacks", [])
fmt = get(output, "fmt", "XYZ")
interval = scheduler_params["linear_interval"]
if "log_base" in keys(scheduler_params)
block = build_schedule(interval, 0, 2.0)
sched = build_schedule(steps, burn, block)
else
sched = build_schedule(steps, burn, interval)
end
sched = parse_schedule(scheduler_params, steps, burn)
if alg == "StoreCallbacks"
callbacks = map(c -> eval(Meta.parse("$c")), callbacks)
algorithm = (
Expand Down
4 changes: 2 additions & 2 deletions src/rotation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Compute on-the-fly rotation tracker.
# Two algorithms :
# 1. ComputeRotation : updates system.Φ (simulation.observable)
# 2. StoreΦTrajectory : writes system.Φ to disk
# 2. StorePhiTrajectory : writes system.Φ to disk
# system.Φ[k][m] = rotation vector for molecule m under theta_T[k]

using LinearAlgebra
Expand Down Expand Up @@ -126,7 +126,7 @@ end

function Arianna.make_step!(simulation::Simulation, algorithm::ComputeRotation)

collect(eachindex(simulation.chains) |> Transducers.Map(c -> begin
tcollect(eachindex(simulation.chains) |> Transducers.Map(c -> begin
system = simulation.chains[c]
state = algorithm.states[c]
N_mol = system.Nmol
Expand Down