adds gap calc and tests
This commit is contained in:
@@ -2,11 +2,29 @@ BeginPackage["gapCalc`"];
|
||||
(* Exported symbols added here with SymbolName::usage *)
|
||||
|
||||
info::usage = "Returns info about the package";
|
||||
tegral::usage = "tegral[T, d, mustar, wc] returns the integral function value necessary for the numerical procedure";
|
||||
gap::usage = "gap[T, mustar, nv, wc] returns the gap satisfying the OS gap equation for the provided values, nv is density of states N(0) * interaction V";
|
||||
|
||||
Begin["`Private`"];
|
||||
|
||||
info[] := "gap calc utilities";
|
||||
|
||||
(* *)
|
||||
tegral[T_?NumericQ, d_?NumericQ, mustar_?NumericQ, wc_?NumericQ] :=
|
||||
NIntegrate[
|
||||
Tanh[(Sqrt[xi^2 + d^2] - mustar)/(2*T)] / (2 * Sqrt[xi^2 + d^2])
|
||||
, {xi, -wc, wc}];
|
||||
tegral[T_?NumericQ, d_?NumericQ, mustar_?NumericQ, wc_?NumericQ] :=
|
||||
NIntegrate[
|
||||
1/ (2 * Sqrt[xi^2 + d^2]) * (2 * HeavisideTheta[-mustar + Sqrt[d^2 + xi^2]] - 1)
|
||||
, {xi, -wc, wc}] /; T == 0;
|
||||
|
||||
gap[T_, mustar_, nv_, wc_] :=
|
||||
d /. FindRoot[
|
||||
tegral[T, d, mustar, wc] == (1/nv), {d, N[wc / (Sinh[1/nv])],
|
||||
0, wc * 10}];
|
||||
|
||||
|
||||
End[]; (* `Private` *)
|
||||
|
||||
EndPackage[];
|
||||
@@ -7,4 +7,12 @@ VerificationTest[(* 1 *)
|
||||
, TestID -> "info test"
|
||||
];
|
||||
|
||||
VerificationTest[
|
||||
gap[0, 0, .2, 100]
|
||||
,
|
||||
1.3476505830587
|
||||
, SameTest -> approxEqual
|
||||
, TestID -> "basic gap"
|
||||
];
|
||||
|
||||
EndTestSection[];
|
||||
|
||||
Reference in New Issue
Block a user