Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
semicon
semicon
Commits
23a51d9f
Commit
23a51d9f
authored
Dec 11, 2019
by
Bas Nijholt
Browse files
fix all flake8 issues are remove whitespace
parent
7f22cc0a
Changes
9
Hide whitespace changes
Inline
Side-by-side
.gitattributes
View file @
23a51d9f
semicon/_static_version.py export-subst
\ No newline at end of file
semicon/_static_version.py export-subst
LICENSE
View file @
23a51d9f
...
...
@@ -21,4 +21,3 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
docker/semicon-latest.yml
View file @
23a51d9f
...
...
@@ -16,4 +16,3 @@ dependencies:
-
pytest-cov
-
pytest-flakes
-
pytest-pep8
semicon/__init__.py
View file @
23a51d9f
__all__
=
[]
import
models
import
parameters
import
peierls
from
._version
import
__version__
__all__
.
append
(
"__version__"
)
for
module
in
[
"parameters"
,
"models"
,
"peierls"
]:
exec
(
f
"from . import
{
module
}
"
)
__all__
.
append
(
module
)
def
test
(
verbose
=
True
):
from
pytest
import
main
...
...
@@ -19,3 +15,5 @@ def test(verbose=True):
test
.
__test__
=
False
__all__
=
[
"parameters"
,
"models"
,
"peierls"
,
"__version__"
]
semicon/kp_models/explicit_foreman.py
View file @
23a51d9f
...
...
@@ -21,9 +21,9 @@ import sympy.physics
from
sympy.physics.quantum
import
TensorProduct
as
kr
from
.symbols
import
(
E0
,
Ac
,
Delta
,
E0
,
Ec
,
Ev
,
L
,
...
...
@@ -80,7 +80,9 @@ def spin_orbit():
def
get_foreman
():
# Basis transformation
v_n
=
lambda
i
,
N
:
sympy
.
Matrix
([
1
if
i
==
n
else
0
for
n
in
range
(
N
)])
v_n
=
lambda
i
,
N
:
sympy
.
Matrix
(
# noqa: E731
[
1
if
i
==
n
else
0
for
n
in
range
(
N
)]
)
S
,
X
,
Y
,
Z
=
[
v_n
(
i
,
4
)
for
i
in
range
(
4
)]
up
,
dw
=
[
v_n
(
i
,
2
)
for
i
in
range
(
2
)]
...
...
@@ -120,7 +122,7 @@ def get_foreman():
H4
=
sympy
.
BlockMatrix
([[
Hcc
,
Hcv
],
[
Hvc
,
Hvv
]])
H8
=
sympy
.
Matrix
(
sympy
.
BlockDiagMatrix
(
H4
,
H4
))
+
Hs
dag
=
lambda
x
:
x
.
conjugate
().
transpose
()
dag
=
lambda
x
:
x
.
conjugate
().
transpose
()
# noqa: E731
U_dag
=
sympy
.
Matrix
(
sympy
.
BlockMatrix
([
molenkamp_basis
]))
U
=
dag
(
U_dag
)
...
...
semicon/misc.py
View file @
23a51d9f
...
...
@@ -123,7 +123,9 @@ def rotate(expr, R, act_on=momentum, spin_operators=None):
)
_validate_rotation_matrix
(
R
)
rotation_subs
=
lambda
R
,
v
:
{
cprime
:
c
for
(
cprime
,
c
)
in
zip
(
v
,
R
@
v
)}
rotation_subs
=
lambda
R
,
v
:
{
# noqa: E731
cprime
:
c
for
(
cprime
,
c
)
in
zip
(
v
,
R
@
v
)
}
subs
=
{}
for
row
in
np
.
atleast_2d
(
act_on
):
...
...
semicon/models.py
View file @
23a51d9f
...
...
@@ -6,7 +6,6 @@ import os
import
kwant.continuum
import
numpy
as
np
import
scipy.linalg
as
la
# from IPython import display
import
sympy
...
...
semicon/tests/test_models.py
View file @
23a51d9f
...
...
@@ -30,7 +30,7 @@ def isclose(a, b):
@
pytest
.
mark
.
parametrize
(
"ham_str"
,
[
"A_x * k_x**2 + A_y * k_y**2"
,
"A_x * sigma_x * k_x**2 + A_y * sigma_y * k_y**2"
,
],
[
"A_x * k_x**2 + A_y * k_y**2"
,
"A_x * sigma_x * k_x**2 + A_y * sigma_y * k_y**2"
],
)
def
test_model_creation
(
ham_str
):
smp
=
kwant
.
continuum
.
sympify
(
ham_str
)
...
...
@@ -123,7 +123,7 @@ def test_rotation():
ham_str
=
" + "
.
join
(
tmp_str
.
format
(
s
)
for
s
in
[
"x"
,
"y"
,
"z"
])
sx
,
sy
,
sz
=
sympy
.
symbols
(
"sigma_x sigma_y sigma_z"
)
ham1
=
kwant
.
continuum
.
sympify
(
ham1
=
kwant
.
continuum
.
sympify
(
# noqa: E731
ham_str
,
locals
=
{
"sigma_x"
:
sx
,
"sigma_y"
:
sy
,
"sigma_z"
:
sz
}
)
...
...
@@ -131,7 +131,7 @@ def test_rotation():
S
=
0.5
*
np
.
array
([
sigma_x
,
sigma_y
,
sigma_z
])
get_subs
=
lambda
R
,
v
:
{
cprime
:
c
for
(
cprime
,
c
)
in
zip
(
v
,
R
@
v
)}
get_subs
=
lambda
R
,
v
:
{
cprime
:
c
for
(
cprime
,
c
)
in
zip
(
v
,
R
@
v
)}
# noqa: E731
subs
=
{
**
get_subs
(
R
,
sympy
.
Matrix
(
kwant
.
continuum
.
momentum_operators
)),
**
get_subs
(
R
,
sympy
.
Matrix
([
sx
,
sy
,
sz
])),
...
...
setup.py
View file @
23a51d9f
...
...
@@ -61,7 +61,7 @@ class build_py(cmdclass["build_py"]):
class
develop
(
setuptools
.
command
.
develop
.
develop
):
def
run
(
self
):
super
().
run
()
data
=
build_cache
(
"."
)
build_cache
(
"."
)
cmdclass
[
"build_py"
]
=
build_py
...
...
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