Exemple #1
0
 def __init__(self, filename, lcao, ranges_str='full'):
     Observer.__init__(self)
     self.lcao = lcao
     self.filename = filename
     self.ranges = None
     print("ranges-str", ranges_str)
     self.ranges_str = ranges_str
Exemple #2
0
    def __init__(self, paw, timestart=None, timelimit='10:00',
                 output=None, interval=1):
        """__init__ method

        Parameters:

        paw:
            GPAW calculator
        timestart: float
            The start time defining the "zero time".
            Format: as given by time.time().
        timelimit: float or string
            The allowed run time counted from `timestart`.
            Format: any supported by function `time_to_seconds()`.
        output: str
            The name of the output file for dumping the time estimates.
        """
        Observer.__init__(self, interval)
        self.timelimit = time_to_seconds(timelimit)
        if timestart is None:
            self.time0 = time.time()
        else:
            self.time0 = timestart
        self.comm = paw.world
        self.output = output
        self.do_output = self.output is not None
        if self.comm.rank == 0 and self.do_output:
            self.outf = open(self.output, 'w')
        self.loop = None
        paw.attach(self, interval, paw)
Exemple #3
0
    def __init__(self, timestep, frequencies, width=None, interval=1):
        """
        Parameters
        ----------
        timestep: float
            Time step in attoseconds (10^-18 s), e.g., 4.0 or 8.0
        frequencies: NumPy array or list of floats
            Frequencies in eV for Fourier transforms
        width: float or None
            Width of Gaussian envelope in eV, otherwise no envelope
        interval: int
            Number of timesteps between calls (used when attaching)
        """

        Observer.__init__(self, interval)
        self.timestep = interval * timestep * attosec_to_autime # autime
        self.omega_w = np.asarray(frequencies) * eV_to_aufrequency # autime^(-1)

        if width is None:
            self.sigma = None
        else:
            self.sigma = width * eV_to_aufrequency # autime^(-1)

        self.nw = len(self.omega_w)
        self.dtype = complex # np.complex128 really, but hey...
        self.Fnt_wsG = None
        self.Fnt_wsg = None

        self.Ant_sG = None
        self.Ant_sg = None
 def __init__(self, filename, lcao, ranges_str="full"):
     Observer.__init__(self)
     self.lcao = lcao
     self.filename = filename
     self.ranges = None
     print("ranges-str", ranges_str)
     self.ranges_str = ranges_str
    def __init__(self, filename, lcao, splitstr):
        Observer.__init__(self)
        self.lcao = lcao
        # self.lcao.timer.start('Split density init')
        self.filename = filename

        # Density arrays, files, and occupation numbers
        self.n_xsg = []
        self.f_xn = []

        # for i in range(2):
        #    if world.rank == 0:
        #        self.f_x.append(open(filename+'.'+str(i)+'.density','w'))
        #    else:
        #        self.f_x.append(None)
        for i in range(2):
            self.n_xsg.append(lcao.density.gd.zeros(1))
        f_n = lcao.wfs.kpt_u[0].f_n.copy()
        f2_n = lcao.wfs.kpt_u[0].f_n.copy()
        for n in range(lcao.wfs.bd.nbands):
            band_rank, myn = lcao.wfs.bd.who_has(n)
            if lcao.wfs.bd.rank == band_rank:
                if n < nsplit:
                    f_n[myn] = 0.0
                else:
                    f2_n[myn] = 0.0
        self.f_xn.append(f_n)
        self.f_xn.append(f2_n)
        # self.lcao.timer.start('Split density create LFC')
        # print "Creating lfc"
        # print "LFC created"
        self.lcao.timer.stop("Split density init")

        self.update()
Exemple #6
0
    def __init__(self, timestep, frequencies, width=None, interval=1):
        """
        Parameters

        timestep: float
            Time step in attoseconds (10^-18 s), e.g., 4.0 or 8.0
        frequencies: NumPy array or list of floats
            Frequencies in eV for Fourier transforms
        width: float or None
            Width of Gaussian envelope in eV, otherwise no envelope
        interval: int
            Number of timesteps between calls (used when attaching)
        """

        Observer.__init__(self, interval)
        self.timestep = interval * timestep * attosec_to_autime  # autime
        self.omega_w = np.asarray(
            frequencies) * eV_to_aufrequency  # autime^(-1)

        if width is None:
            self.sigma = None
        else:
            self.sigma = width * eV_to_aufrequency  # autime^(-1)

        self.nw = len(self.omega_w)
        self.dtype = complex  # np.complex128 really, but hey...
        self.Fnt_wsG = None
        self.Fnt_wsg = None

        self.Ant_sG = None
        self.Ant_sg = None
