Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
usadelndsoc
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JYU Condensed Matter Theory
usadelndsoc
Commits
74ad27f9
Commit
74ad27f9
authored
2 years ago
by
patavirt
Browse files
Options
Downloads
Patches
Plain Diff
Basic tests
parent
edd129aa
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/__init__.py
+0
-0
0 additions, 0 deletions
tests/__init__.py
tests/test_basic.py
+38
-0
38 additions, 0 deletions
tests/test_basic.py
with
38 additions
and
0 deletions
tests/__init__.py
0 → 100644
+
0
−
0
View file @
74ad27f9
This diff is collapsed.
Click to expand it.
tests/test_basic.py
0 → 100644
+
38
−
0
View file @
74ad27f9
# -*- eval: (blacken-mode) -*-
import
logging
import
numpy
as
np
from
numpy.testing
import
assert_allclose
import
usadelndsoc
import
usadelndsoc.solver
usadelndsoc
.
logger
.
setLevel
(
logging
.
DEBUG
)
def
basic_setup
(
terminals
=
False
):
Delta
=
np
.
zeros
((
4
,
4
))
Delta
[:
2
,
2
:]
=
np
.
eye
(
2
)
Delta
[
2
:,
:
2
]
=
np
.
eye
(
2
)
s
=
usadelndsoc
.
solver
.
Solver
(
nx
=
15
,
ny
=
5
)
s
.
Omega
[...]
=
Delta
s
.
alpha
=
0.0
s
.
U
[:,
:,
1
,
:,
:]
=
np
.
eye
(
4
)
if
terminals
:
s
.
mask
[
0
,
0
]
=
usadelndsoc
.
solver
.
MASK_TERMINAL
s
.
mask
[
-
1
,
-
1
]
=
usadelndsoc
.
solver
.
MASK_TERMINAL
return
s
# s.solve(omega=150, maxiter=300, preconditioner="none")
def
test_solve_dos
():
s
=
basic_setup
()
E
=
np
.
linspace
(
-
3
,
3
,
101
)
+
0.001j
res
=
s
.
solve_many
(
omega
=-
1j
*
E
)
g
=
res
.
G
[:,
10
,
2
,
0
,
0
]
g_an
=
-
1j
*
E
/
np
.
sqrt
(
1
-
E
**
2
)
assert_allclose
(
g
,
g_an
,
rtol
=
1e-4
)
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