Пример #1
0
    def test_atomic_pair_maks_O_self_overlap(self):
        from SCFInitialGuess.construction.utilities import make_atom_pair_mask

        # test hydrogen
        expected = np.zeros((7, 7))
        expected[0:5, 0:5] = 1
        expected = expected.astype("bool")

        actual = make_atom_pair_mask(self.mol, 0, 0)

        np.testing.assert_allclose(actual, expected)
Пример #2
0
    def _assert_results_ok(self, G, T, pair):
        """pair marks the expected regions. With descritor and target matrix mock
        the expected results are clear."""
        from SCFInitialGuess.construction.utilities import \
            make_atom_pair_mask

        # check symmetry vector G
        self.assertListEqual(G, self._make_expected_symmetry_vector(pair))

        # check matrix
        for (p, t) in zip(pair, T):
            if isinstance(p, int):
                mask = make_atom_pair_mask(self.mol, p, p)

                np.testing.assert_equal(
                    extract_triu(self.T.copy()[mask],
                                 N_BASIS[self.mol.basis][self.mol.species[p]]),
                    t)
            else:

                # exptract block from LOWER triu (thus min/max)
                mask = make_atom_pair_mask(self.mol, np.max(p), np.min(p))
                np.testing.assert_equal(self.T[mask], t)
Пример #3
0
def make_target_matrix_mock(mol):
    """This function creates a matrix of strings that can be used to 
    debug matrix block extractions. Its values e.g. for element (i,j) are 
    <spies_i><i>-<species_j><j>.
    """
    from SCFInitialGuess.construction.utilities import make_atom_pair_mask

    dim = mol.dim

    T = np.zeros((dim, dim), dtype="object")

    for i, atom_i in enumerate(mol.species):
        for j, atom_j in enumerate(mol.species):
            mask = make_atom_pair_mask(mol, i, j)

            m = atom_i + str(i) + "-" + atom_j + str(j)

            if N_BASIS[mol.basis][atom_i] * N_BASIS[mol.basis][atom_j]:
                T[mask] = m
            else:
                T[mask] = np.array([[m] * N_BASIS[mol.basis][atom_j]] *
                                   N_BASIS[mol.basis][atom_i],
                                   dtype="object")
    return T