Skip to content
Snippets Groups Projects
Commit 29c1b96c authored by Joseph Weston's avatar Joseph Weston
Browse files

update Monatomic lattices to work with SiteArrays

parent e5d30c69
No related branches found
No related tags found
No related merge requests found
# Copyright 2011-2013 Kwant authors.
# Copyright 2011-2019 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
......
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