def test_exceptions_two_particle(v_me, core, active, msg_match): """Test that the function `'two_particle'` throws an exception if the dimension of the matrix elements array is not a 4D array or if the indices of core and/or active orbitals are out of range.""" with pytest.raises(ValueError, match=msg_match): qchem.two_particle(v_me, core=core, active=active)
def test_table_two_particle(name, core, active, v_op_exp): r"""Test the FermionOperator built by the function `two_particle` of the `obs` module""" hf_data = MolecularData(filename=os.path.join(ref_dir, name)) v_op = qchem.two_particle(hf_data.two_body_integrals, core=core, active=active) assert v_op.terms == v_op_exp
def test_table_two_particle(name, core, active, table_exp, v_core_exp, tol): r"""Test the table of two-particle matrix elements and the contribution of core orbitals as implemented in the `two_particle` function of the `obs` module""" hf_data = MolecularData(filename=os.path.join(ref_dir, name)) table, v_core = qchem.two_particle(hf_data.two_body_integrals, core=core, active=active) assert np.allclose(table, table_exp, **tol) assert np.allclose(v_core, v_core_exp, **tol)