📄 phk.cpp
字号:
#include "../davidson/pHK.h"
#include <math.h>
PotentialHK::PotentialHK(const ftyp &a, const ftyp &V0,
const ftyp &e0, const ftyp &w):
PotentialBase()
{
typV=4;
PotentialHK::a=a;
PotentialHK::V0=V0;
PotentialHK::e0=e0;
PotentialHK::w=w;
}
ftyp PotentialHK::operator()(const ftyp &x) const{ ftyp ap,am,alpha0=e0/(w*w); ftyp xs=x-alpha0; if (xs>-a) ap=1; else if (xs<(-2*alpha0-a)) ap=-1; else ap=1+(a+xs)/alpha0; if (xs>a) am=1; else if (xs<(-2*alpha0+a)) am=-1; else am=1-(a-xs)/alpha0; return -V0*(asin(ap)-asin(am))/M_PI;}ftyp PotentialHK::operator()(const ftyp &x, const ftyp &y) const{ if (y*y>a*a) return 0.0; //dziedzian sqrt !!! ftyp ap,am,sr=sqrt(a*a-y*y); ftyp alpha0=e0/(w*w), xs=x+alpha0; if (xs<sr) ap=1; else if (xs>(2*alpha0+sr)) ap=-1; else ap=1+(sr-xs)/alpha0; if (xs<-sr) am=1; else if (xs>(2*alpha0-sr)) am=-1; else am=1-(sr+xs)/alpha0; return -V0*Theta(a*a-y*y)*(asin(ap)-asin(am))/M_PI;}ftyp PotentialHK::operator()(const ftyp &x, const ftyp &y, const ftyp &z) const{ if (z*z+y*y>a*a) return 0.0; //dziedzian sqrt !!! ftyp ap,am,sr=sqrt(a*a-y*y-z*z); ftyp alpha0=e0/(w*w), xs=x+alpha0; if (xs<sr) ap=1; else if (xs>(2*alpha0+sr)) ap=-1; else ap=1+(sr-xs)/alpha0; if (xs<-sr) am=1; else if (xs>(2*alpha0-sr)) am=-1; else am=1-(sr+xs)/alpha0; return -V0*Theta(a*a-y*y-z*z)*(asin(ap)-asin(am))/M_PI;}
void PotentialHK::SetE0W(const ftyp &e0, const ftyp &w)
{ PotentialHK::e0=e0; PotentialHK::w=w;}void PotentialHK::SetAV0(const ftyp &a, const ftyp &V0){ PotentialHK::a = a; PotentialHK::V0 = V0;}ftyp PotentialHK::GetV0() const{ return V0;}ftyp PotentialHK::GetA() const{ return a;}ftyp PotentialHK::GetE0() const{ return e0;}ftyp PotentialHK::GetW() const{ return w;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -