• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

adc-connect / adcc / 21211666531

21 Jan 2026 01:38PM UTC coverage: 74.578% (+0.3%) from 74.293%
21211666531

Pull #200

github

web-flow
Merge cb6bc1db0 into 9ff4abd52
Pull Request #200: Generalize OneParticleOperator to NParticleOperator and separate operators from densities

1270 of 2000 branches covered (63.5%)

Branch coverage included in aggregate %.

552 of 621 new or added lines in 22 files covered. (88.89%)

2 existing lines in 1 file now uncovered.

7783 of 10139 relevant lines covered (76.76%)

169253.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/adcc/TwoParticleOperator.py
1
#!/usr/bin/env python3
2
## vi: tabstop=4 shiftwidth=4 softtabstop=4 expandtab
3
## ---------------------------------------------------------------------
4
##
5
## Copyright (C) 2026 by the adcc authors
6
##
7
## This file is part of adcc.
8
##
9
## adcc is free software: you can redistribute it and/or modify
10
## it under the terms of the GNU General Public License as published
11
## by the Free Software Foundation, either version 3 of the License, or
12
## (at your option) any later version.
13
##
14
## adcc is distributed in the hope that it will be useful,
15
## but WITHOUT ANY WARRANTY; without even the implied warranty of
16
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
## GNU General Public License for more details.
18
##
19
## You should have received a copy of the GNU General Public License
20
## along with adcc. If not, see <http://www.gnu.org/licenses/>.
21
##
22
## ---------------------------------------------------------------------
23
from .NParticleOperator import NParticleOperator, OperatorSymmetry
2✔
24

25

26
class TwoParticleOperator(NParticleOperator):
2✔
27
    def __init__(self, spaces, symmetry=OperatorSymmetry.HERMITIAN):
2✔
28
        """
29
        Construct a TwoParticleOperator object. All blocks are initialised
30
        as zero blocks.
31

32
        Parameters
33
        ----------
34
        spaces : adcc.MoSpaces or adcc.ReferenceState or adcc.LazyMp
35
            MoSpaces object
36

37
        symmetry : OperatorSymmetry, optional
38
        """
39
        super().__init__(spaces, n_particle_op=2, symmetry=symmetry)
2✔
40

41
    def _construct_empty(self):
2✔
42
        """
43
        Create an empty instance of a TwoParticleOperator
44
        """
NEW
45
        return self.__class__(
×
46
            self.mospaces,
47
            symmetry=self.symmetry,
48
        )
49

50
    def _transform_to_ao(self, refstate_or_coefficients):
2✔
51
        """
52
        MO -> AO transformation of antisymmetrized densities/integrals is
53
        not implemented, because information about spin blocks is irreversibly lost
54
        after antisymmetrization. Example: Product Trace of a TwoParticleDensity
55
        with an ERI:
56
        aaaa block: + Gamma^pq_rs <pq||rs>
57
        bbbb block: + Gamma^pq_rs <pq||rs>
58
        abab block: + Gamma^pq_rs <pq|rs>
59
        abba block: - Gamma^pq_rs <pq|sr>
60
        """
61
        raise NotImplementedError(
2✔
62
            "MO -> AO transformation of antisymmetrized densities/integrals is "
63
            "not implemented, because information about spin blocks is "
64
            "irreversibly lost after antisymmetrization."
65
        )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc