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 74 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
f7310b8
fixed typo
m-baumgarten Feb 9, 2024
4ffbe56
holstein with toyozawa trial, coherent state trial todo
m-baumgarten Feb 9, 2024
fa6f13b
working toyozawa implementation for 1 electron, 1D Holstein
m-baumgarten Feb 16, 2024
caf7a34
multi-electron implementation. toyozawa very dodgy
m-baumgarten Feb 23, 2024
e7507f7
Some einsum cleanup
Mar 3, 2024
bf49a31
added variationcal code to ipie and example run file
Mar 4, 2024
2ef4fb8
holstein propagator cleanup
Mar 4, 2024
f0a10a6
moved files to adhere to addons infrastructure
Mar 5, 2024
582a24e
changed folder name from ipie/addons/ephqmc to ipie/addons/eph
Mar 5, 2024
f9d70d5
Merge branch 'develop' into multiel_holstein
fdmalone Mar 5, 2024
69e1ef5
changed directory name finally
Mar 5, 2024
7925ba9
Merge branch 'multiel_holstein' of github.com:m-baumgarten/ipie_holst…
Mar 5, 2024
ccc2649
Cleanup of HolsteinModel class plus some explanation of the model.
Mar 5, 2024
ce14a30
added __init__ files in new directories
m-baumgarten Mar 5, 2024
d839b23
cleaned up comments and added docstring
m-baumgarten Mar 5, 2024
00870e5
added energy estimator, more or less identical to the one in ipie/est…
m-baumgarten Mar 6, 2024
e2e703b
removed addon imports and dispatch to local_energy_holstein
m-baumgarten Mar 6, 2024
dab3687
enabled AFQMC.build by adding some dummy parameters to HolsteinPropag…
m-baumgarten Mar 6, 2024
ad5c2cd
added docstring to EphWalkers and moved initial trial.calc_overlap fr…
m-baumgarten Mar 6, 2024
e782941
renamed Eph classes to EPh
m-baumgarten Mar 7, 2024
096ea3f
fix optimize position
m-baumgarten Mar 7, 2024
b425c44
Docstrings and renaming of HolsteinPropagatorImportance
m-baumgarten Mar 7, 2024
3a578a2
varaitional clean up, removed comments and moved gab to estimators.py
m-baumgarten Mar 7, 2024
f79e95a
docstrings and type specifications
m-baumgarten Mar 8, 2024
4ea65a6
added licensing header
m-baumgarten Mar 8, 2024
7eec46b
renamed phonon displacements stored in EPhWalkers.x to EPhWalkers.pho…
m-baumgarten Mar 8, 2024
c01760f
docstrings with math
m-baumgarten Mar 10, 2024
e59ead6
removed redundant calculation of greens function
m-baumgarten Mar 10, 2024
a3c3675
added abstract functions, required for every new trial
m-baumgarten Mar 10, 2024
317dcf3
intializes greens functions new and sets overlap in build
m-baumgarten Mar 10, 2024
ee14708
extra layer for propagators from addons
m-baumgarten Mar 11, 2024
eeeb44c
reformatted code
m-baumgarten Mar 11, 2024
58ed7af
Merge branch 'develop' into multiel_holstein
fdmalone Mar 11, 2024
93e6a49
renamed EPhWalkers.total_ovlp to EPhWalkers.ovlp_perm
m-baumgarten Mar 11, 2024
3edb5e8
calc_greens_function and calc_overlap are now "purer", calc_overlap s…
m-baumgarten Mar 11, 2024
4c72ba7
Merge branch 'multiel_holstein' of github.com:m-baumgarten/ipie_holst…
m-baumgarten Mar 11, 2024
d66d467
energy estimator unit test
m-baumgarten Mar 11, 2024
20d86a2
no more hamiltonian needed for trial initialisation. pass w0 instead
m-baumgarten Mar 11, 2024
24a99d5
fixed bug with final reshaping causing dimensions to be mixed up
m-baumgarten Mar 11, 2024
dfb3a4d
added variational_energy to toyozawa
m-baumgarten Mar 11, 2024
a0cfab5
added calc_energy to coherent state trial and made it abstractmethod
m-baumgarten Mar 12, 2024
cf8f379
added unittests for propagation and variational
m-baumgarten Mar 12, 2024
28d40df
utils for unittests
m-baumgarten Mar 12, 2024
298ad97
reformatting
m-baumgarten Mar 12, 2024
51b48a1
added verbosity for toyozawa_variational
m-baumgarten Mar 12, 2024
6fb14af
fixed bug with local_energy, where coherent state expectation value o…
m-baumgarten Mar 12, 2024
5a0a70a
added g_tensor in anticipation of generalization
m-baumgarten Mar 12, 2024
9dfd155
unittests for ephwalkers
m-baumgarten Mar 12, 2024
c355ffa
unittests for trial methods
m-baumgarten Mar 12, 2024
40c5ed5
docstring
m-baumgarten Mar 12, 2024
3b1256f
reformatting
m-baumgarten Mar 12, 2024
27b5365
light reformatting
m-baumgarten Mar 12, 2024
a801b80
removed redundant sqrt(m*w)
m-baumgarten Mar 13, 2024
42faa91
minor bug fixes
m-baumgarten Mar 13, 2024
5d7c560
example for holstein model 4 electrons
m-baumgarten Mar 20, 2024
ee78aad
Merge branch 'develop' into multiel_holstein
fdmalone Mar 30, 2024
92e3620
jax imports in tests guarded
m-baumgarten Apr 16, 2024
1a86cb4
Merge branch 'multiel_holstein' of github.com:m-baumgarten/ipie_holst…
m-baumgarten Apr 16, 2024
9bcb208
removed run_test in holstein example and renamed test_estimators
m-baumgarten Apr 16, 2024
0ebe6f2
Merge branch 'develop' into multiel_holstein
m-baumgarten Jul 22, 2024
705d1e6
removed jax dependency in example
m-baumgarten Aug 4, 2024
44bea2d
Merge branch 'multiel_holstein' of github.com:m-baumgarten/ipie_holst…
m-baumgarten Aug 4, 2024
4963d63
accommodates new Propagator dict
m-baumgarten Aug 4, 2024
e02282c
jax workaround like torch
m-baumgarten Aug 5, 2024
44505b5
fixed pytests
m-baumgarten Sep 6, 2024
fab267b
fixed pylint errors
m-baumgarten Sep 6, 2024
03f7b05
fixed remaining health errors
m-baumgarten Sep 6, 2024
40e9128
Merge branch 'develop' into multiel_holstein
linusjoonho Sep 6, 2024
b73fdd7
fixed examples and black
m-baumgarten Sep 7, 2024
cc4d29d
Merge branch 'multiel_holstein' of github.com:m-baumgarten/ipie_holst…
m-baumgarten Sep 7, 2024
fb69584
fixed example
m-baumgarten Sep 7, 2024
530c5ff
Merge branch 'develop' into multiel_holstein
linusjoonho Nov 5, 2024
42cdff4
Merge branch 'develop' into multiel_holstein
linusjoonho Nov 5, 2024
d9582f7
Merge branch 'develop' into multiel_holstein
linusjoonho Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dev/jax.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jax >= 0.4.13
218 changes: 0 additions & 218 deletions examples/14-fqe-wavefunction/run_afqmc.py

