Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
parser-octopus
Commits
f5642347
Commit
f5642347
authored
Jan 09, 2020
by
Markus Scheidgen
Browse files
Try to find non mainfiles in more directories.
parent
1342021e
Changes
1
Hide whitespace changes
Inline
Side-by-side
octopusparser/parser_octopus.py
View file @
f5642347
...
...
@@ -478,24 +478,33 @@ def parse_without_class(fname, backend, parser_info):
else
:
input_units
=
'bohr'
staticdir
,
_info
=
os
.
path
.
split
(
fname
)
inpdir
,
_static
=
os
.
path
.
split
(
staticdir
)
if
'PDBCoordinates'
in
coordinfo
:
atoms
=
read
(
os
.
path
.
join
(
inpdir
,
coordinfo
[
'PDBCoordinates'
]),
format
=
'proteindatabank'
)
elif
'XYZCoordinates'
in
coordinfo
:
atoms
=
read
(
os
.
path
.
join
(
inpdir
,
coordinfo
[
'XYZCoordinates'
]),
format
=
'xyz'
)
elif
'XSFCoordinates'
in
coordinfo
:
if
'XSFCoordinatesAnimStep'
in
coordinfo
:
assert
0
# XXX read correct step. Take 1-indexation into account
atoms
=
read
(
os
.
path
.
join
(
inpdir
,
coordinfo
[
'XSFCoordinates'
]),
format
=
'xsf'
)
elif
'coords'
in
coordinfo
:
coords
=
coordinfo
[
'coords'
]
if
input_units
==
'angstrom'
:
coords
/=
Bohr
elif
'rcoords'
in
coordinfo
:
# unit will be Bohr cf. handling of cell above
coords
=
np
.
dot
(
coordinfo
[
'rcoords'
],
cell
)
parent_dir
,
_
=
os
.
path
.
split
(
fname
)
inpdir
=
parent_dir
# try to read files from the same or parent directory
while
True
:
try
:
if
'PDBCoordinates'
in
coordinfo
:
atoms
=
read
(
os
.
path
.
join
(
inpdir
,
coordinfo
[
'PDBCoordinates'
]),
format
=
'proteindatabank'
)
elif
'XYZCoordinates'
in
coordinfo
:
atoms
=
read
(
os
.
path
.
join
(
inpdir
,
coordinfo
[
'XYZCoordinates'
]),
format
=
'xyz'
)
elif
'XSFCoordinates'
in
coordinfo
:
if
'XSFCoordinatesAnimStep'
in
coordinfo
:
assert
0
# XXX read correct step. Take 1-indexation into account
atoms
=
read
(
os
.
path
.
join
(
inpdir
,
coordinfo
[
'XSFCoordinates'
]),
format
=
'xsf'
)
elif
'coords'
in
coordinfo
:
coords
=
coordinfo
[
'coords'
]
if
input_units
==
'angstrom'
:
coords
/=
Bohr
elif
'rcoords'
in
coordinfo
:
# unit will be Bohr cf. handling of cell above
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
:
coords
=
atoms
.
positions
/
Bohr
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment