Tree Tensor Network Algorithms#

The Basis Tree#

class renormalizer.tn.TreeNodeBasis(basis_sets: Optional[Union[BasisSet, List[BasisSet]]] = None)[source]#
add_child(node: Union[TreeNode, Sequence[TreeNode]]) TreeNode#
add_children(node: Union[TreeNode, Sequence[TreeNode]]) TreeNode#
property ancestors: List#

Returns the list of ancestors of this node, including itself

property basis_set#
copy()[source]#
property idx_as_child: int#

Returns the index of this node as a child of its parent

property is_leaf: bool#
class renormalizer.tn.BasisTree(root: TreeNodeBasis)[source]#

Tree of basis sets. The tree nodes are TreeNodeBasis.

Parameters:

root (TreeNodeBasis) – The root of the tree

add_auxiliary_space(auxiliary_label='Q') BasisTree[source]#
property basis_list: List[BasisSet]#
property basis_list_postorder: List[BasisSet]#
classmethod binary(basis_list: List[BasisSet])[source]#

Generate a binary tree.

Parameters:

basis_list (list of BasisSet) – The basis set list.

Return type:

The constructed basis tree.

classmethod binary_mctdh(basis_list: List[BasisSet], contract_primitive=False, contract_label=None, dummy_label='MCTDH virtual')[source]#

Construct binary MCTDH tree.

See also

general_mctdh

construct MCTDH tree with any order.

property dof_list: List[Any]#
static find_path(node1: Union[TreeNodeTensor, TreeNodeBasis, TreeNodeEnviron], node2: Union[TreeNodeTensor, TreeNodeBasis, TreeNodeEnviron]) List[Union[TreeNodeTensor, TreeNodeBasis, TreeNodeEnviron]]#

Find the path from node1 to node2. Not most efficient but simple to implement

classmethod general_mctdh(basis_list: List[BasisSet], tree_order: int, contract_primitive: bool = False, contract_label: Optional[Sequence[bool]] = None, dummy_label='MCTDH virtual')[source]#

MCTDH tree with the specified tree order. The feature of this type of tree is that all physical degrees of freedom are attached to the leaf nodes. Also, each leaf node typically has more than one physical degrees of freedom.

Parameters:
  • basis_list (list of BasisSet) – The list of basis sets for the system.

  • tree_order (int) – Tree order. For example, 2 means binary tree and 3 means ternary tree.

  • contract_primitive (bool) –

    Whether contract the primitive basis. Defaults to False. If set to True, each primitive basis in basis_list will be contracted before attached to the tree. The following is a schematic view, where o represents a node and d means the physical bond.

    # contract primitive
           o
          / \
          o  o
     d -> |  | <- d
    

    If set to False, the following type of tree will be constructed.

    # not contract primitive
           o
    d ->  / \ <- d
    d means physical bond
    

  • contract_label (list of bool) – If contract_primitive is set to True, this list determines which primitive basis should be contracted.

  • dummy_label – The label for the virtual nodes in MCTDH.

Return type:

The constructed basis tree.

See also

binary_mctdh

construct binary MCTDH tree (tree order is set to 2).

ternary_mctdh

construct ternary MCTDH tree (tree order is set to 3).

classmethod linear(basis_list: List[BasisSet])[source]#

Generate a linear tree, i.e, MPS.

Parameters:

basis_list (list of BasisSet) – The basis set list.

Return type:

The constructed basis tree.

property pbond_dims: List[List[int]]#
postorder_list() List[Union[TreeNodeTensor, TreeNodeBasis, TreeNodeEnviron]]#
preorder_list(func=None) List[Union[TreeNodeTensor, TreeNodeBasis, TreeNodeEnviron]]#
print(print_function=None)[source]#
property size#
classmethod t3ns(basis_list: List[BasisSet], t3ns_label='T3NS virtual')[source]#
classmethod ternary_mctdh(basis_list: List[BasisSet], contract_primitive=False, contract_label=None, dummy_label='MCTDH virtual')[source]#

Construct ternary MCTDH tree.

See also

general_mctdh

construct MCTDH tree with any order.