Esempio n. 1
0
    def __init__(self, **d):
        """
        The constructor have two variants : you can either provide the mesh in
        Matsubara frequencies yourself, or give the parameters to build it.
        All parameters must be given with keyword arguments.

        GfReTime(indices, window, n_points, data, tail, name)

              * ``indices``:  a list of indices names of the block
              * ``window``:  a tuple (t_min, t_max)
              * ``n_points``  : Number of time points in the mesh
              * ``data``:   A numpy array of dimensions (len(indices),len(indices),n_points) representing the value of the Green function on the mesh.
              * ``tail``:  the tail
              * ``name``:  a name of the GF

        GfReTime (indices, mesh, data, tail, name)

              * ``indices``:  a list of indices names of the block
              * ``mesh``:  a MeshGf object, such that mesh.TypeGF== GF_Type.Imaginary_Time
              * ``data``:   A numpy array of dimensions (len(indices),len(indices),n_points) representing the value of the Green function on the mesh.
              * ``tail``:  the tail
              * ``name``:  a name of the GF

        .. warning::

          The Green function take a **view** of the array data, and a **reference** to the tail.

        """
        mesh = d.pop('mesh', None)
        if mesh is None:
            window = d.pop('window')
            t_min = window[0]
            t_max = window[1]
            n_max = d.pop('n_points', 10000)
            kind = d.pop('kind', 'F')
            mesh = MeshReTime(t_min, t_max, n_max, kind)

        self.dtype = numpy.complex_
        indices_pack = get_indices_in_dict(d)
        indicesL, indicesR = indices_pack
        N1, N2 = len(indicesL), len(indicesR)
        data = d.pop('data') if 'data' in d else numpy.zeros(
            (len(mesh), N1, N2), self.dtype)
        tail = d.pop('tail') if 'tail' in d else TailGf(shape=(N1, N2))
        symmetry = d.pop('symmetry', None)
        name = d.pop('name', 'g')
        assert len(
            d
        ) == 0, "Unknown parameters in GFBloc constructions %s" % d.keys()

        GfGeneric.__init__(self, mesh, data, tail, symmetry, indices_pack,
                           name, GfReTime)
        GfReTime_cython.__init__(self, mesh, data, tail)
Esempio n. 2
0
    def __init__(self, **d):
        """
    The constructor has two variants : you can either provide the mesh in
    real time yourself, or give the parameters to build it.
    All parameters must be given with keyword arguments.

    GfReTime (indices, beta, statistic, n_time_points, time_min, time_max, data, tail, name, note)

           * ``indices``:  a list of indices names of the block
           * ``beta``:  Inverse Temperature 
           * ``statistic``:  'F' or 'B'
           * ``n_time_points``  : Number of time slices
           * ``time_min,time_max``  : The time window
           * ``data``:   A numpy array of dimensions (len(indices),len(indices),n_time_points) representing the value of the Green function on the mesh. 
           * ``tail``:  the tail 
           * ``name``:  a name of the GF
           * ``note``:  any string you like...

    If you already have the mesh, you can use a simpler version :

    GfReTime (indices, mesh, data, tail, name,note)
        
           * ``indices``:  a list of indices names of the block
           * ``mesh``:  a MeshGf object, such that mesh.TypeGF== GF_Type.Real_Time 
           * ``data``:   A numpy array of dimensions (len(indices),len(indices),n_time_points) representing the value of the Green function on the mesh. 
           * ``tail``:  the tail 
           * ``name``:  a name of the GF
           * ``note``:  any string you like...

.. warning::
    The Green function take a **view** of the array data, and a **reference** to the tail.

         """
        # construct the mesh if needed
        if 'mesh' not in d : 
            if 'beta' not in d : raise ValueError, "beta not provided"
            beta = float(d['beta'])
            n_max = d.pop('n_time_points',1024)
            assert n_max%2 ==0, "Use an even number of slices"
            timeMin = d.pop('time_min',-10)
            timeMax = d.pop('time_max', 10)
            dt = float (timeMax - timeMin)/ n_max
            d['mesh'] = MeshRealTime( GF_Type.Real_Time,stat,beta,
                                numpy.array([ timeMin + (n+0.5)*dt for n in range(n_max)]))

        self.time_min, self.time_max, self.Npts = min(d['mesh']), max(d['mesh']), len(d['mesh'])
        dt = (self.time_max - self.time_min)/(self.Npts -1)
        self.time_min -= dt/2 ;self.time_max += dt/2 
        # ????? duplicated in C++... not very clean, but ok.

        GfReTime_cython.__init__(self,*self._prepare_init(d))
Esempio n. 3
0
    def __init__(self, **d):
        """
        The constructor have two variants : you can either provide the mesh in
        Matsubara frequencies yourself, or give the parameters to build it.
        All parameters must be given with keyword arguments.

        GfReTime(indices, window, n_points, data, tail, name)

              * ``indices``:  a list of indices names of the block
              * ``window``:  a tuple (t_min, t_max)
              * ``n_points``  : Number of time points in the mesh
              * ``data``:   A numpy array of dimensions (len(indices),len(indices),n_points) representing the value of the Green function on the mesh.
              * ``tail``:  the tail
              * ``name``:  a name of the GF

        GfReTime (indices, mesh, data, tail, name)

              * ``indices``:  a list of indices names of the block
              * ``mesh``:  a MeshGf object, such that mesh.TypeGF== GF_Type.Imaginary_Time
              * ``data``:   A numpy array of dimensions (len(indices),len(indices),n_points) representing the value of the Green function on the mesh.
              * ``tail``:  the tail
              * ``name``:  a name of the GF

        .. warning::

          The Green function take a **view** of the array data, and a **reference** to the tail.

        """
        mesh = d.pop('mesh',None)
        if mesh is None :
            window = d.pop('window')
            t_min = window[0]
            t_max = window[1]
            n_max = d.pop('n_points',10000)
            kind = d.pop('kind','F')
            mesh = MeshReTime(t_min, t_max, n_max, kind)

        self.dtype = numpy.complex_
        indices_pack = get_indices_in_dict(d)
        indicesL, indicesR = indices_pack
        N1, N2 = len(indicesL),len(indicesR)
        data = d.pop('data') if 'data' in d else numpy.zeros((len(mesh),N1,N2), self.dtype )
        tail= d.pop('tail') if 'tail' in d else TailGf(shape = (N1,N2))
        symmetry = d.pop('symmetry',None)
        name = d.pop('name','g')
        assert len(d) ==0, "Unknown parameters in GFBloc constructions %s"%d.keys()

        GfGeneric.__init__(self, mesh, data, tail, symmetry, indices_pack, name, GfReTime)
        GfReTime_cython.__init__(self, mesh, data, tail)