Closed rkruegs123 closed 2 years ago
Another error that I receive is
Traceback (most recent call last):
File "/usr/lib/python3.9/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/home/ryan/.local/lib/python3.9/site-packages/oxDNA_analysis_tools/output_bonds.py", line 65, in compute
print("{} {} {} {} {} {} {} {} {} {} {}".format(p, q, l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7], l[8]))
IndexError: index 8 is out of bounds for axis 0 with size 8
I think this comes from the assumption that there is a Debye-Huckel term. I am using oxDNA 1, so I have 7 subterms instead of 8
For the problem with the topology file this is because oxpy
is running in the current working directory. It reads the input
, sees topology = initial.top
and tries to open ./initial.top
. It doesn't know that the input file you are working with is in a different working directory. In my workflows which involve running oxpy
-based tools in oat
from outside the simulation directory, I use oxpy.InputFile
to modify the input file to contain relative paths to the real simulation directory. @lorenzo-rovigatti is there a way to set a working directory for oxpy
, or is modifying the InputFile
the best way to go about this?
For the problem with the DH interaction not being present in oxDNA1 I will add a check for that. Thanks for reminding me.
oxpy
works exactly as oxDNA
: it expects the paths found in the input file to either be absolute or relative to the current directory. I think that changing this behaviour would be very confusing (and somewhat arbitrary). What we can do is to add more options to alter the default behaviour. At the moment there is no way of setting the working directory from within oxpy
, but I guess that Python's os.chdir()
should do the trick, so that one option would be to add to oat
a parameter that can be used to set the working directory with it.
However, before doing that we need to make sure that the solution
Any ideas?
I assume there's nothing inside oxDNA which could easily set a working directory (defaulting to .
if not set) to search for files relative to? In that case, it wouldn't be too bad to add a keyword argument to all oxpy
-using functions in oat
which optionally sets the simulation directory to different than the directory where the Python interpreter is running.
There is chdir
also in C (and C++). I could add it as an option to the input file, but that wouldn't help in this specific case. One option would be to add a os.chdir(os.getcwd())
or something like this to oxpy
or oat
's __init__.py
file.
I guess the question here is semantically where do we want the directory choice to be? Is it
output_bonds(traj_info, top_info, inputfile, directory="EXAMPLES/hairpin/")
and then run os.chdir
in the Python function.
Or do we have something like
inp = oxpy.InputFile()
inp.set_wd("EXAMPLES/hairpin/")
and then set it on the oxpy
/oxDNA side.
Or do I just add a check in oat
functions which use input files if the input file is in os.getcwd()
and if not change all the file paths in the input file to be absolute paths?
Fixed the oxDNA1 incompatibility with ee49f10d4c11ba4c61ef9f44558343dbe8781587
Thank you so much for the prompt fix!
I have recently upgraded to the latest commit and have tried to use the
output_bonds
analysis tool. However, for any topology file that I use (including those in the examples), I receive the message:oxpy.core.OxDNAError: Can't read topology file 'initial.top'. Aborting
I can successfully run
run.py
inexamples/OXPY
and pass the other build tests. An example run that gives me this error message is:oat output_bonds examples/HAIRPIN/input examples/HAIRPIN/initial.conf