# Section: Optimizer
convergence_parameters = {}
{% if optimizer.convergence_parameters %}
    {% for key, value in optimizer.convergence_parameters.items() %}
convergence_parameters['{{ key }}'] = {{ value }}
    {% endfor %}
{% endif %}

optimizer_start = time.perf_counter()
optimizer = mean_field.Gradients().optimizer(solver='{{ optimizer.solver }}')
optimizer_run = optimizer.kernel(convergence_parameters)

results['timings']['optimizer'] = time.perf_counter() - optimizer_start
results['optimized_coordinates'] = optimizer_run.atom_coords().tolist()
