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
N
normalizer-prototypes
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nomad-lab
normalizer-prototypes
Commits
9ed63efe
Commit
9ed63efe
authored
Jun 14, 2017
by
Daria M. Tomecka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit of the classifuing code
parents
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
0 deletions
+98
-0
classify4me_prototypes.py
classify4me_prototypes.py
+98
-0
No files found.
classify4me_prototypes.py
0 → 100644
View file @
9ed63efe
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Includes function that reads json files and classifies the stuctures
included on the basis of encyclopedia and the calculated in the preprocessor
space_group and normalized_wyckoff, and returns a dictionary with key - json
file name and value - classification_name (with labels in the same format as
in the read_prototypes function).
"""
from
__future__
import
absolute_import
__author__
=
"Daria M. Tomecka"
__copyright__
=
"Copyright 2017, The NOMAD Project"
__maintainer__
=
"Daria M. Tomecka"
__email__
=
"tomeckadm@gmail.com;"
__date__
=
"18/05/17"
import
soap
import
sys
import
ase.io
import
json
import
numpy
as
np
import
pickle
import
h5py
import
time
import
datetime
import
os
import
logging
from
nomad_sim.wrappers
import
get_json_list
from
nomad_sim.wrappers
import
plot
,
logger
from
nomad_sim.utils_crystals
import
get_spacegroup
from
nomad_sim.utils_crystals
import
create_supercell
from
nomad_sim.wrappers
import
get_json_list
from
nomad_sim.nomad_structures
import
NOMADStructure
from
soap.tools
import
AseConfig
#prototypes_file = os.path.normpath("/nomad-lab-base/analysis-tools/structural-similarity/python-modules/nomad_sim/structure_types.py")
#Classification of json calculartion using encyclopedia preprocessor
import
sys
#print(sys.path)
sys
.
path
.
append
(
'/home/beaker/py3k/lib/python3.5/'
)
import
Nomad
import
logging
from
Nomad.Preprocessing.System
import
structure
,
preprocessormaterial3d
from
Nomad
import
ProcessingEngine
#LOGGER = logging.getLogger(__name__)
#logging.basicConfig(level=logging.ERROR)
json_list
=
beaker
.
json_list
def
classify_by_norm_wyckoff
(
json_list
):
protos
=
{}
for
json_file_name
in
json_list
:
try
:
#try:
# simulation_cell = json_file_name.get('lattice_vectors')
# labels = json_file_name.get('atom_labels')
# atom_pos = json_file_name.get('atom_positions')
# if not simulation_cell or not labels or not atom_pos:
# raise Exception("Parsed invalid geometry for space group %d, %s" % (spaceGroupNr, protoDict))
proc
=
ProcessingEngine
(
mode
=
"debug"
)
results
=
proc
.
process
(
json_file_name
)
preprocessor
=
list
(
results
.
values
())
if
len
(
preprocessor
)
==
1
:
preprocessor
=
preprocessor
[
0
]
spg_nr
=
preprocessor
[
"space_group"
]
norm_wyckoff
=
preprocessor
[
"normalized_wyckoff"
]
proto2
=
preprocessor
[
"structure_type"
]
protoDict
=
structure
.
get_structure_type
(
spg_nr
,
norm_wyckoff
)
#proto = '%d-%s' % (spg_nr, proto2)
if
protoDict
is
None
:
proto
=
"%d-_"
%
spg_nr
else
:
#if protoDict.get("Notes","") not in ["", "_", "-", "–"]:
# proto = '%d-%s' % (spg_nr, protoDict)
#else:
#proto = '%d-%s' % (spg_nr, protoDict)
proto
=
'%d-%s'
%
(
spg_nr
,
protoDict
.
get
(
"Prototype"
,
"-"
))
protos
[
json_file_name
]
=
proto
else
:
logging
.
error
(
"failed for %r"
,
json_file_name
)
except
:
logging
.
exception
(
"failure while computing for %r"
,
json_file_name
)
return
protos
#classify_by_norm_wyckoff(json_list)
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