Ejemplo n.º 1
0
def init( mesh=None, shape=None, name='g', **kwargs):
    """
    """
    if mesh is None:
        from gf import MeshImFreq
        if 'beta' not in kwargs: raise ValueError, "beta not provided"
        beta = float(kwargs.pop('beta'))
        n_points = kwargs.pop('n_points',1025)
        stat = kwargs.pop('statistic','Fermion')
        positive_only = kwargs.pop('positive_only',True)
        mesh = MeshImFreq(beta,stat,n_points, positive_only)
    
    indices_pack = get_indices_in_dict(kwargs)
    if not shape: 
      assert indices_pack, "No shape, no indices !"
      indicesL, indicesR = indices_pack
      shape = len(indicesL),len(indicesR)
    if kwargs: raise ValueError, "GfImFreq: Unused parameters %s were passed."%kwargs.keys()


    # FIXME why is this here and uncommented?    
    #data = kwargs.pop('data') if 'data' in kwargs else numpy.zeros((len(mesh),N1,N2), self.dtype )
    #tail = kwargs.pop('tail') if 'tail' in kwargs else TailGf(shape = (N1,N2))
    #symmetry = kwargs.pop('symmetry', Nothing())
    #return mesh, data, tail, symmetry, indices_pack, name

    return (mesh, shape, indices_pack, name), {}
Ejemplo n.º 2
0
def init(mesh=None, shape=None, name='g', **kwargs):
    """
    """
    if mesh is None:
        from gf import MeshImTime
        if 'beta' not in kwargs: raise ValueError, "beta not provided"
        beta = float(kwargs.pop('beta'))
        n_max = kwargs.pop('n_points', 10000)
        stat = kwargs.pop('statistic', 'Fermion')
        mesh = MeshImTime(beta, stat, n_max)

    indices_pack = get_indices_in_dict(kwargs)
    if not shape:
        assert indices_pack, "No shape, no indices !"
        indicesL, indicesR = indices_pack
        shape = len(indicesL), len(indicesR)
    if kwargs:
        raise ValueError, "GfImTime: Unused parameters %s were passed." % kwargs.keys(
        )

    # FIXME
    #data = kwargs.pop('data') if 'data' in kwargs else numpy.zeros((len(mesh),N1,N2), self.dtype )
    #tail = kwargs.pop('tail') if 'tail' in kwargs else TailGf(shape = (N1,N2))
    #symmetry = kwargs.pop('symmetry', Nothing())

    return (mesh, shape, indices_pack, name), {}
Ejemplo n.º 3
0
def init(mesh=None, shape=None, name='g', **kwargs):
    """
    """
    if mesh is None:
        from gf import MeshReTime
        window = kwargs.pop('window')
        t_min = window[0]
        t_max = window[1]
        n_max = kwargs.pop('n_points', 10000)
        mesh = MeshReTime(t_min, t_max, n_max)

    indices_pack = get_indices_in_dict(kwargs)
    if not shape:
        assert indices_pack, "No shape, no indices !"
        indicesL, indicesR = indices_pack
        shape = len(indicesL), len(indicesR)
    if kwargs:
        raise ValueError, "GfReFreq: Unused parameters %s were passed." % kwargs.keys(
        )

    #data = kwargs.pop('data') if 'data' in kwargs else numpy.zeros((len(mesh),N1,N2), self.dtype )
    #tail = kwargs.pop('tail') if 'tail' in kwargs else TailGf(shape = (N1,N2))
    #symmetry = kwargs.pop('symmetry', Nothing())

    return (mesh, shape, indices_pack, name), {}
Ejemplo n.º 4
0
def init( mesh = None, shape = None, name = 'g', **kwargs):
    """
    """
    if mesh is None: 
        from gf import MeshImTime
        if 'beta' not in kwargs: raise ValueError, "beta not provided"
        beta = float(kwargs.pop('beta'))
        n_max = kwargs.pop('n_points',10000)
        stat = kwargs.pop('statistic','Fermion')
        mesh = MeshImTime(beta,stat,n_max)
    
    indices_pack = get_indices_in_dict(kwargs)
    if not shape: 
      assert indices_pack, "No shape, no indices !"
      indicesL, indicesR = indices_pack
      shape = len(indicesL),len(indicesR)
    if kwargs: raise ValueError, "GfImTime: Unused parameters %s were passed."%kwargs.keys()


    # FIXME 
    #data = kwargs.pop('data') if 'data' in kwargs else numpy.zeros((len(mesh),N1,N2), self.dtype )
    #tail = kwargs.pop('tail') if 'tail' in kwargs else TailGf(shape = (N1,N2))
    #symmetry = kwargs.pop('symmetry', Nothing())

    return (mesh, shape, indices_pack, name), {}
