-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_wizard_example.py
More file actions
50 lines (46 loc) · 1.6 KB
/
config_wizard_example.py
File metadata and controls
50 lines (46 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from sanqctuary.config_wizard import (
FullCIGroup,
HoleConstraint,
ParticleConstraint,
format_orca_casscf_block,
generate_configurations,
)
# User-specified example:
# nel = 16, norb = 11, mult = 5
# core/hole group: orbitals 0-3 with exactly 1 hole (=> total occupancy 7)
# full CI group: orbitals 4-8 (no local constraints)
# fixed singly-occupied: orbitals 9 and 10 each with occupancy 1
hole_groups = [
HoleConstraint(orbitals=(0, 1, 2, 3), exact_holes=1),
]
particle_constraints = [
ParticleConstraint(orbitals=(9,), exact_particles=1),
ParticleConstraint(orbitals=(10,), exact_particles=1),
]
full_ci_groups = [
FullCIGroup(orbitals=(4, 5, 6, 7, 8)),
]
configs = generate_configurations(
nel=16,
norb=11,
mult=1,
hole_constraints=hole_groups,
particle_constraints=particle_constraints,
full_ci_groups=full_ci_groups,
)
total = len(configs)
print(f"Generated {total} configurations. ORCA block:\n")
block = format_orca_casscf_block(configs, nel=16, norb=11, mult=1)
print(block)
print(f"\nTotal configurations: {total}")
# Sanity: hole count distribution for the core group and fixed occupancy check for the last two orbitals.
core = hole_groups[0]
core_counts: dict[int, int] = {}
fixed_ok = 0
for cfg in configs:
holes = 2 * len(core.orbitals) - sum(cfg[i] for i in core.orbitals)
core_counts[holes] = core_counts.get(holes, 0) + 1
if cfg[9] == 1 and cfg[10] == 1:
fixed_ok += 1
print(f"Hole count distribution for core orbitals {core.orbitals}: {core_counts}")
print(f"Configs with orbitals 9 and 10 fixed to 1: {fixed_ok} (should equal total)")