Ejemplo n.º 1
0
def test():
    from pele.systems import LJCluster
    from pele.landscape import ConnectManager

    system = LJCluster(13)

    db = system.create_database()
    bh = system.get_basinhopping(db, outstream=None)
    bh.run(200)

    manager = ConnectManager(db)
    for i in range(3):
        min1, min2 = manager.get_connect_job()
        connect = system.get_double_ended_connect(min1, min2, db)
        connect.connect()

    # get_thermodynamic_information(system, db)

    print "getting thermodynamic info", db.number_of_minima()
    get_thermodynamic_information(system, db, nproc=4)

    for m in db.minima():
        print m.id(), m.pgorder, m.fvib

    print "\nnow transition states"
    for ts in db.transition_states():
        print ts.id(), ts.pgorder, ts.fvib
Ejemplo n.º 2
0
def test():
    from pele.systems import LJCluster
    from pele.landscape import ConnectManager
    system = LJCluster(13)
    
    db = system.create_database()
    bh = system.get_basinhopping(db, outstream=None)
    bh.run(200)
    
    manager = ConnectManager(db)
    for i in range(3):
        min1, min2 = manager.get_connect_job()
        connect = system.get_double_ended_connect(min1, min2, db)
        connect.connect()
    
#    get_thermodynamic_information(system, db)
    
    print "getting thermodynamic info", db.number_of_minima()
    get_thermodynamic_information(system, db, nproc=4)
    
    for m in db.minima():
        print m._id, m.pgorder, m.fvib
    
    print "\nnow transition states"
    for ts in db.transition_states():
        print ts._id, ts.pgorder, ts.fvib
Ejemplo n.º 3
0
def test():
    from pele.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
Ejemplo n.º 4
0
def test():
    from OpenGL.GLUT import glutInit
    import sys
    import pylab as pl

    app = QtGui.QApplication(sys.argv)
    from pele.systems import LJCluster
    pl.ion()
    natoms = 13
    system = LJCluster(natoms)
    system.params.double_ended_connect.local_connect_params.NEBparams.iter_density = 5.
    dbname = "lj%dtest.db" % (natoms,)
    db = system.create_database(dbname)
    
    #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()
    
        
    if True:
        from pele.thermodynamics import get_thermodynamic_information
        get_thermodynamic_information(system, db, nproc=4)
    
    wnd = GraphViewDialog(db, app=app)
#    decrunner = DECRunner(system, db, min1, min2, outstream=wnd.textEdit_writer)
    glutInit()
    wnd.show()
    from PyQt4.QtCore import QTimer
    def start():
        wnd.start()

    QTimer.singleShot(10, start)
    sys.exit(app.exec_()) 
Ejemplo n.º 5
0
def test():
    from OpenGL.GLUT import glutInit
    import sys
    import pylab as pl

    app = QtGui.QApplication(sys.argv)
    from pele.systems import LJCluster
    pl.ion()
    natoms = 13
    system = LJCluster(natoms)
    system.params.double_ended_connect.local_connect_params.NEBparams.iter_density = 5.
    dbname = "lj%dtest.db" % (natoms,)
    db = system.create_database(dbname)
    
    #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()
    
        
    if True:
        from pele.thermodynamics import get_thermodynamic_information
        get_thermodynamic_information(system, db, nproc=4)
    
    wnd = GraphViewDialog(db, app=app)
#    decrunner = DECRunner(system, db, min1, min2, outstream=wnd.textEdit_writer)
    glutInit()
    wnd.show()
    from PyQt4.QtCore import QTimer
    def start():
        wnd.start()

    QTimer.singleShot(10, start)
    sys.exit(app.exec_()) 
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
Ejemplo n.º 7
0
coords2 = np.genfromtxt("coords.B").flatten()

# minimize them
quencher = system.get_minimizer()
ret1 = quencher(coords1)
ret2 = quencher(coords2)

# make a database and add the minima
db = system.create_database()
coords, E = ret1[:2]
min1 = db.addMinimum(E, coords)
coords, E = ret2[:2]
min2 = db.addMinimum(E, coords)

# 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()
Ejemplo n.º 8
0
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("pele.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"
from pele.landscape import ConnectManager
manager = ConnectManager(db, strategy="gmin")
for i in xrange(db.number_of_minima()-1):
    print "connecting minima with id's", m1._id, m2._id
    m1, m2 = manager.get_connect_job()
    connect = system.get_double_ended_connect(m1, m2, db)
    connect.connect()
Ejemplo n.º 9
0
coords2 = np.genfromtxt("coords.B").flatten()

# minimize them
quencher = system.get_minimizer()
ret1 = quencher(coords1)
ret2 = quencher(coords2)

# make a database and add the minima
db = system.create_database()
coords, E = ret1[:2]
min1 = db.addMinimum(E, coords)
coords, E = ret2[:2]
min2 = db.addMinimum(E, coords)

# 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 = old_div((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")
Ejemplo n.º 10
0
        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 = RateViewer(system, db)
#    decrunner = DECRunner(system, db, min1, min2, outstream=wnd.textEdit_writer)
    glutInit()
    wnd.show()
    from PyQt4.QtCore import QTimer
    wnd.update_A(db.minima()[0])
    wnd.update_B(db.minima()[1])
    
    QTimer.singleShot(10, start)
    sys.exit(app.exec_())