From d2c1401c04e0ea9017dba3f76bf654e5e2c4555e Mon Sep 17 00:00:00 2001 From: Christoph Groth <christoph.groth@cea.fr> Date: Wed, 17 May 2017 10:09:55 +0200 Subject: [PATCH] add lattice.cubic --- doc/source/reference/kwant.lattice.rst | 1 + kwant/lattice.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/source/reference/kwant.lattice.rst b/doc/source/reference/kwant.lattice.rst index cd5c9b54..f4eb8fed 100644 --- a/doc/source/reference/kwant.lattice.rst +++ b/doc/source/reference/kwant.lattice.rst @@ -20,6 +20,7 @@ Library of lattices chain square + cubic triangular honeycomb kagome diff --git a/kwant/lattice.py b/kwant/lattice.py index 7183fb5e..e57a6e27 100644 --- a/kwant/lattice.py +++ b/kwant/lattice.py @@ -7,7 +7,7 @@ # http://kwant-project.org/authors. __all__ = ['TranslationalSymmetry', 'general', 'Polyatomic', 'Monatomic', - 'chain', 'square', 'triangular', 'honeycomb', 'kagome'] + 'chain', 'square', 'cubic', 'triangular', 'honeycomb', 'kagome'] from math import sqrt from itertools import product @@ -745,6 +745,12 @@ def square(a=1, name='', norbs=None): return Monatomic(((a, 0), (0, a)), name=name, norbs=norbs) +def cubic(a=1, name='', norbs=None): + """Make a cubic lattice.""" + return Monatomic(((a, 0, 0), (0, a, 0), (0, 0, a)), + name=name, norbs=norbs) + + tri = ta.array(((1, 0), (0.5, 0.5 * sqrt(3)))) def triangular(a=1, name='', norbs=None): -- GitLab