Skip to content

Electron-phonon extension#294

Open
m-baumgarten wants to merge 74 commits into
JoonhoLee-Group:developfrom
m-baumgarten:multiel_holstein
Open

Electron-phonon extension#294
m-baumgarten wants to merge 74 commits into
JoonhoLee-Group:developfrom
m-baumgarten:multiel_holstein

Conversation

@m-baumgarten

Copy link
Copy Markdown

What?

This pull request adds functionalities that allow running Diffusion MC for a 1D Holstein Chain based on [1] using an AFQMC object. Trials currently implemented include a simple coherent state trial as well as a Toyozawa ansatz.

Why?

Implements a convenient framework for continued method development for electron-phonon models.

How?

Major additions include the designated electron-phonon walker class EphWalkers, keeping track of bosonic overlaps and carrying phonon displacements.
Two propagators are added, HolsteinPropagatorFree and HolsteinPropagatorImportance, allowing for DMC propagation of bosonic degrees of freedom.
Additionally, in ipie/ipie/trial_wavefunction/holstein two trial wave functions are implemented, CoherentStateTrial and ToyozawaTrial.
To estimate the ground state energy one can use the regular EnergyEstimator.
Lastly, the Holstein Hamiltonian is implemented in ipie/ipie/hamiltonians/elph/holstein.py.

Testing Steps

Example code can be found in ipie/examples/13-1d_holstein. Some reference values to compare to can be found in [1].

References

[1] Joonho Lee, Shiwei Zhang, and David R. Reichman (2021) Phys. Rev. B 103, 115123

Comment thread ipie/addons/ephqmc/estimators/local_energy_holstein.py Outdated
Comment thread ipie/addons/ephqmc/estimators/local_energy_holstein.py Outdated
Comment thread ipie/addons/ephqmc/hamiltonians/generic.py Outdated
Comment thread ipie/addons/ephqmc/hamiltonians/holstein.py Outdated
Comment thread ipie/addons/ephqmc/hamiltonians/holstein.py Outdated
Comment thread ipie/addons/ephqmc/propagation/holstein.py Outdated
Comment thread ipie/addons/ephqmc/propagation/holstein.py Outdated
Comment thread ipie/addons/ephqmc/propagation/holstein.py Outdated
Comment thread ipie/addons/ephqmc/propagation/holstein.py Outdated
Comment thread ipie/addons/ephqmc/propagation/holstein.py Outdated
Comment thread ipie/addons/ephqmc/propagation/holstein.py Outdated
Comment thread ipie/addons/ephqmc/trial_wavefunction/coherent_state.py Outdated
Comment thread ipie/addons/ephqmc/trial_wavefunction/eph_trial_base.py Outdated
Comment thread ipie/addons/ephqmc/trial_wavefunction/eph_trial_base.py Outdated
Comment thread ipie/addons/ephqmc/trial_wavefunction/toyozawa.py Outdated
Comment thread ipie/addons/ephqmc/trial_wavefunction/toyozawa.py Outdated
Comment thread ipie/addons/ephqmc/trial_wavefunction/variational/coherent_state_variational.py Outdated
Comment thread ipie/addons/ephqmc/trial_wavefunction/variational/coherent_state_variational.py Outdated
Comment thread ipie/addons/ephqmc/trial_wavefunction/variational/coherent_state_variational.py Outdated
@fdmalone

Copy link
Copy Markdown
Contributor

Run the tests locally and make sure jax (and probably jaxlib) is added to requirements.txt

@fdmalone

Copy link
Copy Markdown
Contributor

For example:

 python dev/run_tests.py --flynt --black --pylint
 python dev/run_tests.py --examples

@linusjoonho

Copy link
Copy Markdown
Collaborator

Run the tests locally and make sure jax (and probably jaxlib) is added to requirements.txt

Should only require jax and jaxlib when one needs to use the electron-phonon module. It's also likely that we will get rid of jax dependence completely soon...

@fdmalone

Copy link
Copy Markdown
Contributor

Where did the example go?

@fdmalone

Copy link
Copy Markdown
Contributor

@m-baumgarten Could you guard any jax imports so that the tests run when jax is not installed? Add a skip to the unit tests so that the tests don't fail. Make an environment without jax and test it locally.

@fdmalone

Copy link
Copy Markdown
Contributor

@m-baumgarten can you resolve the conflict.

@linusjoonho

Copy link
Copy Markdown
Collaborator

@m-baumgarten will this feature be merged? If so, can you please resolve the conflicts and address any remaining comments?

@m-baumgarten

Copy link
Copy Markdown
Author

I think all comments should be addressed. Just changed the propagator file, should be ready to go now.

@linusjoonho

Copy link
Copy Markdown
Collaborator

@m-baumgarten Could you fix the failing tests?

@linusjoonho linusjoonho left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the comments for merge.

Comment thread ipie/propagation/propagator.py Outdated
from ipie.addons.ephqmc.hamiltonians.holstein import HolsteinModel

Propagator = {GenericRealChol: PhaselessGeneric, GenericComplexChol: PhaselessGeneric}
Propagator = {GenericRealChol: PhaselessGeneric, GenericComplexChol: PhaselessGeneric, HolsteinModel: HolsteinPropagatorImportance}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we want to modify the propagator class this way. Was there no other way?

Comment thread ipie/estimators/energy.py Outdated
from ipie.walkers.uhf_walkers import UHFWalkers
from ipie.addons.ephqmc.walkers.eph_walkers import EphWalkers

@plum.dispatch

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure why you had to make changes in ipie's native estimator class. Couldn't you write a customized estimator class?

Walkers object.
trial : trial object
Trial wavefunctioni.
Trial wavefunction.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch!

Comment thread ipie/addons/eph/__init__.py Outdated
# See the License for the specific language governing permissions and
# limitations under the License.

# Directory for additions to ipie which depend on the core ipie library.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete lines 15-17. we meant this to be an instruction for contributing to addons.

Comment thread ipie/addons/eph/estimators/__init__.py Outdated
# See the License for the specific language governing permissions and
# limitations under the License.

# Directory for additions to ipie which depend on the core ipie library.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

# See the License for the specific language governing permissions and
# limitations under the License.

# Directory for additions to ipie which depend on the core ipie library.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this be deleted?

# limitations under the License.

# pylint: disable=import-error
import jax.numpy as npj

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there JAX left?


# pylint: disable=import-error
import jax.numpy as npj
from jax.config import config

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there JAX left?

from ipie.addons.eph.trial_wavefunction.toyozawa import circ_perm

# pylint: disable=import-error
import jax

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there JAX left?

from ipie.addons.eph.trial_wavefunction.variational.estimators import gab

# pylint: disable=import-error
import jax

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there JAX left?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants