Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kwant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Show more breadcrumbs
Joseph Weston
kwant
Commits
29c1b96c
Commit
29c1b96c
authored
5 years ago
by
Joseph Weston
Browse files
Options
Downloads
Patches
Plain Diff
update Monatomic lattices to work with SiteArrays
parent
e5d30c69
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kwant/lattice.py
+12
-1
12 additions, 1 deletion
kwant/lattice.py
with
12 additions
and
1 deletion
kwant/lattice.py
+
12
−
1
View file @
29c1b96c
# Copyright 2011-201
3
Kwant authors.
# Copyright 2011-201
9
Kwant authors.
#
# This file is part of Kwant. It is subject to the license terms in the file
# LICENSE.rst found in the top-level directory of this distribution and at
...
...
@@ -470,6 +470,13 @@ class Monatomic(system.SiteFamily, Polyatomic):
def
__str__
(
self
):
return
self
.
cached_str
def
normalize_tags
(
self
,
tags
):
tags
=
np
.
asarray
(
tags
,
int
)
tags
.
flags
.
writeable
=
False
if
tags
.
shape
[
1
]
!=
self
.
lattice_dim
:
raise
ValueError
(
"
Dimensionality mismatch.
"
)
return
tags
def
normalize_tag
(
self
,
tag
):
tag
=
ta
.
array
(
tag
,
int
)
if
len
(
tag
)
!=
self
.
lattice_dim
:
...
...
@@ -495,6 +502,10 @@ class Monatomic(system.SiteFamily, Polyatomic):
"""
return
ta
.
array
(
self
.
n_closest
(
pos
)[
0
])
def
positions
(
self
,
tags
):
"""
Return the real-space positions of the sites with the given tags.
"""
return
tags
@
self
.
_prim_vecs
+
self
.
offset
def
pos
(
self
,
tag
):
"""
Return the real-space position of the site with a given tag.
"""
return
ta
.
dot
(
tag
,
self
.
_prim_vecs
)
+
self
.
offset
...
...
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