Ejemplo n.º 5
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.

        GfImFreq(indices, beta, statistic, n_points, data, tail, name)

              * ``indices``:  a list of indices names of the block
              * ``beta``:  Inverse Temperature
              * ``statistic``:  'F' or 'B'
              * ``positive_only``:  True or False
              * ``n_points``:  Number of Matsubara frequencies
              * ``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

        GfImFreq(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_Frequency
              * ``data``:   A numpy array of dimensions (len(indices),len(indices),:) 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:
            if 'beta' not in d: raise ValueError, "beta not provided"
            beta = float(d.pop('beta'))
            n_points = d.pop('n_points', 1025)
            stat = d.pop('statistic', 'F')
            positive_only = d.pop('positive_only', True)
            mesh = MeshImFreq(beta, stat, n_points, positive_only)

        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', Nothing())
        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, GfImFreq)
        GfImFreq_cython.__init__(self, mesh, data, tail)
Ejemplo n.º 6
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)
Ejemplo n.º 7
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.

        GfImFreq(indices, beta, statistic, n_points, data, tail, name)

              * ``indices``:  a list of indices names of the block
              * ``beta``:  Inverse Temperature
              * ``statistic``:  'F' or 'B'
              * ``positive_only``:  True or False
              * ``n_points``:  Number of Matsubara frequencies
              * ``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

        GfImFreq(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_Frequency
              * ``data``:   A numpy array of dimensions (len(indices),len(indices),:) 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 :
            if 'beta' not in d : raise ValueError, "beta not provided"
            beta = float(d.pop('beta'))
            n_points = d.pop('n_points',1025)
            stat = d.pop('statistic','F')
            positive_only = d.pop('positive_only',True)
            mesh = MeshImFreq(beta,stat,n_points, positive_only)

        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', Nothing())
        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, GfImFreq)
        GfImFreq_cython.__init__(self, mesh, data, tail)
Ejemplo n.º 8
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.

        GfTwoRealTime(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 = MeshTwoRealTime(t_max, n_max)
            #mesh = MeshTwoRealTime(t_min, t_max, n_max)
            #mesh = MeshReTime(t_min, t_max, n_max, 'F')

        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 )
        symmetry = d.pop('symmetry',None)
        name = d.pop('name','g')
        assert len(d) ==0, "Unknown parameters in GfTwoRealTime constructions %s"%d.keys()

        GfGeneric.__init__(self, mesh, data, None, symmetry, indices_pack, name, GfTwoRealTime)
        GfTwoRealTime_cython.__init__(self, mesh, data)
Ejemplo n.º 9
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.

        GfImTime(indices, beta, statistic, n_time_points, data, tail, name)

              * ``indices``:  a list of indices names of the block
              * ``beta``:  Inverse Temperature 
              * ``statistic``:  'F' or 'B'
              * ``n_time_points``  : Number of time points in the mesh
              * ``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
        If you already have the mesh, you can use a simpler version :

        GfImTime (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_time_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 : 
            if 'beta' not in d : raise ValueError, "beta not provided"
            beta = float(d.pop('beta'))
            stat = d.pop('statistic','F') 
            n_max = d.pop('n_time_points',10000)
            kind = d.pop('kind','H') 
            mesh = MeshImTime(beta,stat,n_max,kind)

        self.dtype = numpy.float64
        indicesL, indicesR = get_indices_in_dict(d)
        N1, N2 = len(indicesL),len(indicesR)
        data = d.pop('data') if 'data' in d else numpy.zeros((N1,N2,len(mesh)), self.dtype )
        tail= d.pop('tail') if 'tail' in d else TailGf(shape = (N1,N2), size=10,  order_min=-1)
        symmetry = d.pop('symmetry',None)
        name =  d.pop('name','g')
        assert len(d) ==0, "Unknown parameters in GFBloc constructions %s"%d.keys() 
        
        GfImTime_cython.__init__(self, mesh, data, tail, symmetry, (indicesL,indicesR), name)
Ejemplo n.º 10
0
def init( mesh = None, shape = None, name = 'g', **kwargs):
    """
    """
    if mesh is None:
        from gf import MeshReTime
        window = kwargs.pop('window')
        t_min = window[0]
        t_max = window[1]
        n_max = kwargs.pop('n_points',10000)
        mesh = MeshReTime(t_min, t_max, n_max)

    indices_pack = get_indices_in_dict(kwargs)
    if not shape: 
      assert indices_pack, "No shape, no indices !"
      indicesL, indicesR = indices_pack
      shape = len(indicesL),len(indicesR)
    if kwargs: raise ValueError, "GfReFreq: Unused parameters %s were passed."%kwargs.keys()
 
    #data = kwargs.pop('data') if 'data' in kwargs else numpy.zeros((len(mesh),N1,N2), self.dtype )
    #tail = kwargs.pop('tail') if 'tail' in kwargs else TailGf(shape = (N1,N2))
    #symmetry = kwargs.pop('symmetry', Nothing())

    return (mesh, shape, indices_pack, name), {}