Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
parser-atk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nomad-lab
parser-atk
Commits
627bebc8
Commit
627bebc8
authored
Sep 29, 2016
by
Mikkel Strange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed
parent
09e8106a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
55 deletions
+0
-55
parser/parser-atk/parser_configurations2.py
parser/parser-atk/parser_configurations2.py
+0
-55
No files found.
parser/parser-atk/parser_configurations2.py
deleted
100644 → 0
View file @
09e8106a
from
periodic_table
import
things
as
ptab_ns
from
physical_quantities
import
things
as
physquan_ns
from
configurations
import
conf_types
,
things
as
confs_ns
def
parse_configuration
(
fd
,
name
,
verbose
=
False
):
""" convert a nanolanguage python script into
ASE list of atoms.
Parameters:
fd: netcdf_file handle
name: str (i.e "BulkConfiguration_gID000")
"""
code
=
fd
.
variables
[
name
].
data
[:].
copy
()
code
=
code
.
tostring
().
decode
(
"utf-8"
)
if
verbose
:
print
(
'parsing code:
\n
------------'
)
print
(
code
)
things
=
ptab_ns
.
copy
()
things
.
update
(
physquan_ns
)
things
.
update
(
confs_ns
)
exec
(
code
,
{},
things
)
for
obj
in
things
.
values
():
for
conf_type
in
conf_types
:
if
isinstance
(
obj
,
confs_ns
[
conf_type
]):
return
obj
.
atoms
return
-
1
if
__name__
==
'__main__'
:
from
ase.visualize
import
view
from
scipy.io.netcdf
import
netcdf_file
import
sys
fd
=
netcdf_file
(
sys
.
argv
[
1
],
'r'
)
name
=
'BulkConfiguration_gID000'
atoms
=
parse_configuration
(
fd
,
name
)
view
(
atoms
)
# configurations = {}
# fp_gids = fd.fingerprint_table[:].decode('utf-8').split('#')
# for c in fp_gids:
# if len(c) > 0:
# fingerprint, gID = c.split(':')[:2]
# gID.strip()
# for name in ['BulkConfiguration_' + gID,
# 'MoleculeConfiguration_' + gID]:
# if name in fd.variables.keys():
# configurations[name] = fingerprint
#
# for name, fingerprint in configurations.items():
# print(name+',', fingerprint)
# atoms = parse_configuration(fd, name)
# view(atoms)
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