Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CodeRed
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
M-29
Software
CodeRed
Commits
e5a31ee2
Commit
e5a31ee2
authored
5 years ago
by
Kai Sellschopp
Browse files
Options
Downloads
Patches
Plain Diff
Extra methods for adding boundary conditions to the AdAtom object
parent
d4946215
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
core/adAtom.py
+26
-1
26 additions, 1 deletion
core/adAtom.py
core/codered.py
+10
-2
10 additions, 2 deletions
core/codered.py
utils/boundaryCondition.py
+1
-1
1 addition, 1 deletion
utils/boundaryCondition.py
with
37 additions
and
4 deletions
core/adAtom.py
+
26
−
1
View file @
e5a31ee2
import
numpy
as
np
from
..utils.boundaryCondition
import
*
class
AdAtom
:
...
...
@@ -10,10 +11,34 @@ class AdAtom:
self
.
mesh
=
[]
def
add_boundary
C
ondition
(
self
,
bc
):
def
add_boundary
_c
ondition
(
self
,
bc
):
self
.
bcs
.
append
(
bc
)
def
add_position_condition
(
self
,
position_min
=
0.0
,
position_max
=
1.0
):
pc
=
PositionCondition
(
self
,
position_min
,
position_max
)
self
.
add_boundary_condition
(
pc
)
def
add_distance_condition
(
self
,
neighbour
,
distance_min
=
0.0
,
distance_max
=
np
.
infty
):
dc
=
DistanceCondition
(
self
,
neighbour
,
distance_min
,
distance_max
)
self
.
add_boundary_condition
(
dc
)
def
add_angle_condition
(
self
,
neighbourA
,
neighbourB
,
angle_min
=
0.0
,
angle_max
=
180.0
,
center
=
1
):
if
center
==
0
:
ac
=
AngleCondition
(
neighbourA
,
self
,
neighbourB
,
angle_min
,
angle_max
)
elif
center
==
1
:
ac
=
AngleCondition
(
self
,
neighbourA
,
neighbourB
,
angle_min
,
angle_max
)
elif
center
==
2
:
ac
=
AngleCondition
(
neighbourA
,
neighbourB
,
self
,
angle_min
,
angle_max
)
else
:
print
(
"
ERROR! Invalid argument for center!
"
)
return
self
.
add_boundary_condition
(
ac
)
def
get_position_conditions
(
self
):
pos_bcs
=
[]
for
bc
in
self
.
bcs
:
...
...
This diff is collapsed.
Click to expand it.
core/codered.py
+
10
−
2
View file @
e5a31ee2
import
numpy
as
np
from
ase
import
Atoms
from
adAtom
import
AdAtom
from
.
adAtom
import
AdAtom
from
..utils.boundaryCondition
import
*
...
...
@@ -93,6 +93,9 @@ class CodeRed:
while
self
.
current_index
<
self
.
n_adAtoms
:
# get current atom
adatom
=
self
.
adAtoms
[
self
.
current_index
]
# create some informative output
print
(
"
Creating positions for ad-atom with index {:d}, species: {:s}, label: {:s}
"
.
format
(
self
.
current_index
,
adatom
.
species
,
adatom
.
label
))
# make sure it has a mesh
if
(
adatom
.
mesh
==
[]
or
len
(
adatom
.
mesh
)
==
0
):
...
...
@@ -146,7 +149,12 @@ class CodeRed:
if
len
(
self
.
combinations
)
==
0
:
return
#
...?
#
TODO: include dihedral conditions
# finally increase current index by 1 (only happens if everything worked out)
self
.
current_index
+=
1
# generate informative output
print
(
"
Done! Generated {:d} structures in total.
"
.
format
(
len
(
self
.
combinations
)))
return
self
.
combinations
This diff is collapsed.
Click to expand it.
utils/boundaryCondition.py
+
1
−
1
View file @
e5a31ee2
...
...
@@ -66,7 +66,7 @@ class AngleCondition(BoundaryCondition):
"""
Derived class for angle boundary conditions.
"""
def
__init__
(
self
,
atomA
=
'
X
'
,
atomB
=
'
Y
'
,
atomC
=
'
Z
'
,
minAng
=
0.0
,
maxAng
=
180.0
,
center
=
1
):
def
__init__
(
self
,
atomA
=
'
X
'
,
atomB
=
'
Y
'
,
atomC
=
'
Z
'
,
minAng
=
0.0
,
maxAng
=
180.0
):
self
.
bc_type
=
'
ang
'
self
.
atoms
=
[
atomA
,
atomB
,
atomC
]
self
.
minValue
=
minAng
...
...
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