Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MeanFi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Quantum Tinkerer
MeanFi
Commits
e279ca32
Commit
e279ca32
authored
11 months ago
by
Johanna Zijderveld
Browse files
Options
Downloads
Patches
Plain Diff
change test temporarily to kvector one
parent
03c11e4e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!4
Interface refactoring
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
codes/test_graphene.py
+14
-6
14 additions, 6 deletions
codes/test_graphene.py
with
14 additions
and
6 deletions
codes/test_graphene.py
+
14
−
6
View file @
e279ca32
# %%
import
numpy
as
np
from
codes.model
import
Model
from
codes.solvers
import
solver
from
codes.solvers
import
solver
kvector
from
codes
import
kwant_examples
from
codes.kwant_helper
import
utils
from
codes.tb.utils
import
compute_gap
from
codes.tb.tb
import
addTb
import
pytest
repeatNumber
=
10
# %%
graphene_builder
,
int_builder
=
kwant_examples
.
graphene_extended_hubbard
()
h_0
=
utils
.
builder2h_0
(
graphene_builder
)
# %%
def
gap_prediction
(
U
,
V
):
"""
...
...
@@ -28,8 +31,8 @@ def gap_prediction(U, V):
params
=
{
"
U
"
:
U
,
"
V
"
:
V
}
# Compare to phase diagram in https://arxiv.org/pdf/1204.4531.pdf
upperPhaseLine
=
0.181
*
U
+
0.416
lowerPhaseLine
=
1.707
*
U
-
3.823
upperPhaseLine
=
0.181
*
U
+
0.416
lowerPhaseLine
=
1.707
*
U
-
3.823
triplePoint
=
(
2.78
,
0.92
)
gapped
=
False
...
...
@@ -46,7 +49,9 @@ def gap_prediction(U, V):
guess
=
utils
.
generate_guess
(
frozenset
(
h_int
),
len
(
list
(
h_0
.
values
())[
0
]))
model
=
Model
(
h_0
,
h_int
,
filling
)
mf_sol
=
solver
(
model
,
guess
,
nK
=
nK
,
optimizer_kwargs
=
{
'
verbose
'
:
True
,
'
M
'
:
0
})
mf_sol
=
solverkvector
(
model
,
guess
,
nK
=
nK
,
optimizer_kwargs
=
{
"
verbose
"
:
True
,
"
M
"
:
0
}
)
gap
=
compute_gap
(
addTb
(
h_0
,
mf_sol
),
n
=
100
)
# Check if the gap is predicted correctly
...
...
@@ -54,11 +59,14 @@ def gap_prediction(U, V):
gappedPredicted
=
True
else
:
gappedPredicted
=
False
assert
gapped
==
gappedPredicted
,
f
"
Mean-field theory failed to predict the gap for U =
{
U
}
, V =
{
V
}
"
assert
(
gapped
==
gappedPredicted
),
f
"
Mean-field theory failed to predict the gap for U =
{
U
}
, V =
{
V
}
"
# %%
@pytest.mark.repeat
(
repeatNumber
)
def
test_gap
():
U
=
np
.
random
.
uniform
(
0
,
2
)
V
=
np
.
random
.
uniform
(
0
,
1
)
gap_prediction
(
U
,
V
)
\ No newline at end of file
gap_prediction
(
U
,
V
)
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