propagation.py 文件源码

python
阅读 43 收藏 0 点赞 0 评论 0

项目:alignment_calculator 作者: andersas 项目源码 文件源码
def propagate_ODE(psi_0,time,E_rot,E_0_squared_max,sigma,V0,V1,V2,abstol=1e-8,reltol=1e-8):
     ''' Same as propagate, except it uses an ODE solver instead
     of the matrix method.

     psi_0: initial wave function
     time: array of timesteps to integrate. psi_0 is given at time[0].
           The time step must be constant!
     E_rot: array of rotational energies for each J.
     E_0_squared_max: Max value of the square of the E field during pulse
     sigma: temporal variance of the gaussian
     V0,V1,V2: the three bands of the symmetric 5 diagonal interaction matrix,
               V0 being the diagonal.
     abstol, reltol: Error tolerances used for the ODE solver.

     '''
     if (numpy.any(numpy.abs(numpy.diff(numpy.diff(time)))>1e-20)):
         raise RuntimeError("Pulse time steps must be equidistant.");
     dt = time[1]-time[0];

     psi_t = numpy.empty((len(time),len(psi_0)), dtype=numpy.complex)
     psi_t[0,:] = psi_0;
     try:
         res = libpropagation.propagate_field_ODE(len(time),len(psi_0),time[0],dt,E_0_squared_max,sigma,psi_t,V0,V1,V2,E_rot, abstol, reltol);
     except:
         raise RuntimeError("For ODE propagation, you need the libpropagation C library, compiled with GSL support.");

     if (res != 0):
         raise RuntimeError("Basis size too small");

     return psi_t;
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号