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

adc-connect / adcc / 16384966787

03 Jul 2025 11:29AM UTC coverage: 73.883% (+0.3%) from 73.602%
16384966787

push

github

web-flow
Restructure ExcitedStates etc for IP/EA Integration (#195)

* allow timer customization in cached_member_function

* add option to exclude the args in the timer task

* timer description if nothing was recorded

* basic restructuring of ElectronicTransition, ExcitedStates and State2States

* basic restructuring of Excitation

* add _module member variable to dispatch to the corresponding working equations

* basic restructuring for excited state properties

* enable excitation for s2s

* port dataframe export

* add state_dm

* port the remaining properties - tests passing

* * cache the MO integrals instead of the AO integrals
* remove unnecessary property decorated returns of callbacks
* implement available integrals directly in the backends

* raise Exception directly in the backends for PE and PCM

* add to_qcvars back in

* split plot_spectrum in common function on base class and adc type dependent function on child classes

* invert order of unit conversion and broadening for plot_spectrum

* add input options for lower and upper bounds of the broadened spectrum

* remove broadening min/max and allow variable width_units

* refactor the ExcitedStates.describe method

* determine the column width automatically

* move describe_amplitudes to ElectronicStates and adapt for IP/EA

* store operators in tuple on IsrMatrix

* make flake happy and remove the cache for now since it is not used anyway

* reintroduce the cache for available backends and cache them lazily

* explicitly install setupstools

* enable libtensorlight download for macos arm64

* naively update CI to macos-latest

* install llvm and use arm64 compilers

* explicitly only build for the current platform

* only set architecture for macos

* generic block_orders for secular and isr matrix

* move init complete back to secular and isr matrix

* raise more explicit exception for not implemented methods

* patch coverage not required for status check

* add token for github api request... (continued)

1176 of 1884 branches covered (62.42%)

Branch coverage included in aggregate %.

700 of 965 new or added lines in 21 files covered. (72.54%)

6 existing lines in 6 files now uncovered.

7376 of 9691 relevant lines covered (76.11%)

175662.79 hits per line

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

89.74
/adcc/StateView.py
1
import numpy as np
2✔
2

3
from .AmplitudeVector import AmplitudeVector
2✔
4
from .OneParticleOperator import OneParticleOperator
2✔
5

6

7
class StateView:
2✔
8
    def __init__(self, parent_state, index: int):
2✔
9
        """
10
        Construct an StateView instance from an :class:`adcc.ElectronicStates`
11
        parent object.
12

13
        The class provides access to the properties of a single state.
14

15
        Parameters
16
        ----------
17
        parent_state
18
            :class:`adcc.ElectronicState` object from which the StateView
19
            is derived
20
        index : int
21
            Index of the state the constructed :class:`adcc.StateView`
22
            should refer to (0-based)
23
        """
24
        from .ElectronicStates import ElectronicStates
2✔
25
        # valid range for index: -n_states <= index < +n_states
26
        if index >= parent_state.size or \
2!
27
                (index < 0 and abs(index) > parent_state.size):
NEW
28
            raise ValueError(f"index {index} is out of range for a parent state "
×
29
                             f"with {parent_state.size} states.")
30
        self._parent_state: ElectronicStates = parent_state
2✔
31
        self.index: int = index
2✔
32

33
    @property
2✔
34
    def parent_state(self):
2✔
NEW
35
        return self._parent_state
×
36

37
    @property
2✔
38
    def excitation_energy(self):
2✔
39
        """Excitation energy including all corrections in atomic units"""
40
        return self._parent_state.excitation_energy[self.index]
2✔
41

42
    @property
2✔
43
    def excitation_energy_uncorrected(self):
2✔
44
        """Excitation energy without any corrections in atomic units"""
45
        return self._parent_state._excitation_energy_uncorrected[self.index]
2✔
46

47
    @property
2✔
48
    def excitation_vector(self) -> AmplitudeVector:
2✔
49
        """The excitation vector"""
50
        return self._parent_state._excitation_vector[self.index]
2✔
51

52
    @property
2✔
53
    def state_diffdm(self) -> OneParticleOperator:
2✔
54
        """The difference density matrix"""
55
        return self._parent_state._state_diffdm(self.index)
2✔
56

57
    @property
2✔
58
    def state_diffdm_ao(self) -> OneParticleOperator:
2✔
59
        """The difference density matrix in the AO basis"""
60
        return sum(self.state_diffdm.to_ao_basis())
2✔
61

62
    @property
2✔
63
    def state_dm(self) -> OneParticleOperator:
2✔
64
        """The state density matrix"""
65
        return self._parent_state._state_dm(self.index)
2✔
66

67
    @property
2✔
68
    def state_dm_ao(self) -> OneParticleOperator:
2✔
69
        """The state density matrix in the AO basis"""
NEW
70
        return sum(self.state_dm.to_ao_basis())
×
71

72
    @property
2✔
73
    def state_dipole_moment(self) -> np.ndarray:
2✔
74
        """Array of state dipole moments"""
75
        return self._parent_state._state_dipole_moment(self.index)
2✔
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

© 2025 Coveralls, Inc