Skip to content
Snippets Groups Projects
Commit 2ace6538 authored by patavirt's avatar patavirt
Browse files

examples: make cpr_sns produce a plot

parent 83d4c639
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,8 @@ from usadelndsoc.matsubara import get_matsubara_sum ...@@ -15,6 +15,8 @@ from usadelndsoc.matsubara import get_matsubara_sum
from usadelndsoc.solver import * from usadelndsoc.solver import *
from usadelndsoc.util import vectorize_parallel from usadelndsoc.util import vectorize_parallel
import collections
mem = joblib.Memory("cache") mem = joblib.Memory("cache")
...@@ -49,9 +51,13 @@ def get_solver(soc_alpha, eta, phi, L=10, h=0.5, D=1.0, n=5): ...@@ -49,9 +51,13 @@ def get_solver(soc_alpha, eta, phi, L=10, h=0.5, D=1.0, n=5):
return sol return sol
# @usadelndsoc.with_log_level(logging.WARNING) Res = collections.namedtuple("Res", ["x", "y", "J", "Jx", "Jy"])
@vectorize_parallel(returns_object=True, noarray=True) @vectorize_parallel(returns_object=True, noarray=True)
@usadelndsoc.with_log_level(logging.WARNING)
def j(T, h, phi, n=15, eta=0.1, alpha_soc=0.1, L=10, perturbative=False): def j(T, h, phi, n=15, eta=0.1, alpha_soc=0.1, L=10, perturbative=False):
sol = get_solver(soc_alpha=alpha_soc, eta=eta, L=L, n=n, phi=phi, h=h) sol = get_solver(soc_alpha=alpha_soc, eta=eta, L=L, n=n, phi=phi, h=h)
E_typical = 10 + 10 * T E_typical = 10 + 10 * T
...@@ -67,29 +73,24 @@ def j(T, h, phi, n=15, eta=0.1, alpha_soc=0.1, L=10, perturbative=False): ...@@ -67,29 +73,24 @@ def j(T, h, phi, n=15, eta=0.1, alpha_soc=0.1, L=10, perturbative=False):
Jx = (J[:, :, 0] + J[:, :, 2]).real / 2 Jx = (J[:, :, 0] + J[:, :, 2]).real / 2
Jy = (J[:, :, 1] + J[:, :, 3]).real / 2 Jy = (J[:, :, 1] + J[:, :, 3]).real / 2
return sol.x, sol.y, J, Jx, Jy return Res(sol.x, sol.y, J, Jx, Jy)
def main(): def main():
T = 0.02 T = 0.1
alpha_soc = 0.05 alpha_soc = 0.1
Da2 = alpha_soc**2 h = 0.5
h = np.linspace(0, 1.75, 29) phi = np.linspace(-pi, pi, 37)
res = j_anom(T, h, alpha_soc=alpha_soc, perturbative=False, mem=mem) res = j(T, h, phi, alpha_soc=alpha_soc, perturbative=False, mem=mem)
j = np.asarray([x[0] for x in res])
j_an = np.asarray([x[1] for x in res])
t3 = np.diag([1, 1, -1, -1]) Jx_mean = np.asarray([x.Jx[1:-1].sum(axis=1).mean(axis=0) for x in res])
j = tr(j @ t3)[:, 2, 2, UP]
plt.plot(h, -j.real, "-", label=r"numerics") plt.plot(phi / pi, Jx_mean)
plt.plot(h, -j_an.real, "--", label=r"analytic") plt.xlabel(r"$\varphi / \pi$")
plt.title(rf"$T = {T} \Delta$, $D\alpha^2 = {Da2:.4} \Delta$") plt.ylabel(r"$I$")
plt.xlabel(r"$h/\Delta$")
plt.ylabel(r"$j_{\mathrm{an}}$")
plt.legend() plt.legend()
plt.savefig("bulk_j_an.pdf") plt.savefig("cpr_sns.pdf")
if __name__ == "__main__": if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment