Пример #1
0
def read_ipeps_c4v(jsonfile, aux_seq=[0,1,2,3], peps_args=cfg.peps_args,\
    global_args=cfg.global_args):
    r"""
    :param jsonfile: input file describing IPEPS_C4V in json format
    :param aux_seq: array specifying order of auxiliary indices of on-site tensors stored
                    in `jsonfile`
    :param peps_args: ipeps configuration
    :param global_args: global configuration
    :type jsonfile: str or Path object
    :type aux_seq: list[int]
    :type peps_args: PEPSARGS
    :type global_args: GLOBALARGS
    :return: wavefunction
    :rtype: IPEPS_C4V
    
    Parameter ``aux_seq`` defines the expected order of auxiliary indices
    in input file relative to the convention fixed in tn-torch::
    
         0
        1A3 <=> [up, left, down, right]: aux_seq=[0,1,2,3]
         2
        
        for alternative order, eg.
        
         1
        0A2 <=> [left, up, right, down]: aux_seq=[1,0,3,2] 
         3
    """
    state= ipeps.read_ipeps(jsonfile, aux_seq=aux_seq, peps_args=peps_args,\
        global_args=global_args)
    assert len(state.sites.items()
               ) == 1, "state has more than a single on-site tensor"
    return IPEPS_C4V(next(iter(state.sites.values())))
Пример #2
0
def read_ipeps_d2(jsonfile, aux_seq=[0,1,2,3], peps_args=cfg.peps_args,\
    global_args=cfg.global_args):
    state= ipeps.read_ipeps(jsonfile, aux_seq=aux_seq, peps_args=peps_args,\
        global_args=global_args)
    # assume two-site ipeps state and take site at (0,0) as the parent_site 
    assert len(state.sites.items())==2 and state.lX==1 and state.lY==2, \
        "Not a valid IPEPS_D2SYM"
    return IPEPS_D2SYM(state.site((0,0)),peps_args=peps_args,global_args=global_args)
Пример #3
0
def build_B_tensor(coef_list):
    """Build the .json file associated with the B tensor from the Ta2 .json files.
    """
    B_tensor = torch.zeros([4, 4, 4, 4, 4], dtype=torch.float64)
    for i in range(len(coef_list)):
        tensor_Tb = ipeps.read_ipeps(path + f"input-states/tensor_Tb{i}.json")
        B_tensor += coef_list[i] * tensor_Tb.site(coord=(0, 0))
    ipeps.write_ipeps(ipeps.IPEPS({(0, 0): B_tensor}),
                      path + "input-states/B_tensor.json")
    return B_tensor