diff --git a/mdevaluate/__init__.py b/mdevaluate/__init__.py index ce9ffe9..4a92725 100644 --- a/mdevaluate/__init__.py +++ b/mdevaluate/__init__.py @@ -11,7 +11,7 @@ from . import autosave from . import reader from .logging import logger -__version__ = '22.6' +__version__ = '23.4' def open(directory='', topology='*.tpr', trajectory='*.xtc', cached=False, diff --git a/mdevaluate/reader.py b/mdevaluate/reader.py index 6416c3c..a38b1eb 100755 --- a/mdevaluate/reader.py +++ b/mdevaluate/reader.py @@ -106,44 +106,47 @@ def is_writeable(fname): def nojump_load_filename(reader): directory, fname = path.split(reader.filename) - fname = path.join(directory, '.{}.nojump.npz'.format(fname)) + full_path = path.join(directory, '.{}.nojump.npz'.format(fname)) if not is_writeable(directory): - fname_fallback = os.path.join( - os.path.join(os.environ['HOME'], '.mdevaluate/nojump'), + user_data_dir = os.path.join("/data/", + os.environ['HOME'].split("/")[-1]) + full_path_fallback = os.path.join( + os.path.join(user_data_dir, '.mdevaluate/nojump'), directory.lstrip('/'), '.{}.nojump.npz'.format(fname) ) - if os.path.exists(fname_fallback): - return fname_fallback + if os.path.exists(full_path_fallback): + return full_path_fallback if os.path.exists(fname) or is_writeable(directory): - return fname + return full_path else: - fname = os.path.join( - os.path.join(os.environ['HOME'], '.mdevaluate/nojump'), + user_data_dir = os.path.join("/data/", + os.environ['HOME'].split("/")[-1]) + full_path_fallback = os.path.join( + os.path.join(user_data_dir, '.mdevaluate/nojump'), directory.lstrip('/'), '.{}.nojump.npz'.format(fname) ) - logger.info('Saving nojump to {}, since original location is not writeable.'.format(fname)) - os.makedirs(os.path.dirname(fname), exist_ok=True) - return fname + return full_path def nojump_save_filename(reader): directory, fname = path.split(reader.filename) - fname = path.join(directory, '.{}.nojump.npz'.format(fname)) + full_path = path.join(directory, '.{}.nojump.npz'.format(fname)) if is_writeable(directory): - return fname + return full_path else: - fname = os.path.join( - os.path.join(os.environ['HOME'], '.mdevaluate/nojump'), + user_data_dir = os.path.join("/data/", + os.environ['HOME'].split("/")[-1]) + full_path_fallback = os.path.join( + os.path.join(user_data_dir, '.mdevaluate/nojump'), directory.lstrip('/'), '.{}.nojump.npz'.format(fname) ) - logger.info('Saving nojump to {}, since original location is not writeable.'.format(fname)) - os.makedirs(os.path.dirname(fname), exist_ok=True) - return fname + logger.info('Saving nojump to {}, since original location is not writeable.'.format(full_path_fallback)) + os.makedirs(os.path.dirname(full_path_fallback), exist_ok=True) + return full_path_fallback - CSR_ATTRS = ('data', 'indices', 'indptr') NOJUMP_MAGIC = 2016 diff --git a/setup.py b/setup.py index a6e6825..1d05919 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,6 @@ setup( 'index-xtc = mdevaluate.cli:run' ] }, - version='22.11', + version='23.4', requires=['numpy', 'scipy'], )