lime/namd/adiabats_1d.py
def propagate(self, dt, psi_x, Nsteps = 1):

        """
        Perform a series of time-steps via the time-dependent
        Schrodinger Equation.

        Parameters
        ----------
        dt : float
            the small time interval over which to integrate

        Nsteps : float, optional
            the number of intervals to compute.  The total change
            in time at the end of this method will be dt * Nsteps.
            default is N = 1
        """
        if dt > 0.0:
            f = open('density_matrix.dat', 'w')
        else:
            f = open('density_matrix_backward.dat', 'w')

        x = self.x
        V_x = self.V_x

        nx = len(x)
        nstates = self.nstates

        dt2 = 0.5 * dt


        vpsi = np.zeros((nx, nstates, nstates), dtype=complex)
        vpsi2 = np.zeros((nx, nstates, nstates), dtype=complex)

        for i in range(nx):

            Vmat = np.reshape(V_x[i,:], (nstates, nstates))
            w, u = scipy.linalg.eigh(Vmat)

            #print(np.dot(U.conj().T, Vmat.dot(U)))

            v = np.diagflat(np.exp(- 1j * w * dt))
            v2 = np.diagflat(np.exp(- 1j * w * dt2))

            vpsi[i,:,:] = u.dot(v.dot(dagger(u)))
            vpsi2[i,:,:] = u.dot(v2.dot(dagger(u)))


        dx = x[1] - x[0]

        k = 2.0 * np.pi * scipy.fftpack.fftfreq(nx, dx)

        print('Propagating the wavefunction ...')

        t = 0.0
        self.x_evolve(psi_x, vpsi2) # evolve V half step

        for i in range(Nsteps - 1):

            t += dt

            psi_x = self.k_evolve(dt, k, psi_x)
            psi_x = self.x_evolve(psi_x, vpsi)

            rho = density_matrix(psi_x, dx)

            # store the density matrix
            f.write('{} {} {} {} {} \n'.format(t, *rho))

        # psi_x = self.k_evolve(dt, psi_x)
        # psi_x = self.x_evolve(dt2, psi_x, vpsi2)


        f.close()

        return psi_x

        Perform a series of time-steps via the time-dependent
        Schrodinger Equation.

        Parameters
        ----------
        dt : float
            the small time interval over which to integrate

        Nsteps : float, optional
            the number of intervals to compute.  The total change
            in time at the end of this method will be dt * Nsteps.
            default is N = 1
        
Perform a series of time-steps via the time-dependent
Schrodinger Equation.

Parameters

dt : float
the small time interval over which to integrate

Nsteps : float, optional
the number of intervals to compute.  The total change
in time at the end of this method will be dt * Nsteps.
default is N = 1
Perform a series of time - steps via the time - dependent Schrodinger Equation . Parameters dt : float the small time interval over which to integrate Nsteps : float optional the number of intervals to compute . The total change in time at the end of this method will be dt * Nsteps . default is N = 1
def propagate(self, dt, psi_x, Nsteps = 1):
        if dt > 0.0:
            f = open('density_matrix.dat', 'w')
        else:
            f = open('density_matrix_backward.dat', 'w')
        x = self.x
        V_x = self.V_x
        nx = len(x)
        nstates = self.nstates
        dt2 = 0.5 * dt
        vpsi = np.zeros((nx, nstates, nstates), dtype=complex)
        vpsi2 = np.zeros((nx, nstates, nstates), dtype=complex)
        for i in range(nx):
            Vmat = np.reshape(V_x[i,:], (nstates, nstates))
            w, u = scipy.linalg.eigh(Vmat)
            v = np.diagflat(np.exp(- 1j * w * dt))
            v2 = np.diagflat(np.exp(- 1j * w * dt2))
            vpsi[i,:,:] = u.dot(v.dot(dagger(u)))
            vpsi2[i,:,:] = u.dot(v2.dot(dagger(u)))
        dx = x[1] - x[0]
        k = 2.0 * np.pi * scipy.fftpack.fftfreq(nx, dx)
        print('Propagating the wavefunction ...')
        t = 0.0
        self.x_evolve(psi_x, vpsi2) 
        for i in range(Nsteps - 1):
            t += dt
            psi_x = self.k_evolve(dt, k, psi_x)
            psi_x = self.x_evolve(psi_x, vpsi)
            rho = density_matrix(psi_x, dx)
            f.write('{} {} {} {} {} \n'.format(t, *rho))
        f.close()
        return psi_x
def propagate ( self , dt , psi_x , Nsteps = 1 ) : if dt > 0.0 : f = open ( 'density_matrix.dat' , 'w' ) else : f = open ( 'density_matrix_backward.dat' , 'w' ) x = self . x V_x = self . V_x nx = len ( x ) nstates = self . nstates dt2 = 0.5 * dt vpsi = np . zeros ( ( nx , nstates , nstates ) , dtype = complex ) vpsi2 = np . zeros ( ( nx , nstates , nstates ) , dtype = complex ) for i in range ( nx ) : Vmat = np . reshape ( V_x [ i , : ] , ( nstates , nstates ) ) w , u = scipy . linalg . eigh ( Vmat ) v = np . diagflat ( np . exp ( - 1j * w * dt ) ) v2 = np . diagflat ( np . exp ( - 1j * w * dt2 ) ) vpsi [ i , : , : ] = u . dot ( v . dot ( dagger ( u ) ) ) vpsi2 [ i , : , : ] = u . dot ( v2 . dot ( dagger ( u ) ) ) dx = x [ 1 ] - x [ 0 ] k = 2.0 * np . pi * scipy . fftpack . fftfreq ( nx , dx ) print ( 'Propagating the wavefunction ...' ) t = 0.0 self . x_evolve ( psi_x , vpsi2 ) for i in range ( Nsteps - 1 ) : t += dt psi_x = self . k_evolve ( dt , k , psi_x ) psi_x = self . x_evolve ( psi_x , vpsi ) rho = density_matrix ( psi_x , dx ) f . write ( '{} {} {} {} {} \n' . format ( t , * rho ) ) f . close ( ) return psi_x
Perform a series of time-steps via the time-dependent
Schrodinger Equation.
Perform a series of time - steps via the time - dependent Schrodinger Equation .
"""
        Perform a series of time-steps via the time-dependent
        Schrodinger Equation.

        Parameters
        ----------
        dt : float
            the small time interval over which to integrate

        Nsteps : float, optional
            the number of intervals to compute.  The total change
            in time at the end of this method will be dt * Nsteps.
            default is N = 1
        """ #print(np.dot(U.conj().T, Vmat.dot(U))) # evolve V half step # store the density matrix # psi_x = self.k_evolve(dt, psi_x) # psi_x = self.x_evolve(dt2, psi_x, vpsi2)
self
dt
psi_x
Nsteps