-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved files to adhere to addons infrastructure
- Loading branch information
m-baumgarten
committed
Mar 5, 2024
1 parent
2ef4fb8
commit f0a10a6
Showing
14 changed files
with
77 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import numpy as np | ||
|
||
from ipie.addons.ephqmc.hamiltonians.holstein import HolsteinModel | ||
from ipie.addons.ephqmc.trial_wavefunction.eph_trial_base import EphTrialWavefunctionBase | ||
from ipie.addons.ephqmc.walkers.eph_walkers import EphWalkers | ||
from ipie.systems.generic import Generic | ||
from ipie.utils.backend import arraylib as xp | ||
|
||
|
||
def local_energy_holstein( | ||
system: Generic, | ||
hamiltonian: HolsteinModel, | ||
walkers: EphWalkers, | ||
trial: EphTrialWavefunctionBase | ||
): | ||
"""Computes the local energy for the Holstein model.""" | ||
# energy = xp.zeros((walkers.nwalkers, 5), dtype=xp.complex128) | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
# gf = trial.calc_greens_function(walkers) | ||
|
||
# energy[:, 1] = np.sum(hamiltonian.T[0] * gf[0], axis=(1,2)) | ||
# if system.ndown > 0: | ||
# energy[:, 1] += np.sum(hamiltonian.T[1] * gf[1], axis=(1,2)) | ||
|
||
# energy[:, 2] = np.sum(np.diagonal(gf[0], axis1=1, axis2=2) * walkers.x, axis=1) | ||
# if system.ndown > 0: | ||
# energy[:, 2] += np.sum(np.diagonal(gf[1], axis1=1, axis2=2) * walkers.x, axis=1) | ||
# energy[:, 2] *= hamiltonian.const | ||
|
||
# energy[:, 3] = 0.5 * hamiltonian.m * hamiltonian.w0**2 * np.sum(walkers.x**2, axis=1) | ||
# energy[:, 3] -= 0.5 * hamiltonian.nsites * hamiltonian.w0 | ||
# energy[:, 4] = -0.5 * trial.calc_phonon_laplacian_locenergy(walkers) / hamiltonian.m | ||
|
||
# energy[:, 0] = np.sum(energy[:,1:], axis=1) | ||
## | ||
energy = xp.zeros((walkers.nwalkers, 5), dtype=xp.complex128) | ||
|
||
#get greens_function from estimators | ||
gf = trial.calc_greens_function(walkers) | ||
|
||
#TODO make this nicer | ||
for n in range(walkers.nwalkers): | ||
energy[n, 1] = np.einsum('ij->', hamiltonian.T[0] * gf[0][n] + hamiltonian.T[1] * gf[1][n]) | ||
|
||
#TODO this performs too many summations | ||
energy[:, 2] = hamiltonian.const * np.einsum('nii,ni->n', gf[0] + gf[1], walkers.x) | ||
|
||
energy[:, 3] = 0.5 * hamiltonian.m * hamiltonian.w0**2 * np.einsum('ni->n', walkers.x**2) | ||
energy[:, 3] -= 0.5 * hamiltonian.nsites * hamiltonian.w0 | ||
energy[:, 4] = -0.5 * trial.calc_phonon_laplacian_locenergy(walkers) / hamiltonian.m | ||
energy[:, 0] = np.sum(energy[:,1:], axis=1) | ||
|
||
return energy | ||
|
||
|
||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
...l_wavefunction/holstein/coherent_state.py → ...hqmc/trial_wavefunction/coherent_state.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...l_wavefunction/holstein/eph_trial_base.py → ...hqmc/trial_wavefunction/eph_trial_base.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...stein/variational/toyozawa_variational.py → ...ction/variational/toyozawa_variational.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from ipie.hamiltonians.generic import GenericRealChol, GenericComplexChol | ||
from ipie.hamiltonians.elph.holstein import HolsteinModel | ||
from ipie.propagation.phaseless_generic import PhaselessGeneric | ||
from ipie.propagation.holstein import HolsteinPropagatorImportance | ||
from ipie.addons.ephqmc.propagation.holstein import HolsteinPropagatorImportance | ||
from ipie.addons.ephqmc.hamiltonians.holstein import HolsteinModel | ||
|
||
Propagator = {GenericRealChol: PhaselessGeneric, GenericComplexChol: PhaselessGeneric, HolsteinModel: HolsteinPropagatorImportance} |
What are these commented out codes? Couldn't you use xp.?