lime/spo/NAMD_2D.py
def spo_dynamics(dt, v_2d, psi0, num_steps=0):
    """
    perform the propagation of the dynamics and calculate the purity at
    every time step
    :param dt: time step
    :param v_2d: list
                potential matrices in 2D
    :param psi_grid_0: list
                the initial state
    :param num_steps: the number of the time steps
                   num_steps=0 indicates that no propagation has been done,
                   only the initial state and the initial purity would be
                   the output
    :return: psi_end: list
                      the final state
             purity: float array
                      purity values at each time point
    """
    #f = open('density_matrix.dat', 'w')
    t = 0.0
    psi_grid = psi0

    purity = np.zeros(num_steps)
    #purity[0] = density_matrix(psi_grid)[4].real 

    kx = fftfreq(nx, dx)
    ky = fftfreq(ny, dy)

    dt2 = dt * 0.5 
    
    vpsi(dt2, v_2d, psi_grid)

    for i in range(num_steps):
        t += dt
        
        k_evolve_2d(dt, kx, ky, psi_grid)
        vpsi(dt, v_2d, psi_grid)
        
        output_tmp = density_matrix(psi_grid)

        #f.write('{} {} {} {} {} \n'.format(t, *rho))
        purity[i] = output_tmp[4].real 

    #k_evolve_2d(dt, kx, ky, psi_grid)
    #vpsi(dt, v_2d, psi_grid)

    # t += dt
    #f.close()

    return psi_grid, purity

    perform the propagation of the dynamics and calculate the purity at
    every time step
    :param dt: time step
    :param v_2d: list
                potential matrices in 2D
    :param psi_grid_0: list
                the initial state
    :param num_steps: the number of the time steps
                   num_steps=0 indicates that no propagation has been done,
                   only the initial state and the initial purity would be
                   the output
    :return: psi_end: list
                      the final state
             purity: float array
                      purity values at each time point
    
perform the propagation of the dynamics and calculate the purity at
every time step
perform the propagation of the dynamics and calculate the purity at every time step
def spo_dynamics(dt, v_2d, psi0, num_steps=0):
    t = 0.0
    psi_grid = psi0
    purity = np.zeros(num_steps)
    kx = fftfreq(nx, dx)
    ky = fftfreq(ny, dy)
    dt2 = dt * 0.5 
    vpsi(dt2, v_2d, psi_grid)
    for i in range(num_steps):
        t += dt
        k_evolve_2d(dt, kx, ky, psi_grid)
        vpsi(dt, v_2d, psi_grid)
        output_tmp = density_matrix(psi_grid)
        purity[i] = output_tmp[4].real 
    return psi_grid, purity
def spo_dynamics ( dt , v_2d , psi0 , num_steps = 0 ) : t = 0.0 psi_grid = psi0 purity = np . zeros ( num_steps ) kx = fftfreq ( nx , dx ) ky = fftfreq ( ny , dy ) dt2 = dt * 0.5 vpsi ( dt2 , v_2d , psi_grid ) for i in range ( num_steps ) : t += dt k_evolve_2d ( dt , kx , ky , psi_grid ) vpsi ( dt , v_2d , psi_grid ) output_tmp = density_matrix ( psi_grid ) purity [ i ] = output_tmp [ 4 ] . real return psi_grid , purity
perform the propagation of the dynamics and calculate the purity at
every time step
perform the propagation of the dynamics and calculate the purity at every time step
"""
    perform the propagation of the dynamics and calculate the purity at
    every time step
    :param dt: time step
    :param v_2d: list
                potential matrices in 2D
    :param psi_grid_0: list
                the initial state
    :param num_steps: the number of the time steps
                   num_steps=0 indicates that no propagation has been done,
                   only the initial state and the initial purity would be
                   the output
    :return: psi_end: list
                      the final state
             purity: float array
                      purity values at each time point
    """ #f = open('density_matrix.dat', 'w') #purity[0] = density_matrix(psi_grid)[4].real  #f.write('{} {} {} {} {} \n'.format(t, *rho)) #k_evolve_2d(dt, kx, ky, psi_grid) #vpsi(dt, v_2d, psi_grid) # t += dt #f.close()
list
the final state
purity: float array
purity values at each time point
list the final state purity : float array purity values at each time point
dt
None
v_2d
list
potential matrices in 2D
list potential matrices in 2D
psi0
num_steps
the number of the time steps
num_steps=0 indicates that no propagation has been done,
only the initial state and the initial purity would be
the output
the number of the time steps num_steps = 0 indicates that no propagation has been done only the initial state and the initial purity would be the output
psi_grid_0
list
the initial state
list the initial state