|
| 1 | +# GBCI, GBPDFT, and XMS-GBPDFT |
| 2 | + |
| 3 | +This directory contains GBCI, GBPDFT, and multi-state (XMS) GBPDFT tools. |
| 4 | + |
| 5 | +GBCI is the renamed and reorganized form of the previous SFNOCI module. The |
| 6 | +new name reflects that the implementation is no longer limited to the old |
| 7 | +spin-flip NOCI interface and now serves as the grouped-bath CI reference used by |
| 8 | +GBPDFT and XMS-GBPDFT. |
| 9 | + |
| 10 | +## Dependencies |
| 11 | + |
| 12 | +GBPDFT uses the compiled GBCI helper library for fast on-top pair-density |
| 13 | +contractions. Build the PySCF-forge C extensions before running GBPDFT. |
| 14 | + |
| 15 | +## Modules |
| 16 | + |
| 17 | +Main GBCI modules: |
| 18 | + |
| 19 | +- `pyscf.gbci.gbci` |
| 20 | +- `pyscf.gbci.direct_gbci` |
| 21 | +- `pyscf.gbci.rdm` |
| 22 | +- `pyscf.gbci.fasscf` |
| 23 | + |
| 24 | +GBPDFT modules: |
| 25 | + |
| 26 | +- `pyscf.gbci.gbpdft` |
| 27 | +- `pyscf.gbci.otpd` |
| 28 | +- `pyscf.gbci.msgbpdft` |
| 29 | +- `pyscf.gbci.xmsgbpdft` |
| 30 | + |
| 31 | +## Import Changes |
| 32 | + |
| 33 | +Use GBCI and GBPDFT through `pyscf.gbci`: |
| 34 | + |
| 35 | +```python |
| 36 | +from pyscf import gbci |
| 37 | +from pyscf.gbci import gbpdft |
| 38 | +from pyscf.gbci import otpd |
| 39 | +``` |
| 40 | + |
| 41 | +Do not use the old SFNOCI or separate-package imports: |
| 42 | + |
| 43 | +```python |
| 44 | +from pyscf import sfnoci |
| 45 | +from pyscf.sfnoci import sfnoci |
| 46 | +``` |
| 47 | + |
| 48 | +## GBCI Usage |
| 49 | + |
| 50 | +```python |
| 51 | +from pyscf import gto, scf, gbci |
| 52 | + |
| 53 | +mol = gto.M( |
| 54 | + atom="Li 0 0 0; H 0 0 1.6", |
| 55 | + basis="sto-3g", |
| 56 | + spin=0, |
| 57 | + verbose=0, |
| 58 | +) |
| 59 | + |
| 60 | +mf = scf.ROHF(mol).run() |
| 61 | + |
| 62 | +mc = gbci.gbci(mf, ncas=2, nelecas=(1, 1)) |
| 63 | +mc.fcisolver.nroots = 1 |
| 64 | + |
| 65 | +e_gbci, e_cas, ci = mc.kernel() |
| 66 | + |
| 67 | +print("GBCI energy:", e_gbci) |
| 68 | +``` |
| 69 | + |
| 70 | +`group_a` can be used to build grouped baths by active MO index, atom index, or |
| 71 | +occupation-pattern index: |
| 72 | + |
| 73 | +```python |
| 74 | +gbci.gbci(mf, 2, (1, 1), group_a={"mo": [[0], [1]]}) |
| 75 | +gbci.gbci(mf, 2, (1, 1), group_a={"atom": [[0], [1]]}) |
| 76 | +gbci.gbci(mf, 2, (1, 1), group_a={"occ": [[0], [1], [2]]}) |
| 77 | +``` |
| 78 | + |
| 79 | +## GBPDFT Usage |
| 80 | + |
| 81 | +Import the GBPDFT module from `pyscf.gbci`: |
| 82 | + |
| 83 | +```python |
| 84 | +from pyscf.gbci import gbpdft |
| 85 | +``` |
| 86 | + |
| 87 | +### Build GBPDFT directly from an SCF object |
| 88 | + |
| 89 | +```python |
| 90 | +from pyscf import gto, scf |
| 91 | +from pyscf.gbci import gbpdft |
| 92 | + |
| 93 | +mol = gto.M( |
| 94 | + atom="Li 0 0 0; H 0 0 1.6", |
| 95 | + basis="sto-3g", |
| 96 | + spin=0, |
| 97 | + verbose=0, |
| 98 | +) |
| 99 | + |
| 100 | +mf = scf.ROHF(mol).run() |
| 101 | + |
| 102 | +pdft = gbpdft.GBCI( |
| 103 | + mf, |
| 104 | + "tPBE", |
| 105 | + ncas=2, |
| 106 | + nelecas=(1, 1), |
| 107 | +) |
| 108 | + |
| 109 | +pdft.fcisolver.nroots = 1 |
| 110 | + |
| 111 | +e_tot, e_ot, e_gbci, e_cas, ci, mo_coeff, mo_energy = pdft.kernel() |
| 112 | + |
| 113 | +print("GBPDFT total energy:", e_tot) |
| 114 | +print("on-top energy:", e_ot) |
| 115 | +print("GBCI energy:", e_gbci) |
| 116 | +``` |
| 117 | + |
| 118 | +### Build GBPDFT from an existing GBCI object |
| 119 | + |
| 120 | +```python |
| 121 | +from pyscf import gto, scf, gbci |
| 122 | +from pyscf.gbci import gbpdft |
| 123 | + |
| 124 | +mol = gto.M( |
| 125 | + atom="Li 0 0 0; H 0 0 1.6", |
| 126 | + basis="sto-3g", |
| 127 | + spin=0, |
| 128 | + verbose=0, |
| 129 | +) |
| 130 | + |
| 131 | +mf = scf.ROHF(mol).run() |
| 132 | + |
| 133 | +mc = gbci.gbci(mf, ncas=2, nelecas=(1, 1)) |
| 134 | +mc.fcisolver.nroots = 1 |
| 135 | + |
| 136 | +pdft = gbpdft.gbci(mc, "tPBE") |
| 137 | + |
| 138 | +e_tot, e_ot, e_gbci, e_cas, ci, mo_coeff, mo_energy = pdft.kernel() |
| 139 | + |
| 140 | +print("GBPDFT total energy:", e_tot) |
| 141 | +``` |
| 142 | + |
| 143 | +## XMS-GBPDFT Usage |
| 144 | + |
| 145 | +XMS-GBPDFT is built from a GBPDFT object with `multi_state`: |
| 146 | + |
| 147 | +```python |
| 148 | +import numpy as np |
| 149 | +from pyscf import gto, scf |
| 150 | +from pyscf.gbci import gbpdft |
| 151 | + |
| 152 | +mol = gto.M( |
| 153 | + atom="Li 0 0 0; H 0 0 1.6", |
| 154 | + basis="sto-3g", |
| 155 | + spin=0, |
| 156 | + verbose=0, |
| 157 | +) |
| 158 | + |
| 159 | +mf = scf.ROHF(mol).run() |
| 160 | + |
| 161 | +pdft = gbpdft.GBCI( |
| 162 | + mf, |
| 163 | + "tPBE", |
| 164 | + ncas=2, |
| 165 | + nelecas=(1, 1), |
| 166 | + group_a={"mo": [[0], [1]]}, |
| 167 | +) |
| 168 | +pdft.fcisolver.nroots = 2 |
| 169 | + |
| 170 | +xms = pdft.multi_state(np.ones(2) / 2, "xms") |
| 171 | +e_tot, e_ot, e_gbci, e_cas, ci, mo_coeff, mo_energy = xms.kernel() |
| 172 | + |
| 173 | +print("XMS-GBPDFT average energy:", e_tot) |
| 174 | +print("XMS-GBPDFT state energies:", xms.e_states) |
| 175 | +print("XMS-GBPDFT GBCI reference energies:", e_gbci) |
| 176 | +print("XMS-GBPDFT effective Hamiltonian:", xms.get_heff_pdft()) |
| 177 | +``` |
| 178 | + |
| 179 | +## Examples |
| 180 | + |
| 181 | +Example input files are available in: |
| 182 | + |
| 183 | +```text |
| 184 | +examples/gbci/ |
| 185 | +``` |
| 186 | + |
| 187 | +For example: |
| 188 | + |
| 189 | +```bash |
| 190 | +python examples/gbci/00-gbci.py |
| 191 | +python examples/gbci/01-gbpdft.py |
| 192 | +python examples/gbci/02-xmsgbpdft.py |
| 193 | +``` |
0 commit comments