This file was deleted.

103 changes: 103 additions & 0 deletions examples/19-1d_holstein/run_afqmc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Copyright 2022 The ipie Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import numpy as np

np.random.seed(125)
from ipie.config import MPI

from ipie.qmc.afqmc import AFQMC
from ipie.systems import Generic
from ipie.addons.eph.hamiltonians.holstein import HolsteinModel
from ipie.addons.eph.trial_wavefunction.toyozawa import ToyozawaTrial

# from ipie.addons.eph.trial_wavefunction.variational.toyozawa_variational import (
# variational_trial_toyozawa,
# )
from ipie.addons.eph.walkers.eph_walkers import EPhWalkers
from ipie.addons.eph.estimators.energy import EnergyEstimator
from ipie.propagation.propagator import Propagator
from ipie.addons.eph.propagation.holstein import HolsteinPropagator

Propagator.update({HolsteinModel: HolsteinPropagator})

# System Parameters
nup = 2
ndown = 2
nelec = (nup, ndown)

# Hamiltonian Parameters
g = 2.0
t = 1.0
w0 = 4.0
nsites = 4
pbc = True

# Walker Parameters & Setup
comm = MPI.COMM_WORLD
nwalkers = 1000 // comm.size

# Setup initial guess for variational optimization
initial_electron = np.random.random((nsites, nup + ndown))
initial_phonons = np.ones(nsites) * 0.1

# System and Hamiltonian setup
system = Generic(nelec)
ham = HolsteinModel(g=g, t=t, w0=w0, nsites=nsites, pbc=pbc)
ham.build()

# Variational procedure - If Jax provided
# _, beta_shift, el_trial = variational_trial_toyozawa(
# initial_phonons, initial_electron, ham, system
# )
# wavefunction = np.column_stack([beta_shift, el_trial])
wavefunction = np.array(
[
[-0.05171059, 0.18699386, 0.21710474, 0.14657979, 0.29875713],
[1.07606477, 0.28428281, 1.00976995, -0.10386843, 1.45999226],
[0.34467794, 0.39093646, 0.40150302, 0.33165806, 0.54705797],
[1.45939397, 1.13142463, -0.14783494, 1.58959742, -0.35513289],
]
)

# Setup trial
trial = ToyozawaTrial(wavefunction=wavefunction, w0=ham.w0, num_elec=[nup, ndown], num_basis=nsites)
trial.set_etrial(ham)

# Setup walkers
walkers = EPhWalkers(
initial_walker=wavefunction, nup=nup, ndown=ndown, nbasis=nsites, nwalkers=nwalkers
)
walkers.build(trial)

num_steps_per_block = 10
num_blocks = 10
add_est = {
"energy": EnergyEstimator(system=system, ham=ham, trial=trial),
}

seed = 125

# Note nwalkers specifies the number of walkers on each CPU
ephqmc = AFQMC.build(
num_elec=nelec,
hamiltonian=ham,
trial_wavefunction=trial,
walkers=walkers,
num_walkers=nwalkers,
seed=seed,
num_steps_per_block=num_steps_per_block,
num_blocks=num_blocks,
)
ephqmc.run(additional_estimators=add_est, verbose=False)
4 changes: 0 additions & 4 deletions ipie/addons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,3 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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.
# New features should mirror the ipie layout e.g.
# ipie/addons/finite_temperature/qmc/afqmc.py etc.
13 changes: 13 additions & 0 deletions ipie/addons/eph/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2022 The ipie Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
13 changes: 13 additions & 0 deletions ipie/addons/eph/estimators/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2022 The ipie Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Loading
Loading