Commit dd96f55d authored by Carl Goodrich's avatar Carl Goodrich
Browse files

verbose dneb minimization

parent 03905169
......@@ -204,7 +204,8 @@ def setup_DNEB_minimization(true_energy_fn,
dt_max=0.0004,
num_images=100,
max_grad_thresh=1e-12,
max_num_steps=100000):
max_num_steps=100000,
return_dneb_force_fn=False):
""" Define a function to minimize a DNEB
"""
......@@ -233,7 +234,7 @@ def setup_DNEB_minimization(true_energy_fn,
return fire_apply(state), i + 1
@jit
def minimize_DNEB(R_input):
def minimize_DNEB(R_input, verbose=False):
""" minimize a DNEB
Args:
......@@ -261,12 +262,18 @@ def setup_DNEB_minimization(true_energy_fn,
state = fire_init(Rinit)
state, num_iterations = lax.while_loop(cond_fn, body_fn, (state, 0))
if verbose:
print('finished minimizing dneb. max_grad = {}, num_iter = {}'.format(state.force, num_iteractions))
Rfinal = state.position
Efinal = true_energy_full_fn(Rfinal)
return Rfinal, Efinal #This tuple is sometimes called "results"
return minimize_DNEB
if return_dneb_force_fn:
return minimize_DNEB, total_force
else:
return minimize_DNEB
def find_DNEB_paths(R_endpoints,
......
Supports Markdown
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