From 175bc4ab297e41e6f16dfbae6c6f380864d5ad40 Mon Sep 17 00:00:00 2001 From: "J. S. Kottmann" Date: Fri, 5 Apr 2024 00:26:59 +0200 Subject: [PATCH] keep basis info when re-initializing with mol.from_tequila --- src/tequila/quantumchemistry/chemistry_tools.py | 2 ++ src/tequila/quantumchemistry/qc_base.py | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tequila/quantumchemistry/chemistry_tools.py b/src/tequila/quantumchemistry/chemistry_tools.py index 00a65738..8cebef81 100644 --- a/src/tequila/quantumchemistry/chemistry_tools.py +++ b/src/tequila/quantumchemistry/chemistry_tools.py @@ -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) diff --git a/src/tequila/quantumchemistry/qc_base.py b/src/tequila/quantumchemistry/qc_base.py index ff449e76..de0f370a 100644 --- a/src/tequila/quantumchemistry/qc_base.py +++ b/src/tequila/quantumchemistry/qc_base.py @@ -108,7 +108,7 @@ 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 @@ -116,17 +116,15 @@ def from_tequila(cls, molecule, transformation=None, basis_name=None, *args, **k 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):