def __init__(self): self.storage = savenlowest.SaveN(10) GMIN.initialize()
print "quenched e = ", ret.energy, "funcalls", ret.nfev print ret.coords m = getm(ret[0]) print "magnetization after quench", m # do basin hopping from pele.basinhopping import BasinHopping from pele.takestep.displace import RandomDisplacement from pele.takestep.adaptive import AdaptiveStepsize from pele.storage import savenlowest takestep = RandomDisplacement(stepsize=np.pi / 4) takestepa = AdaptiveStepsize(takestep, frequency=10) storage = savenlowest.SaveN(20) bh = BasinHopping(coords, pot, takestepa, temperature=1.01, storage=storage) bh.run(200) print "lowest structures fount:" with open("out.spins", "w") as fout: for min in storage.data: m = getm(min.coords) print "energy", min.energy, "magnetization", m fout.write("energy %g magnetization %g\n" % (min.energy, m)) printspins(fout, pot, min.coords) fout.write("\n\n") """ view the spins with gnuplot using the command h = 2.
ret = mylbfgs(angles, pot) print(ret) # set up and run basin hopping from pele.basinhopping import BasinHopping from pele.takestep.displace import RandomDisplacement from pele.takestep.adaptive import AdaptiveStepsize from pele.storage import savenlowest # should probably use a different take step routine which takes into account # the cyclical periodicity of angles takestep = RandomDisplacement(stepsize=old_div(np.pi, 4)) takestepa = AdaptiveStepsize(takestep, frequency=20) storage = savenlowest.SaveN(500) bh = BasinHopping(angles, pot, takestepa, temperature=1.01, storage=storage) bh.run(400) print("minima found") with open("out.spin", "w") as fout: for min in storage.data: print("energy", min.energy) fout.write("# %g\n" % (min.energy)) printspins(fout, pot, min.coords) fout.write('\n\n') """ view this in gnuplot with the command set size ratio -1 plot 'out.spin' index 0 u 1:2 w p pt 5, '' index 0 u 1:2:($3*0.5):($4*0.5) w vectors
''' Created on Jul 27, 2012 @author: vr274 ''' from __future__ import print_function from pele.storage import savenlowest from pele.utils import dmagmin import pickle save = savenlowest.SaveN(nsave=1000, accuracy=1e-3, compareMinima=dmagmin.compareMinima) import sys for i in sys.argv[1:]: print(i) save2 = pickle.load(open(i, "r")) for m in save2.data: save.insert(m.E, m.coords) pickle.dump(save, open("storage", "w"))