Exemple #7
0
    def __init__(self, filename, lcao, splitstr):
        Observer.__init__(self)
        self.lcao = lcao
        #self.lcao.timer.start('Split density init')
        self.filename = filename

        # Density arrays, files, and occupation numbers
        self.n_xsg = []
        self.f_xn = []

        #for i in range(2):
        #    if world.rank == 0:
        #        self.f_x.append(open(filename+'.'+str(i)+'.density','w'))
        #    else:
        #        self.f_x.append(None)
        for i in range(2):
            self.n_xsg.append(lcao.density.gd.zeros(1))
        f_n = lcao.wfs.kpt_u[0].f_n.copy()
        f2_n = lcao.wfs.kpt_u[0].f_n.copy()
        for n in range(lcao.wfs.bd.nbands):
            band_rank, myn = lcao.wfs.bd.who_has(n)
            if lcao.wfs.bd.rank == band_rank:
                if n < nsplit:
                    f_n[myn] = 0.0
                else:
                    f2_n[myn] = 0.0
        self.f_xn.append(f_n)
        self.f_xn.append(f2_n)
        #self.lcao.timer.start('Split density create LFC')
        #print "Creating lfc"
        #print "LFC created"
        self.lcao.timer.stop('Split density init')

        self.update()
Exemple #8
0
    def __init__(self,
                 filename=None,
                 paw=None,
                 ws='all',
                 frequencies=None,
                 folding='Gauss',
                 width=0.08,
                 interval=1,
                 restart_file=None):
        """
        Parameters (see also ``BaseInducedField``):
        -------------------------------------------
        paw: TDDFT object
            TDDFT object for time propagation
        width: float
            Width in eV for the Gaussian (sigma) or Lorentzian (eta) folding
            Gaussian   = exp(- (1/2) * sigma^2 * t^2)
            Lorentzian = exp(- eta * t)
        interval: int
            Number of timesteps between calls (used when attaching)
        restart_file: string
            Name of the restart file
        """

        Observer.__init__(self, interval)
        # From observer:
        # self.niter
        # self.interval

        # Restart file
        self.restart_file = restart_file

        # These are allocated in allocate()
        self.Fnt_wsG = None
        self.n0t_sG = None
        self.FD_awsp = None
        self.D0_asp = None

        self.readwritemode_str_to_list = \
        {'': ['Fnt', 'n0t', 'FD', 'D0', 'atoms'],
         'all': ['Fnt', 'n0t', 'FD', 'D0',
                 'Frho', 'Fphi', 'Fef', 'Ffe', 'atoms'],
         'field': ['Frho', 'Fphi', 'Fef', 'Ffe', 'atoms']}

        BaseInducedField.__init__(self, filename, paw, ws, frequencies,
                                  folding, width)
    def __init__(self, filename=None, paw=None, ws='all',
                  frequencies=None, folding='Gauss', width=0.08,
                  interval=1, restart_file=None
                  ):
        """
        Parameters (see also ``BaseInducedField``):
        -------------------------------------------
        paw: TDDFT object
            TDDFT object for time propagation
        width: float
            Width in eV for the Gaussian (sigma) or Lorentzian (eta) folding
            Gaussian   = exp(- (1/2) * sigma^2 * t^2)
            Lorentzian = exp(- eta * t)
        interval: int
            Number of timesteps between calls (used when attaching)
        restart_file: string
            Name of the restart file
        """

        Observer.__init__(self, interval)
        # From observer:
        # self.niter
        # self.interval
        
        # Restart file
        self.restart_file = restart_file
        
        # These are allocated in allocate()
        self.Fnt_wsG = None
        self.n0t_sG = None
        self.FD_awsp = None
        self.D0_asp = None

        self.readwritemode_str_to_list = \
        {'': ['Fnt', 'n0t', 'FD', 'D0', 'atoms'],
         'all': ['Fnt', 'n0t', 'FD', 'D0',
                 'Frho', 'Fphi', 'Fef', 'Ffe', 'atoms'],
         'field': ['Frho', 'Fphi', 'Fef', 'Ffe', 'atoms']}

        BaseInducedField.__init__(self, filename, paw, ws,
                                  frequencies, folding, width)
Exemple #10
0
 def __init__(self, filename, lcao):
     Observer.__init__(self)
     self.lcao = lcao
     self.filename = filename
Exemple #11
0
 def __init__(self, paw, interval):
     Observer.__init__(self, interval)
     self.timer = paw.timer
     if hasattr(paw, 'time') and hasattr(paw, 'niter'):
         paw.attach(self, interval, paw)
 def __init__(self, filename, lcao):
     Observer.__init__(self)
     self.lcao = lcao
     self.filename = filename
Exemple #13
0
 def __init__(self, filename, lcao):
     Observer.__init__(self)
     self.lcao = lcao
     self.filename = filename + '.sG'
     self.D_asp_filename = filename + '.asp'
     self.first_iteration = True