def test(): from pygmin.systems import LJCluster natoms = 13 system = LJCluster(natoms) db = system.create_database() # get some minima bh = system.get_basinhopping(database=db, outstream=None) bh.run(100) manager = ConnectManager(db, clust_min=2) for i in range(4): min1, min2 = manager.get_connect_job(strategy="random") print "connecting", min1._id, min2._id connect = system.get_double_ended_connect(min1, min2, db, verbosity=0) connect.connect() print "\n\ntesting untrap" for i in range(10): min1, min2 = manager.get_connect_job(strategy="untrap") print min1._id, min2._id print "\n\ntesting combine" for i in range(5): min1, min2 = manager.get_connect_job(strategy="combine") print min1._id, min2._id print "\n\ntesting gmin" for i in range(5): min1, min2 = manager.get_connect_job(strategy="gmin") print min1._id, min2._id
def test(): from pygmin.systems import LJCluster natoms = 13 system = LJCluster(natoms) db = system.create_database() # get some minima bh = system.get_basinhopping(database=db, outstream=None) bh.run(100) manager = ConnectManager(db, clust_min=2) for i in range(4): min1, min2 = manager.get_connect_job(strategy="random") print "connecting", min1._id, min2._id connect = system.get_double_ended_connect(min1, min2, db, verbosity=0) connect.connect() print "\n\ntesting untrap" for i in range(10): min1, min2 = manager.get_connect_job(strategy="untrap") print min1._id, min2._id print "\n\ntesting combine" for i in range(5): min1, min2 = manager.get_connect_job(strategy="combine") print min1._id, min2._id print "\n\ntesting gmin" for i in range(5): min1, min2 = manager.get_connect_job(strategy="gmin") print min1._id, min2._id
def get_database(natoms=13, nconn=5): """create a database for a lennard jones system fill it with minima from a basinhopping run, then connect some of those minima using DoubleEndedConnect """ ljsys = LJCluster(natoms) db = ljsys.create_database() bh = ljsys.get_basinhopping(database=db, outstream=None) while (len(db.minima()) < nconn + 1): bh.run(100) minima = list(db.minima()) m1 = minima[0] for m2 in minima[1:nconn + 1]: connect = ljsys.get_double_ended_connect(m1, m2, db) connect.connect() return db
def get_database(natoms=13, nconn=5): """create a database for a lennard jones system fill it with minima from a basinhopping run, then connect some of those minima using DoubleEndedConnect """ ljsys = LJCluster(natoms) db = ljsys.create_database() bh = ljsys.get_basinhopping(database=db, outstream=None) while len(db.minima()) < nconn + 1: bh.run(100) minima = list(db.minima()) m1 = minima[0] for m2 in minima[1 : nconn + 1]: connect = ljsys.get_double_ended_connect(m1, m2, db) connect.connect() return db
#get some minima if False: bh = system.get_basinhopping(database=db) bh.run(10) minima = db.minima() else: x1, e1 = system.get_random_minimized_configuration()[:2] x2, e2 = system.get_random_minimized_configuration()[:2] min1 = db.addMinimum(e1, x1) min2 = db.addMinimum(e2, x2) minima = [min1, min2] # connect some of the minima nmax = min(3, len(minima)) m1 = minima[0] for m2 in minima[1:nmax]: connect = system.get_double_ended_connect(m1, m2, db) connect.connect() wnd = GraphViewDialog(db, app=app) # decrunner = DECRunner(system, db, min1, min2, outstream=wnd.textEdit_writer) glutInit() wnd.show() from PyQt4.QtCore import QTimer QTimer.singleShot(10, start) sys.exit(app.exec_())
for minimum in db.minima(): print " ", minimum.energy # find the minimum distance (a.k.a. mindist) between the two lowest minima m1, m2 = db.minima()[:2] mindist = system.get_mindist() dist, coords1, coords2 = mindist(m1.coords, m2.coords) print "the minimum distance between the two lowest minima is", dist # find a connected series of minima and transition states between m1 and m2 # # first use the logging module to turn off the status messages logger = logging.getLogger("pygmin.connect") logger.setLevel("WARNING") # now create the double ended connect object connect = system.get_double_ended_connect(m1, m2, db) connect.connect() mints, S, energies = connect.returnPath() nts = (len(mints) - 1) / 2 print "\nprint found a connection with", nts, "transition states" # connect all minima to the lowest minimum print "now connecting all the minima to the lowest energy minimum" m1 = db.minima()[0] for m2 in db.minima()[1:]: print "connecting minima with id's", m1._id, m2._id connect = system.get_double_ended_connect(m1, m2, db) connect.connect() # print some data about the database print "database summary:"
NEBparams.iter_density = 40 # Transition State Search parameters: tsparams = decparams.local_connect_params.tsSearchParams # change the maximum uphill step tsparams.max_uphill_step = 0.05 # change the number of steps in the transverse minimization tsparams.nsteps_tangent1 = 4 # # done modifying parameters # # do the double ended connect run connect = system.get_double_ended_connect(min1, min2, db) connect.connect() success = connect.success() if not success: print "failed to find connection" else: mints, S, energies = connect.returnPath() nts = (len(mints) - 1) / 2 print "found a path with", nts, "transition states" print "plotting energies along the path" import pylab as pl pl.plot(S, energies, "-") pl.xlabel("distance along path") pl.ylabel("energy")
NEBparams.iter_density = 40 # Transition State Search parameters: tsparams = decparams.local_connect_params.tsSearchParams # change the maximum uphill step tsparams.max_uphill_step = .05 # change the number of steps in the transverse minimization tsparams.nsteps_tangent1 = 4 # # done modifying parameters # # do the double ended connect run connect = system.get_double_ended_connect(min1, min2, db) connect.connect() success = connect.success() if not success: print "failed to find connection" else: mints, S, energies = connect.returnPath() nts = (len(mints) - 1)/2 print "found a path with", nts, "transition states" print "plotting energies along the path" import pylab as pl pl.plot(S, energies, '-') pl.xlabel("distance along path") pl.ylabel("energy") pl.show()