Skip to content

Commit

Permalink
keep basis info when re-initializing with mol.from_tequila
Browse files Browse the repository at this point in the history
  • Loading branch information
kottmanj committed Apr 4, 2024
1 parent f6e41c0 commit 175bc4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/tequila/quantumchemistry/chemistry_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,9 @@ def get_integrals(self, orbital_coefficients=None, ordering="openfermion", ignor
active_integrals = get_active_space_integrals(one_body_integrals=h, two_body_integrals=g,
occupied_indices=self._active_space.frozen_reference_orbitals,
active_indices=self._active_space.active_orbitals)

c = active_integrals[0] + c

h = active_integrals[1]
g = NBodyTensor(elems=active_integrals[2], ordering="openfermion")
g.reorder(to=ordering)
Expand Down
8 changes: 3 additions & 5 deletions src/tequila/quantumchemistry/qc_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,25 +108,23 @@ def __init__(self, parameters: ParametersQC,


@classmethod
def from_tequila(cls, molecule, transformation=None, basis_name=None, *args, **kwargs):
def from_tequila(cls, molecule, transformation=None, *args, **kwargs):
c = molecule.integral_manager.constant_term
h1 = molecule.integral_manager.one_body_integrals
h2 = molecule.integral_manager.two_body_integrals
S = molecule.integral_manager.overlap_integrals
active_orbitals = [o.idx_total for o in molecule.integral_manager.active_orbitals]
if transformation is None:
transformation = molecule.transformation
if basis_name is None:
basis_name = molecule.integral_manager._orbital_type
parameters = molecule.parameters
parameters.basis_set = basis_name
return cls(nuclear_repulsion=c,
one_body_integrals=h1,
two_body_integrals=h2,
overlap_integrals = S,
orbital_coefficients = molecule.integral_manager.orbital_coefficients,
active_orbitals= active_orbitals,
n_electrons=molecule.n_electrons,
transformation=transformation,
orbital_type=molecule.integral_manager._orbital_type,
parameters=parameters, *args, **kwargs)

def supports_ucc(self):
Expand Down

0 comments on commit 175bc4a

Please sign in to comment.