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

Electron-phonon extension #294

Open
wants to merge 73 commits into
base: develop
Choose a base branch
from

Conversation

m-baumgarten
Copy link

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

@fdmalone
Copy link
Collaborator

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

@fdmalone
Copy link
Collaborator

For example:

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

@linusjoonho
Copy link
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
Collaborator

Where did the example go?

@fdmalone
Copy link
Collaborator

@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
Collaborator

@m-baumgarten can you resolve the conflict.

@linusjoonho
Copy link
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
Author

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

@linusjoonho
Copy link
Collaborator

@m-baumgarten Could you fix the failing tests?

Copy link
Collaborator

@linusjoonho linusjoonho left a comment

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.


Propagator = {GenericRealChol: PhaselessGeneric, GenericComplexChol: PhaselessGeneric}
Propagator = {GenericRealChol: PhaselessGeneric, GenericComplexChol: PhaselessGeneric, HolsteinModel: HolsteinPropagatorImportance}
Copy link
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?


@plum.dispatch
Copy link
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?

@@ -108,7 +108,7 @@ def local_energy_noci(
walkers : WalkerBatch
Walkers object.
trial : trial object
Trial wavefunctioni.
Trial wavefunction.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great catch!

# 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
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.

# 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
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
Collaborator

Choose a reason for hiding this comment

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

delete

Copy link
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
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
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
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
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