Skip to content

Commit ed5e9c4

Browse files
committed
Add model feature in TOML files
1 parent 62c53b7 commit ed5e9c4

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

src/ParticlesMC.jl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,17 @@ ParticlesMC implemented in Comonicon.
7171
system = params["system"]
7272
temperature = system["temperature"]
7373
density = system["density"]
74-
model = system["model"]
7574
config = system["config"]
75+
model = get(system, "model", nothing)
76+
if model === nothing
77+
model = params["model"]
78+
end # optional field
7679
if !isfile(config)
7780
error("Configuration file '$config' does not exist in the current path.")
7881
end
7982
list_type = get(system, "list_type", "LinkedList") # optional field
8083
bonds = get(system, "bonds", nothing)
81-
84+
8285
# Extract simulation parameters
8386
sim = params["simulation"]
8487
steps = sim["steps"]
@@ -130,10 +133,17 @@ ParticlesMC implemented in Comonicon.
130133
else
131134
error("Unsupported policy: $policy for action: $action")
132135
end
136+
elseif action == "MoleculeFlip"
137+
action_obj = MoleculeFlip(0, 0, 0.0)
138+
param_obj = Vector{Float64}()
139+
if policy == "DoubleUniform"
140+
policy_obj = DoubleUniform()
141+
else
142+
error("Unsupported policy: $policy for action: $action")
143+
end
133144
else
134-
error("Unsupported action: $action")
145+
error("Unsupported action: $action")
135146
end
136-
137147
# Build move
138148
move_obj = Move(action_obj, policy_obj, param_obj, prob)
139149
push!(pool, move_obj)

0 commit comments

Comments
 (0)