Skip to content

Commit a126b96

Browse files
committed
refactor
1 parent f6c0df9 commit a126b96

4 files changed

Lines changed: 138 additions & 127 deletions

File tree

forte/options.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,14 @@ Driver:
143143
type: bool
144144
default: False
145145
help: "Save orbitals to file if true"
146+
WRITE_INTDUMP:
147+
type: bool
148+
default: False
149+
help: "Write the ForteIntegral object to INTDUMP file in FCIDUMP format"
150+
INTDUMP_NAME:
151+
type: str
152+
default: "INTDUMP"
153+
help: "The name of the INTDUMP file to write to. Used only if WRITE_INTDUMP is true."
146154

147155
AVAS:
148156
AVAS:

forte/proc/dsrg.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -179,43 +179,9 @@ def __init__(self, active_space_solver, state_weights_map, mo_space_info, ints,
179179
self.mo_space_info, self.ints, self.scf_info, inactive_mix, active_mix, semi_threshold
180180
)
181181

182-
def write_to_fcidump(self):
183-
"Writes integrals to FCIDUMP in PYSCF format"
184-
185-
if not os.path.exists('INTDUMP'):
186-
187-
mos = self.mo_space_info.corr_absolute_mo("CORRELATED")
188-
nmo = len(mos)
189-
a = self.ints.oei_a_block(mos,mos)
190-
ab = self.ints.tei_ab_block(mos,mos,mos,mos)
191-
tol = 1.0e-15
192-
fcidump_string = f"""&FCI NORB={nmo},NELEC={12},UHF=.FALSE.,ORBSYM={"1,"*(nmo)}MS2={0},ISYM=1
193-
&END
194-
"""
195-
print("...writing integrals to INTDUMP")
196-
#transform to chemist notation
197-
for i in range(nmo):
198-
for j in range(0, i+1):
199-
for k in range(0, nmo):
200-
for l in range(0, k+1):
201-
if abs(ab[i][k][j][l]) > tol:
202-
fcidump_string += f"{ab[i][k][j][l]:.20e} {i+1:4d}{j+1:4d}{k+1:4d}{l+1:4d}\n"
203-
for i in range(0, nmo):
204-
for j in range(0, i+1):
205-
if abs(a[i][j]) > tol:
206-
fcidump_string += f"{a[i][j]:.20e} {i+1:4d}{j+1:4d}{0:4d}{0:4d}\n"
207-
fcidump_string += f"{self.ints.nuclear_repulsion_energy() + self.ints.frozen_core_energy()} {0:4d}{0:4d}{0:4d}{0:4d}"
208-
209-
with open("INTDUMP", "w") as f:
210-
f.write(fcidump_string)
211-
212-
raise psi4.p4util.PsiException("Written integrals to INTDUMP")
213-
214182
def make_dsrg_solver(self):
215183
args = (self.rdms, self.scf_info, self.options, self.ints, self.mo_space_info)
216184

217-
self.write_to_fcidump()
218-
219185
if self.solver_type in ["MRDSRG", "DSRG-MRPT2", "DSRG-MRPT3", "THREE-DSRG-MRPT2"]:
220186
self.dsrg_solver = forte.make_dsrg_method(*args)
221187
self.dsrg_solver.set_state_weights_map(self.state_weights_map)

0 commit comments

Comments
 (0)