Skip to content

Commit

Permalink
Update geometry callback example
Browse files Browse the repository at this point in the history
  • Loading branch information
sunqm committed Nov 9, 2019
1 parent 91b6a16 commit 6d9d13c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/geomopt/20-callback.py
Expand Up @@ -23,7 +23,16 @@ def cb(envs):
mf = envs['g_scanner'].base
mf.analyze(verbose=4)

#
# Method 1: Pass callback to optimize function
#
geometric_solver.optimize(mf, callback=cb)

berny_solver.optimize(mf, callback=cb)

#
# Method 2: Add callback to geometry optimizer
#
opt = mf.nuc_grad_method().as_scanner().optimizer()
opt.callback = cb
opt.kernel()

0 comments on commit 6d9d13c

Please sign in to comment.