Skip to content
Snippets Groups Projects
Commit f5642347 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Try to find non mainfiles in more directories.

parent 1342021e
No related branches found
No related tags found
No related merge requests found
...@@ -478,9 +478,11 @@ def parse_without_class(fname, backend, parser_info): ...@@ -478,9 +478,11 @@ def parse_without_class(fname, backend, parser_info):
else: else:
input_units = 'bohr' input_units = 'bohr'
staticdir, _info = os.path.split(fname) parent_dir, _ = os.path.split(fname)
inpdir, _static = os.path.split(staticdir) inpdir = parent_dir
# try to read files from the same or parent directory
while True:
try:
if 'PDBCoordinates' in coordinfo: if 'PDBCoordinates' in coordinfo:
atoms = read(os.path.join(inpdir, coordinfo['PDBCoordinates']), format='proteindatabank') atoms = read(os.path.join(inpdir, coordinfo['PDBCoordinates']), format='proteindatabank')
elif 'XYZCoordinates' in coordinfo: elif 'XYZCoordinates' in coordinfo:
...@@ -496,6 +498,13 @@ def parse_without_class(fname, backend, parser_info): ...@@ -496,6 +498,13 @@ def parse_without_class(fname, backend, parser_info):
elif 'rcoords' in coordinfo: elif 'rcoords' in coordinfo:
# unit will be Bohr cf. handling of cell above # unit will be Bohr cf. handling of cell above
coords = np.dot(coordinfo['rcoords'], cell) coords = np.dot(coordinfo['rcoords'], cell)
except FileNotFoundError as e:
if inpdir == parent_dir:
inpdir, _ = os.path.split(inpdir)
else:
raise e
else:
break
if atoms is not None: if atoms is not None:
coords = atoms.positions / Bohr coords = atoms.positions / Bohr
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment