Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
normalizer-prototypes
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
normalizer-prototypes
Commits
9ed63efe
Commit
9ed63efe
authored
8 years ago
by
Daria M. Tomecka
Browse files
Options
Downloads
Patches
Plain Diff
Initial commit of the classifuing code
parents
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
classify4me_prototypes.py
+98
-0
98 additions, 0 deletions
classify4me_prototypes.py
with
98 additions
and
0 deletions
classify4me_prototypes.py
0 → 100644
+
98
−
0
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)
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