Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
west-public
westpy
Commits
119f4bac
Commit
119f4bac
authored
Jun 29, 2020
by
Lan Huang
Browse files
add fun view and addFracCoordAtom
parent
fb597c5f
Changes
1
Hide whitespace changes
Inline
Side-by-side
westpy/geometry.py
View file @
119f4bac
...
...
@@ -150,6 +150,29 @@ class Geometry(object) :
self
.
atoms
.
append
(
Atom
(
symbol
,
position
,
units
)
)
self
.
isSet
[
"atoms"
]
=
True
#
def
addFracCoordAtom
(
self
,
symbol
,
frac_coord
):
"""adds a single atom by fractional coords
:param symbol: chemical symbol
:type symbol: string
:param position: position
:type position: 3-dim tuple
:Example:
>>> from westpy import *
>>> geom = Geometry()
>>> geom.addFracCoordAtom( "Si", (0,1/3.0,2/3.0) )
"""
if
not
self
.
isSet
[
"cell"
]:
print
(
'Set cell first!'
)
return
import
numpy
as
np
from
westpy
import
Atom
,
Bohr
M
=
np
.
matrix
([
self
.
cell
[
'a1'
],
self
.
cell
[
'a2'
],
self
.
cell
[
'a3'
]]).
tolist
()
self
.
atoms
.
append
(
Atom
(
symbol
,
tuple
(
np
.
array
(
frac_coord
)
@
M
),
units
=
Bohr
))
self
.
isSet
[
"atoms"
]
=
True
def
__addAtomsFromXYZLines
(
self
,
lines
,
decode
=
True
)
:
"""Adds atoms from XYZ lines.
...
...
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