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

working ccd imaginary time propagation #30

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
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
36 changes: 36 additions & 0 deletions coupled_cluster/ccd/itdccd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from coupled_cluster import TDCCD
from coupled_cluster.cc_helper import ( AmplitudeContainer)
from coupled_cluster.integrators import RungeKutta4

class ITDCCD(TDCCD):
"""Performs imaginary time propagation for ground state calculations."""
def __call__(self, prev_amp, current_time):
o, v = self.system.o, self.system.v

prev_amp = AmplitudeContainer.from_array(self._amplitudes, prev_amp)
t_old, l_old = prev_amp

self.update_hamiltonian(current_time, prev_amp)

# Remove phase from t-amplitude list
t_old = t_old[1:]

t_new = [
- rhs_t_func(self.f, self.u, *t_old, o, v, np=self.np)
for rhs_t_func in self.rhs_t_amplitudes()
]

# Compute derivative of phase
t_0_new = - self.rhs_t_0_amplitude(
self.f, self.u, *t_old, self.o, self.v, np=self.np
)
t_new = [t_0_new, *t_new]

l_new = [
- rhs_l_func(self.f, self.u, *t_old, *l_old, o, v, np=self.np)
for rhs_l_func in self.rhs_l_amplitudes()
]

self.last_timestep = current_time

return AmplitudeContainer(t=t_new, l=l_new, np=self.np).asarray()