Пример #1
0
# For history dependent algorithms such as LBFGS, if ML
# updates becomes problematic, dyn.run can be replaced by:
#
# for _ in dyn.irun(fmax=maxforce):
#    if calc.updated:
#        dyn.initialize()    # clears history

# Getting closer to the local minima by forceful updating
# the model; this will cause at least 2 more ab initio
# calculations (one of which is needed anyway to determine
# the proximity to the actual minima).
while True:
    if calc.update_data(try_fake=False):
        calc.update(data=False)
        calc.results.clear()
        dyn.initialize()
        dyn.run(fmax=maxforce)
    else:
        break

# Calculate exact energy & forces for the final coordinates.
# The optimized coordinates and ab initio energy & forces
# will be written to "active_FP.traj".
energy, forces = calc._test()
f_rms = np.sqrt(np.mean(forces**2))
f_max = abs(forces).max()
report = f"""
    relaxation result:
    energy:      {energy}
    force (rms): {f_rms}
    force (max): {f_max}