Example #1
0
 def test_disconn_graph(self,database):
     from pygmin.utils.disconnectivity_graph import DisconnectivityGraph
     from pygmin.landscape import Graph
     import matplotlib.pyplot as plt
     graph = Graph(database).graph
     dg = DisconnectivityGraph(graph, nlevels=3, center_gmin=True)
     dg.calculate()
     dg.plot()
     plt.show()
Example #2
0
    def _compute_barriers(self, graph, min1):
        """for each minimum graph compute the (approximate) energy barrier to min1"""
        dgraph = DisconnectivityGraph(graph, nlevels=self.nlevels)
        dgraph.calculate()
        tree = dgraph.tree_graph

        energy_barriers = dict()
        self._recursive_label(tree, min1, energy_barriers)
        return energy_barriers
Example #3
0
 def _compute_barriers(self, graph, min1):
     """for each minimum graph compute the (approximate) energy barrier to min1"""
     dgraph = DisconnectivityGraph(graph, nlevels=self.nlevels)
     dgraph.calculate()
     tree = dgraph.tree_graph
     
     energy_barriers = dict()
     self._recursive_label(tree, min1, energy_barriers)
     return energy_barriers
Example #4
0
 def _build_disconnectivity_graph(self, **params):
     if self.database is None:
         graph = self.graph
     else:
         db = self.database
         if self.params.has_key('Emax'):
             graph = reduced_db2graph(db, params['Emax'])
         else:
             graphwrapper = TSGraph(db)
             graph = graphwrapper.graph
     dg = DisconnectivityGraph(graph, **params)
     dg.calculate()
     self.dg = dg
Example #5
0
 def _build_disconnectivity_graph(self, **params):
     if self.database is None:
         graph = self.graph
     else:
         db = self.database
         if self.params.has_key('Emax'):
             graph = reduced_db2graph(db, params['Emax'])
         else:
             graphwrapper = TSGraph(db)
             graph = graphwrapper.graph
     dg = DisconnectivityGraph(graph, **params)
     dg.calculate()
     self.dg = dg
Example #6
0
    def show_disconnectivity_graph(self):
        import pylab as pl
        pl.ion()
        pl.clf()
        ax = pl.gca()
        fig = pl.gcf()

        graphwrapper = Graph(self.system.database)
        dg = DisconnectivityGraph(graphwrapper.graph, subgraph_size=2)
        dg.calculate()
        
        #draw minima as points
        xpos, minima = dg.get_minima_layout()
        energies = [m.energy for m in minima]
        points = ax.scatter(xpos, energies, picker=5)
        
        #draw line segments connecting minima
        line_segments = dg.line_segments
        for x, y in line_segments:
            ax.plot(x, y, 'k')
        
        
        #define what happens when a point is clicked on
        global pick_count
        pick_count = 0
        def on_pick(event):
            if event.artist != points:
#                print "you clicked on something other than a node"
                return True
            thispoint = event.artist
            ind = event.ind[0]
            min1 = minima[ind]
            print "you clicked on minimum with id", min1._id, "and energy", min1.energy
            global pick_count
            #print pick_count
            pick_count += 1
            if (pick_count % 2) == 0:
                self._SelectMinimum1(min1)
            else:
                self._SelectMinimum2(min1)
        fig = pl.gcf()
        cid = fig.canvas.mpl_connect('pick_event', on_pick)

        pl.show()
Example #7
0
    def _build_disconnectivity_graph(self, show_minima=True, **params):
        #this should be somewhere else
        if self.database is None:
            graph = self.graph
        else:
            db = self.database
            graphwrapper = Graph(db)
            graph = graphwrapper.graph
        dg = DisconnectivityGraph(graph, **params)
        dg.calculate()
        
        ax = self.canvas.axes
        ax.clear()
        ax.hold(True)        

        #draw minima as points and make them interactive
        if show_minima:
            xpos, minima = dg.get_minima_layout()
            energies = [m.energy for m in minima]
            points = ax.scatter(xpos, energies, picker=5)        
            
            def on_pick(event):
                if event.artist != points:
    #                print "you clicked on something other than a node"
                    return True
                thispoint = event.artist
                ind = event.ind[0]
                min1 = minima[ind]
                print "you clicked on minimum with id", min1._id, "and energy", min1.energy
                self.minimum_selected(min1)
            self.canvas.mpl_connect('pick_event', on_pick)
        
        # plot the lines and set up the rest of the plot using the built in function 
        dg.plot(axes=ax, show_minima=False)
        self.canvas.draw()
