Grouping Functions
qf_ferm_op_group_terms_by_electronic_structure
QfExitCode qf_ferm_op_group_terms_by_electronic_structure(QfFermionOperator *op, uint32_t num_modes, bool two_body_physicist_order)
Groups the terms of an operator by their electronic structure.
This function automatically populates the groups attribute (see also qf_ferm_op_get_groups()) of the provided QfFermionOperator such that terms satisfying a symmetric perturbation present in electronic-structure Hamiltonians are grouped.
The provided operator must be normal-ordered! This is an underlying assumption of the implementation that is not being verified! See qf_ferm_op_normal_ordered() for how to get an operator of that form.
More concretely, given an electronic-structure Hamiltonian of the form
this function will group 1-body terms with permutational symmetry of (i, j) as well as the 2-body terms with permutational symmetry of (i, j, k, l). For the 2-body terms, not all permutations will be grouped. Instead, the two_body_physicist_order determines how the four indices get grouped into pairs of two within which permutational symmetries exist:
two_body_physicist_order=False(default):(i, l)and(j, k)two_body_physicist_order=True:(i, k)and(j, l)
1QfFCIDump *fcidump = qf_fcidump_from_file("molecule.fcidump");
2QfFermionOperator *op = qf_ferm_op_from_fcidump(fcidump);
3
4uint32_t num_modes = 2 * qf_fcidump_norb(fcidump);
5
6QfFermionOperator *normal = qf_ferm_op_normal_ordered(op, NULL);
7
8QfExitCode exit = qf_ferm_op_group_terms_by_electronic_structure(normal, num_modes, false);Parameters
- op – A pointer to the normal-ordered fermionic operator whose terms are to be grouped.
- num_modes – The number of fermionic modes in the operator.
- two_body_physicist_order – whether the 2-body terms are stored in physicists order.
Returns
An exit code.
QfExitCode_Successupon successQfExitCode_ValueErrorif an invalid term is encountered during the grouping.