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-asap
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-asap
Commits
fbc712f1
Commit
fbc712f1
authored
Oct 28, 2016
by
Mikkel Strange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed that None bug
parent
41dd2129
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
parser/parser-asap/constraint_conversion.py
parser/parser-asap/constraint_conversion.py
+12
-3
No files found.
parser/parser-asap/constraint_conversion.py
View file @
fbc712f1
...
...
@@ -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'
]
==
'Fixed
Atoms'
:
elif
name
==
'Fix
Atoms'
:
return
'fix_xyz'
else
:
return
name
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