Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[local state-averaging] H1EZipFCISolver member functions #77

Open
MatthewRHermes opened this issue Mar 25, 2024 · 0 comments
Open

[local state-averaging] H1EZipFCISolver member functions #77

MatthewRHermes opened this issue Mar 25, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@MatthewRHermes
Copy link
Owner

To enable local state-averaging, the H1EZipFCISolver member functions must be further generalized. Currently, in the dev branch, the *_make_rdm* functions will do local state-averaging correctly thanks to this hacky function:

# This is a hack designed to, i.e., set
# self.fcisolvers[i].nroots = 1 for all i
# in the context of StateAverageMixFCISolver._loop_civecs, so that local state-averaging
# in the ith Hilbert space can be totally abstracted away from the HIEZipFCISolver,
# StateAverageNMixFCISolver layer
def _loop_civecs (self, *args, **kwargs):
_solver_args = self._solver_args
_state_args = self._state_args
for i, solver in enumerate (self.fcisolvers):
my_args = []
for arg in args:
if isinstance (arg, (_state_args, _solver_args)):
my_args.append (arg[i])
else:
my_args.append (arg)
my_kwargs = {}
for key, item in kwargs.items ():
if isinstance (arg, (_state_args, _solver_args)):
my_kwargs[key] = item[i]
else:
my_kwargs[key] = item
yield solver, my_args, my_kwargs

But kernel, approx_kernel, and the other states_ functions, which use _loop_solver rather than _loop_civecs, generally do not work with local state-averaging.

@MatthewRHermes MatthewRHermes added the enhancement New feature or request label Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant