ВУЗ:
Составители:
Рубрика:
16
Module[{f,V1,V2},
{f,V1,V2} = DerMatch[energy,Z,Fi,Rmin,Rmax,Rm,del]; Return[f]];
CPotential[Rd_,Rmin_Real,Rmax_Real,r_Real] :=
Module[{a,b,Ro,t,res},
a = (1/r)*NIntegrate[Rd /. x -> t,{t,Rmin,r},
AccuracyGoal -> epsilon];
b = NIntegrate[(Rd /. x -> t)/t,{t,r,Rmax},
AccuracyGoal -> epsilon];
Return[a + b]];
(* головная часть программы *)
t0 = AbsoluteTime[];
Z = 2.; Nocc = 2;
Rmin = 0.001; Rmax = 7.6;
Rm = 4.; del = 1.;
{R,P} = InitD[Z,Rmin,Rmax];
Np = Length[R];
emin = -1.2; emax = -0.8;
e0 = -99.; e = (emax + emin)/2.;
delta = 0.001;
eps = 0.001;
epsilon = 0.00001;
iter = 0;
StylePrint[" АТОМ ГЕЛИЯ:
1
S","Output",
CellFrame -> False,FontFamily -> "Courier", FontSize -> 12,
FontColor -> RGBColor[0,0,1], FontWeight -> Bold,
TextAlignment -> Left];
dash = "-----------------------------";
Print[dash]; Print[" итер. E1s время"];
Print[dash];
While[Abs[e - e0] > eps,
t1 = AbsoluteTime[];
iter = iter + 1; e0 = e; P0 = P; Rd = Nocc*P0^2;
FiM = Table[{R[[i]], CPotential[Rd,Rmin,Rmax,R[[i]]]},{i,Np}];
Fi = Interpolation[FiM][x];
num = 0;
For[energy = emin, energy <= emax, energy = energy + delta,
en1 = energy; en2 = en1 + delta;
f1 = Fmatch[en1]; f2 = Fmatch[en2];
If[Sign[f1]*Sign[f2] < 0.,
num = 1; en0 = (en1 + en2)/2.;
{ren} = FindRoot[Fmatch[en],{en,{en0,en0 + 0.00001}}];
e = en /. ren; Break[]]];
{If[num == 0, Print["Решение не найдено :-("]; Break[]];
{f,Pout,Pin} = DerMatch[e,Z,Fi,Rmin,Rmax,Rm,del];
M = Table[{R[[i]],If[R[[i]] <= Rm,Pout /. x -> R[[i]],
Pin /. x -> R[[i]]]},{i,Np}]; P = Interpolation[M][x];
norm = NIntegrate[P^2, {x,Rmin,Rmax}, AccuracyGoal -> eps];
norm = 1./Sqrt[Abs[norm]]; P = norm*P;
t1 = AbsoluteTime[] - t1;
Print[PaddedForm[iter, 3], PaddedForm[e, {11, 3}],
PaddedForm[Round[t1], 8]]];
16 Module[{f,V1,V2}, {f,V1,V2} = DerMatch[energy,Z,Fi,Rmin,Rmax,Rm,del]; Return[f]]; CPotential[Rd_,Rmin_Real,Rmax_Real,r_Real] := Module[{a,b,Ro,t,res}, a = (1/r)*NIntegrate[Rd /. x -> t,{t,Rmin,r}, AccuracyGoal -> epsilon]; b = NIntegrate[(Rd /. x -> t)/t,{t,r,Rmax}, AccuracyGoal -> epsilon]; Return[a + b]]; (* головная часть программы *) t0 = AbsoluteTime[]; Z = 2.; Nocc = 2; Rmin = 0.001; Rmax = 7.6; Rm = 4.; del = 1.; {R,P} = InitD[Z,Rmin,Rmax]; Np = Length[R]; emin = -1.2; emax = -0.8; e0 = -99.; e = (emax + emin)/2.; delta = 0.001; eps = 0.001; epsilon = 0.00001; iter = 0; StylePrint[" АТОМ ГЕЛИЯ: 1S","Output", CellFrame -> False,FontFamily -> "Courier", FontSize -> 12, FontColor -> RGBColor[0,0,1], FontWeight -> Bold, TextAlignment -> Left]; dash = "-----------------------------"; Print[dash]; Print[" итер. E1s время"]; Print[dash]; While[Abs[e - e0] > eps, t1 = AbsoluteTime[]; iter = iter + 1; e0 = e; P0 = P; Rd = Nocc*P0^2; FiM = Table[{R[[i]], CPotential[Rd,Rmin,Rmax,R[[i]]]},{i,Np}]; Fi = Interpolation[FiM][x]; num = 0; For[energy = emin, energy <= emax, energy = energy + delta, en1 = energy; en2 = en1 + delta; f1 = Fmatch[en1]; f2 = Fmatch[en2]; If[Sign[f1]*Sign[f2] < 0., num = 1; en0 = (en1 + en2)/2.; {ren} = FindRoot[Fmatch[en],{en,{en0,en0 + 0.00001}}]; e = en /. ren; Break[]]]; {If[num == 0, Print["Решение не найдено :-("]; Break[]]; {f,Pout,Pin} = DerMatch[e,Z,Fi,Rmin,Rmax,Rm,del]; M = Table[{R[[i]],If[R[[i]] <= Rm,Pout /. x -> R[[i]], Pin /. x -> R[[i]]]},{i,Np}]; P = Interpolation[M][x]; norm = NIntegrate[P^2, {x,Rmin,Rmax}, AccuracyGoal -> eps]; norm = 1./Sqrt[Abs[norm]]; P = norm*P; t1 = AbsoluteTime[] - t1; Print[PaddedForm[iter, 3], PaddedForm[e, {11, 3}], PaddedForm[Round[t1], 8]]];
Страницы
- « первая
- ‹ предыдущая
- …
- 14
- 15
- 16
- 17
- 18
- …
- следующая ›
- последняя »