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

adc-connect / adcc / 21177357553

20 Jan 2026 03:33PM UTC coverage: 74.598% (+0.3%) from 74.293%
21177357553

Pull #200

github

web-flow
Merge 3c14af03c 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 %.

555 of 621 new or added lines in 22 files covered. (89.37%)

3 existing lines in 1 file now uncovered.

7787 of 10141 relevant lines covered (76.79%)

168782.13 hits per line

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

66.67
/adcc/TwoParticleDensity.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 .NParticleDensity import NParticleDensity
2✔
24
from .NParticleOperator import OperatorSymmetry
2✔
25

26

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

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

38
        symmetry : OperatorSymmetry, optional
39
        """
NEW
40
        super().__init__(spaces, n_particle_op=2, symmetry=symmetry)
×
41

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

51
    def _transform_to_ao(self, refstate_or_coefficients):
2✔
52
        """
53
        MO -> AO transformation of antisymmetrized densities/integrals is
54
        not implemented, because information about spin blocks is irreversibly lost
55
        after antisymmetrization. Example: Product Trace of a TwoParticleDensity
56
        with an ERI:
57
        aaaa block: + Gamma^pq_rs <pq||rs>
58
        bbbb block: + Gamma^pq_rs <pq||rs>
59
        abab block: + Gamma^pq_rs <pq|rs>
60
        abba block: - Gamma^pq_rs <pq|sr>
61
        """
NEW
62
        raise NotImplementedError(
×
63
            "MO -> AO transformation of antisymmetrized densities/integrals is "
64
            "not implemented, because information about spin blocks is "
65
            "irreversibly lost after antisymmetrization."
66
        )
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