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
af88097e
Commit
af88097e
authored
2 years ago
by
patavirt
Browse files
Options
Downloads
Patches
Plain Diff
add files
parent
03c4f10f
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
usadelndsoc/bcs.py
+71
-0
71 additions, 0 deletions
usadelndsoc/bcs.py
usadelndsoc/meson.build
+1
-1
1 addition, 1 deletion
usadelndsoc/meson.build
with
72 additions
and
1 deletion
usadelndsoc/bcs.py
0 → 100644
+
71
−
0
View file @
af88097e
# -*- mode:python; coding: utf-8; eval: (blacken-mode) -*-
"""
BCS superconductor gap
"""
# Author: Pauli Virtanen
# License: GNU Affero General Public License, see LICENSE.txt for details
import
numpy
as
np
from
numpy
import
pi
,
exp
,
sqrt
,
log
,
euler_gamma
from
scipy.optimize
import
brenth
,
golden
from
scipy.interpolate
import
make_interp_spline
,
PPoly
from
.
import
matsubara
__all__
=
[
"
BCS_Delta
"
]
@np.vectorize
def
BCS_Delta
(
T
,
Tc
,
h
=
0
):
"""
Evaluate Delta in a bulk BCS superconductor.
"""
Delta_0
=
pi
/
exp
(
euler_gamma
)
*
Tc
if
T
<
1e-2
*
Delta_0
:
T
=
1e-2
*
Delta_0
w
,
a
=
matsubara
.
get_matsubara_sum
(
T
,
100
*
max
(
Tc
,
abs
(
h
)),
steps
=
128
,
max_ne
=
3000
)
def
delta_fun
(
Delta
):
Omega
=
w
+
1j
*
h
r
=
1
/
abs
(
w
)
-
(
1
/
sqrt
(
Omega
**
2
+
abs
(
Delta
)
**
2
)).
real
res
=
log
(
Tc
/
T
)
-
pi
*
(
a
*
r
).
sum
(
axis
=-
1
)
return
res
def
F_fun
(
Delta
):
Omega
=
w
+
1j
*
h
r
=
np
.
real
(
2
*
Omega
*
np
.
sign
(
Omega
.
real
)
-
(
2
*
Omega
**
2
+
Delta
**
2
)
/
np
.
sqrt
(
Omega
**
2
+
Delta
**
2
)
)
return
pi
*
(
a
*
r
).
sum
(
axis
=-
1
)
x
=
np
.
linspace
(
0
,
2
*
Delta_0
,
500
)
# Bracket roots
y
=
delta_fun
(
x
[:,
None
])
spl
=
make_interp_spline
(
x
,
y
,
k
=
1
)
spl
=
PPoly
.
from_spline
(
spl
,
extrapolate
=
False
)
r
=
spl
.
roots
()
if
r
.
size
==
0
:
return
0.0
r_a
=
np
.
r_
[
0
,
(
r
[:
-
1
]
+
r
[
1
:])
/
2
]
r_b
=
np
.
r_
[
r_a
[
1
:],
r
[
-
1
]
+
0.1
]
# Refine roots and find the one with smallest free energy
r_min
=
0
F_min
=
F_fun
(
0.0
)
for
aa
,
bb
in
zip
(
r_a
,
r_b
):
try
:
r
=
brenth
(
delta_fun
,
aa
,
bb
)
except
ValueError
:
print
(
"
error:
"
,
T
,
Tc
,
h
,
aa
,
bb
,
delta_fun
(
aa
),
delta_fun
(
bb
))
raise
F
=
F_fun
(
r
)
if
F
<
F_min
:
r_min
=
r
return
r_min
This diff is collapsed.
Click to expand it.
usadelndsoc/meson.build
+
1
−
1
View file @
af88097e
...
...
@@ -7,7 +7,7 @@ py3.extension_module(
)
py3
.
install_sources
(
[
'__init__.py'
,
'
matsubara
.py'
],
[
'__init__.py'
,
'
bcs.py'
,
'matsubara.py'
,
'solver
.py'
],
pure
:
false
,
subdir
:
'usadelndsoc'
,
)
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