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

RimuQMC / Rimu.jl / 17467385451

04 Sep 2025 02:31PM UTC coverage: 94.042% (+0.1%) from 93.932%
17467385451

Pull #327

github

lch
Molecular Hamiltonian (#321)

Improve the docstring of `MolecularHamiltonian`
Pull Request #327: Molecular Hamiltonian

316 of 327 new or added lines in 3 files covered. (96.64%)

7576 of 8056 relevant lines covered (94.04%)

14581844.2 hits per line

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

88.89
/ext/ElemCoExt.jl
1
module ElemCoExt
2

3
import Rimu: MolecularHamiltonian, FermiFS, FermiFS2C, near_uniform, num_modes
4
import ElemCo.FciDumps: FDump, QFDump, read_fcidump, headvar, fd_exists
5

6
function MolecularHamiltonian(
26✔
7
    fd::QFDump;
8
    starting_address::Union{Nothing,FermiFS2C}=nothing,
9
    specifier::String="",
10
)
11
    if !fd_exists(fd)
13✔
NEW
12
        throw(ArgumentError("invalid input FCIDUMP file"))
×
13
    end
14
    n_orb = headvar(fd, "NORB", Int)
26✔
15
    n_elec = headvar(fd, "NELEC", Int)
26✔
16
    ms2 = headvar(fd, "MS2", Int)
26✔
17

18
    if isnothing(n_orb) || isnothing(n_elec) || isnothing(ms2)
39✔
NEW
19
        throw(
×
20
            ArgumentError(
21
                "input FCIDUMP file must have `NORB`, `NELEC`, and `MS2` defined in header"
22
            ),
23
        )
24
    end
25

26
    n_alpha_elec = (n_elec + ms2) ÷ 2
13✔
27
    n_beta_elec = (n_elec - ms2) ÷ 2
13✔
28

29
    if starting_address === nothing
13✔
30
        starting_address = FermiFS2C(
10✔
31
            near_uniform(FermiFS{n_alpha_elec,n_orb}),
32
            near_uniform(FermiFS{n_beta_elec,n_orb}),
33
        )
34
    end
35

36
    if num_modes(starting_address) != n_orb
13✔
37
        throw(
1✔
38
            ArgumentError(
39
                "starting_address must have the same number of orbital as the FCIDUMP."
40
            ),
41
        )
42
    end
43

44
    val_type = typeof(fd.int0)
12✔
45
    addr_type = typeof(starting_address)
12✔
46
    fd_type = typeof(fd)
12✔
47
    return MolecularHamiltonian{val_type,addr_type,fd_type}(specifier, starting_address, fd)
12✔
48
end
49

50
end
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