/usr/share/pyshared/ase/test/basin.py is in python-ase 3.6.0.2515-1.1.
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 28 29 30 31 32 33 34 35 | import numpy as np
from math import pi, sqrt
from ase import Atoms
from ase.calculators.lj import LennardJones
from ase.optimize.basin import BasinHopping
from ase.io import PickleTrajectory, read
from ase.units import kB
N = 7
R = N**(1./3.)
pos = np.random.uniform(-R, R, (N, 3))
s = Atoms('He' + str(N),
positions = pos)
s.set_calculator(LennardJones())
ftraj = 'lowest.traj'
traj = PickleTrajectory(ftraj, 'w', s)
bh = BasinHopping(s,
temperature=100 * kB, dr=0.5,
optimizer_logfile=None)
bh.attach(traj)
bh.run(10)
Emin, smin = bh.get_minimum()
# recalc energy
smin.set_calculator(LennardJones())
E = smin.get_potential_energy()
assert abs(E - Emin) < 1e-15
traj.close()
smim = read(ftraj)
E = smin.get_potential_energy()
assert abs(E - Emin) < 1e-15
#view(smin)
|