コード例 #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), {}
コード例 #2
0
def init(mesh=None, shape=None, name='g', **kwargs):
    """
    python adaptor for the construction of a gf<imfreq>
    args: {mesh, indices} or {beta,[n_points], [statistic], indices} 
    """
    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')
        mesh = MeshImFreq(beta, stat, n_points)

    indices_pack = get_indices_in_dict(kwargs)
    if not shape:
        assert indices_pack, "No shape, no indices !"
        indices = indices_pack
        shape = [len(x) for x in indices]
    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), {}
コード例 #3
0
def init(mesh=None, shape=None, name='g', **kwargs):
    """
    """
    if mesh is None:
        from gf import MeshReFreq
        window = kwargs.pop('window')
        omega_min = window[0]
        omega_max = window[1]
        n_max = kwargs.pop('n_points', 10000)
        mesh = MeshReFreq(omega_min, omega_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), {}
コード例 #4
0
ファイル: _gf_imfreq.py プロジェクト: Titan-C/triqs
def init( mesh=None, shape=None, name='g', **kwargs):
    """
    python adaptor for the construction of a gf<imfreq>
    args: {mesh, indices} or {beta,[n_points], [statistic], indices} 
    """
    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')
        mesh = MeshImFreq(beta,stat,n_points)
    
    indices_pack = get_indices_in_dict(kwargs)
    if not shape: 
      assert indices_pack, "No shape, no indices !"
      indices = indices_pack
      shape = [len(x) for x in indices]
    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), {}
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), {}
コード例 #6
0
ファイル: _gf_refreq.py プロジェクト: JaksaVucicevic/triqs
def init(mesh=None, shape=None, name="g", **kwargs):
    """
    """
    if mesh is None:
        from gf import MeshReFreq

        window = kwargs.pop("window")
        omega_min = window[0]
        omega_max = window[1]
        n_max = kwargs.pop("n_points", 10000)
        mesh = MeshReFreq(omega_min, omega_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), {}
コード例 #7
0
ファイル: _gf_imfreq.py プロジェクト: krivenko/triqs
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), {}