Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parser-atk
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nomad-lab
parser-atk
Commits
627bebc8
Commit
627bebc8
authored
8 years ago
by
Mikkel Strange
Browse files
Options
Downloads
Patches
Plain Diff
removed
parent
09e8106a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
parser/parser-atk/parser_configurations2.py
+0
-55
0 additions, 55 deletions
parser/parser-atk/parser_configurations2.py
with
0 additions
and
55 deletions
parser/parser-atk/parser_configurations2.py
deleted
100644 → 0
+
0
−
55
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)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment