Closed JeDeveloper closed 3 months ago
Thank you for the report Josh. The wrong behaviour was due to 2 concomitant bugs. I committed a change that should solve the issue by fixing one bug, and by making the code print an exception when the user tries to initialise an OxpyManager before the instance of the previous one has been destroyed. In other words, if you update your code the following script should work:
import oxpy
import json
import os
os.chdir("sim1")
with open("input.json", "r") as f:
input_file_dict = json.load(f)
with oxpy.Context():
ox_input = oxpy.InputFile()
for k,v in input_file_dict.items():
ox_input[k] = str(v)
manager = oxpy.OxpyManager(ox_input)
manager.run_complete()
del manager # <--- note the explicit deletion
os.chdir("../sim3")
with open("input.json", "r") as f:
input_file_dict = json.load(f)
with oxpy.Context():
ox_input = oxpy.InputFile()
for k,v in input_file_dict.items():
ox_input[k] = str(v)
manager = oxpy.OxpyManager(ox_input)
manager.run_complete()
Describe the bug When oxpy opens a context manager, leaves its scope, and then opens another context manager in the same python script, the second oxpy simulation behaves different. I am specifically working on a forward-flux-sampling simulation.
To Reproduce run the following script (included with the example files i have attached) and compare the
log.dat
files insim1
andsim2
.sim1
andsim2
are identical. oxpy_bug_eg.zipA
`
Expected behavior
Running the same simulation should produce the same results.
vim diff
of the twolog.dat
files produces:Desktop (please complete the following information):