/usr/share/python-ase/doc/ase/precon.py is in python-ase-doc 3.12.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # creates: precon.png
from ase.build import bulk
from ase.calculators.emt import EMT
from ase.optimize.precon import Exp, PreconLBFGS
from ase.calculators.loggingcalc import LoggingCalculator
import matplotlib.pyplot as plt
a0 = bulk('Cu', cubic=True)
a0 *= [3, 3, 3]
del a0[0]
a0.rattle(0.1)
nsteps = []
energies = []
log_calc = LoggingCalculator(EMT())
for precon, label in [(None, 'None'), (Exp(A=3), 'Exp(A=3)')]:
log_calc.label = label
atoms = a0.copy()
atoms.set_calculator(log_calc)
opt = PreconLBFGS(atoms, precon=precon, use_armijo=True)
opt.run(fmax=1e-3)
log_calc.plot(markers=['r-', 'b-'], energy=False, lw=2)
plt.savefig('precon.png')
|