Example #8
0
 def test_disconn_graph(self,database):
     from pygmin.utils.disconnectivity_graph import DisconnectivityGraph
     from pygmin.landscape import TSGraph
     import matplotlib.pyplot as plt
     graph = TSGraph(database).graph
     dg = DisconnectivityGraph(graph, nlevels=3, center_gmin=True)
     dg.calculate()
     dg.plot()
     plt.show()
Example #9
0
def make_disconnectivity_graph(database):
    graph = Graph(database).graph
    dg = DisconnectivityGraph(graph, nlevels=3, center_gmin=True)
    dg.calculate()
    dg.plot()
    plt.show()
Example #10
0
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:"
print "    ", len(db.minima()), "minima"
print "    ", len(db.transition_states()), "transition states"

# finally, create a disconnectivity graph from the database
print "computing and showing disconnectivity graph"
import pylab as pl
graph = database2graph(db)
dg = DisconnectivityGraph(graph, nlevels=6)
dg.calculate()
dg.plot()
pl.show()
Example #11
0
from pygmin.utils.disconnectivity_graph import DisconnectivityGraph
from pygmin.storage import Database
from pygmin.landscape import TSGraph
import pylab as pl
import numpy as np

kbT = 0.75

db = Database(db="tip4p_8.sqlite", createdb=False)

graph = TSGraph(db)

dg = DisconnectivityGraph(graph.graph, db.minima(), subgraph_size=20)
dg.calculate()
dg.plot()

for m in db.minima():
    if m.pgorder != 2:
        print m.pgorder
    m.free_energy = m.energy + kbT * 0.5*m.fvib + kbT*np.log(m.pgorder)

 
for ts in db.transition_states():
#    if ts.pgorder != 2:
    print ts.pgorder
    #assert ts.pgorder == 2    

    ts.free_energy = ts.energy + kbT * 0.5*ts.fvib + kbT*np.log(ts.pgorder) + kbT*np.log(kbT)
    if ts.free_energy > ts.minimum1.free_energy or ts.free_energy > ts.minimum2.free_energy:        
        print "warning, free energy of transition state lower than minimum"
        print ts.free_energy, ts.minimum1.free_energy, ts.minimum2.free_energy
Example #12
0
from pygmin.utils.disconnectivity_graph import DisconnectivityGraph
from pygmin.storage import Database
from pygmin.landscape import TSGraph
import pylab as pl
import numpy as np

kbT = 0.75

db = Database(db="tip4p_8.sqlite", createdb=False)

graph = TSGraph(db)

dg = DisconnectivityGraph(graph.graph, db.minima(), subgraph_size=20)
dg.calculate()
dg.plot()

for m in db.minima():
    if m.pgorder != 2:
        print m.pgorder
    m.free_energy = m.energy + kbT * 0.5 * m.fvib + kbT * np.log(m.pgorder)

for ts in db.transition_states():
    #    if ts.pgorder != 2:
    print ts.pgorder
    #assert ts.pgorder == 2

    ts.free_energy = ts.energy + kbT * 0.5 * ts.fvib + kbT * np.log(
        ts.pgorder) + kbT * np.log(kbT)
    if ts.free_energy > ts.minimum1.free_energy or ts.free_energy > ts.minimum2.free_energy:
        print "warning, free energy of transition state lower than minimum"
        print ts.free_energy, ts.minimum1.free_energy, ts.minimum2.free_energy
Example #13
0
def make_disconnectivity_graph(database):
    graph = TSGraph(database).graph
    dg = DisconnectivityGraph(graph, nlevels=3, center_gmin=True)
    dg.calculate()
    dg.plot()
    plt.show()