Skip to content
Snippets Groups Projects
Commit fbc712f1 authored by Mikkel Strange's avatar Mikkel Strange
Browse files

fixed that None bug

parent 41dd2129
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,12 @@ names_plane = {0: 'fix_yz', 1: 'fix_xz', 2: 'fix_xy'}
names_line = {0: 'fix_x', 1: 'fix_y', 2: 'fix_z'}
def get_index(v):
""" Try to guess the Nomad name
Parameters:
v: (3,) arraylike
vector perpedicular to the plane
or the direction of the line.
"""
v /= np.linalg.norm(v)
v2 = v * v
perm = v2.argsort()
......@@ -15,11 +21,14 @@ def get_nomad_name(c):
"""This tries to find the appropriate named name from
the constaints giving by a direction"""
constraint = c.todict()
if constraint['name'] == 'FixedPlane':
name = str(constraint.get('name'))
if name == 'FixedPlane':
d = get_index(c.dir)
return names_plane[d]
elif constraint['name'] == 'FixedLine':
elif name == 'FixedLine':
d = get_index(c.dir)
return names_line[d]
elif constraint['name'] == 'FixedAtoms':
elif name == 'FixAtoms':
return 'fix_xyz'
else:
return name
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment