Closed mtap-research closed 5 years ago
That would be dangerous to do for me, as I would trick myself and pull files from the PorousMaterials.jl/data/test
directory when I didn't intend! (e.g. if that file were missing in my current directory)
But you can do that by changing src/PorousMaterials.jl
to:
PATH_TO_DATA = isdir("data") ? pwd() * "data" : homedir() * "/PorousMaterials.jl/data"
looks for data
in present working directory, if not there, assigns directory to PorousMaterials.jl/data
. Will only work if you do not change the working directory after you using PorousMaterials
.
I guess my question was not clear.
I have a CIF file in /Users/ygchung/Desktop/git/CoRE-MOFs/internal/
folder.
It seems like when I run the code as is, it will look for the structures under /Users/ygchung/Desktop/git/CoRE-MOFs/internal/data/crystals/DOTSOV_clean.cif
INSTEAD of /Users/ygchung/Desktop/git/CoRE-MOFs/internal/DOTSOV_clean.cif
This is likely due to hardcoded path in crystal.jl
line 46, which looks under /crystals
folder for structure files. Similar convention for molecules.
It appears I would need to create two separate folders (/crystals
, /molecules
) under the present working directory (PWD) to run PorousMaterials properly. I would also need to have a forcefield files under /molecules
. It appears that the code is under the assumption that the User is always working at a specific directory (i.e., PorousMaterials.jl/test/data
).
I tried to fix this by making change to the code but this will break the runtests.jl
...
Ah yeah, the code assumes there is a folder specified by PATH_TO_DATA
with three subfolders:
crystals/
forcefields/
molecules
I suppose we could put in the code a global variable const CRYSTALS_FOLDER = "crystals/"
that could be changed. Then you could change that to CRYSTALS_FOLDER = ""
, along with PATH_TO_DATA = "internal"
to, when in the folder /Users/ygchung/Desktop/git/CoRE-MOFs
, look for the crystals in /Users/ygchung/Desktop/git/CoRE-MOFs/internal
.
But yes, then runtests.jl
won't work unless you put those crystal structures and input files in /Users/ygchung/Desktop/git/CoRE-MOFs/internal
as well. But that's okay since you can just run the tests to make sure they work then change CRYSTALS_FOLDER
?
Thanks for the comments! It works with your suggestion 👍 However, it would be better if there is a more permanent solution to this in the future! I am sure many simulators would NOT want to create these folders before running simulations. Or this should be explicitly mentioned somewhere in the tutorial.
Is there a way for PorousMaterials to FIRST look at the filenames where the program is being executed THEN look at default PorousMaterials.jl data/crystals/ directory? For example, some people would like to run calculations on the folder which contains both script and structure files.
Below is an error message that I received when trying to run one of the example calculations.