Commit 548b5690 authored by Martin Reinecke's avatar Martin Reinecke

merge Reimar's changes

parents 9327b752 ffc6059b
Pipeline #61317 passed with stages
in 8 minutes and 26 seconds
......@@ -166,7 +166,8 @@ class NewtonCG(DescentMinimizer):
"""
def __init__(self, controller, napprox=0, line_searcher=None, name=None,
nreset=20, file_name=None):
nreset=20, max_cg_iterations=200, energy_reduction_factor=0.1,
file_name=None):
if line_searcher is None:
line_searcher = LineSearch(preferred_initial_step_size=1.)
super(NewtonCG, self).__init__(controller=controller,
......@@ -175,15 +176,16 @@ class NewtonCG(DescentMinimizer):
self._name = name
self._nreset = nreset
self._file_name = file_name
self._max_cg_iterations = max_cg_iterations
self._alpha = energy_reduction_factor
def get_descent_direction(self, energy, old_value=None):
if old_value is None:
ic = GradientNormController(iteration_limit=5)
else:
alpha = 0.1
ediff = alpha*(old_value-energy.value)
ediff = self._alpha*(old_value-energy.value)
ic = AbsDeltaEnergyController(
ediff, iteration_limit=200, name=self._name,
ediff, iteration_limit=self._max_cg_iterations, name=self._name,
file_name=self._file_name)
e = QuadraticEnergy(0*energy.position, energy.metric, energy.gradient)
p = None
......
......@@ -138,7 +138,6 @@ def probe_diagonal(op, nprobes, random_type="pm1"):
def approximation2endo(op, nsamples):
print('Calculate preconditioner')
sc = StatCalculator()
for _ in range(nsamples):
sc.add(op.draw_sample())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment