当前位置: 首页>>代码示例>>Python>>正文


Python DisconnectivityGraph.plot方法代码示例

本文整理汇总了Python中pele.utils.disconnectivity_graph.DisconnectivityGraph.plot方法的典型用法代码示例。如果您正苦于以下问题:Python DisconnectivityGraph.plot方法的具体用法?Python DisconnectivityGraph.plot怎么用?Python DisconnectivityGraph.plot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pele.utils.disconnectivity_graph.DisconnectivityGraph的用法示例。


在下文中一共展示了DisconnectivityGraph.plot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_disconnectivity_graph

# 需要导入模块: from pele.utils.disconnectivity_graph import DisconnectivityGraph [as 别名]
# 或者: from pele.utils.disconnectivity_graph.DisconnectivityGraph import plot [as 别名]
def make_disconnectivity_graph(system, database, vinputs, vtargets):
    from pele.utils.disconnectivity_graph import DisconnectivityGraph, database2graph
    import matplotlib.pyplot as plt
    
    graph = database2graph(database)
    dg = DisconnectivityGraph(graph, nlevels=5, center_gmin=True, Emax=50.0, subgraph_size=3)
    dg.calculate()

    pot = system.get_potential()
    validation_energy = lambda m: pot.getValidationEnergy(m.coords, vinputs, vtargets)
    vmin = min(graph.nodes(), key=lambda m: validation_energy(m))
    labels = {vmin : "vmin"}    
    print vmin.energy, min(database.minima(), key = lambda m : validation_energy(m)).energy
#     for m in graph.nodes():
#         print m.energy
    for t in database.transition_states():
        print t.minimum1.energy, t.minimum2.energy, t.energy
        if abs(t.minimum1.energy-12.1884413947)<0.1 or abs(t.minimum2.energy-12.1884413947)<0.1:
            print t.minimum1.energy, t.minimum2.energy, t.energy
#     for u,v,data in graph.edges(data=True):
#         ts = data["ts"]
#         if abs(u.energy-12.1884413947)<0.1 or abs(v.energy-12.1884413947)<0.1:
#             print u.energy, v.energy, ts.energy  
    dg.plot()
    dg.label_minima(labels)

    plt.show()   
开发者ID:js850,项目名称:machine_learning_landscapes,代码行数:29,代码来源:dg_vis.py

示例2: test_basic

# 需要导入模块: from pele.utils.disconnectivity_graph import DisconnectivityGraph [as 别名]
# 或者: from pele.utils.disconnectivity_graph.DisconnectivityGraph import plot [as 别名]
 def test_basic(self):
     dgraph = DisconnectivityGraph(self.tsgraph)
     dgraph.calculate()
     dgraph.plot()
     layout = dgraph.get_tree_layout()
     
     dgraph.draw_minima(self.db.minima()[:2])
开发者ID:Mahdisadjadi,项目名称:pele,代码行数:9,代码来源:test_disconnectivity_graph.py

示例3: test_connect

# 需要导入模块: from pele.utils.disconnectivity_graph import DisconnectivityGraph [as 别名]
# 或者: from pele.utils.disconnectivity_graph.DisconnectivityGraph import plot [as 别名]
def test_connect():  # pragma: no cover

    nmol = 5
    boxvec = np.array([5,5,5])
    rcut = 2.5
    system = OTPBulk(nmol,boxvec,rcut)   

    db = test_bh()
#     X1 = db.minima()[0].coords
#     X2 = db.minima()[1].coords
    
#     import pele.angleaxis.aaperiodicttransforms as md
#     a = md.MeasurePeriodicRigid(system.aatopology, transform=TransformPeriodicRigid())
#     b = MinPermDistBulk(boxvec, a, transform=TransformPeriodicRigid())     
#     dist, x1, x2 = b(X1,X2)
    
    min1, min2 = db.minima()[0], db.minima()[1]
#     from pele.landscape import ConnectManager
#     manager = ConnectManager(db, strategy="gmin")
#     for i in xrange(db.number_of_minima()-1):
#         min1, min2 = manager.get_connect_job()
    connect = system.get_double_ended_connect(min1, min2, db)
    connect.connect()
    from pele.utils.disconnectivity_graph import DisconnectivityGraph, database2graph
    import matplotlib.pyplot as plt
#     convert the database to a networkx graph
    graph = database2graph(db)
    dg = DisconnectivityGraph(graph, nlevels=3, center_gmin=True)
    dg.calculate()
    dg.plot()
    plt.show()          
开发者ID:Mahdisadjadi,项目名称:pele,代码行数:33,代码来源:_otp_bulk.py

示例4: test_2_minima

# 需要导入模块: from pele.utils.disconnectivity_graph import DisconnectivityGraph [as 别名]
# 或者: from pele.utils.disconnectivity_graph.DisconnectivityGraph import plot [as 别名]
 def test_2_minima(self):
     db = create_random_database(nmin=3, nts=1)
     
     tsgraph = database2graph(self.db)
     dgraph = DisconnectivityGraph(tsgraph, include_gmin=True)
     dgraph.calculate()
     dgraph.plot()
开发者ID:Mahdisadjadi,项目名称:pele,代码行数:9,代码来源:test_disconnectivity_graph.py

示例5: test_gmin_not_connected

# 需要导入模块: from pele.utils.disconnectivity_graph import DisconnectivityGraph [as 别名]
# 或者: from pele.utils.disconnectivity_graph.DisconnectivityGraph import plot [as 别名]
 def test_gmin_not_connected(self):
     m0 = self.db.get_lowest_energy_minimum()
     self.db.addMinimum(m0.energy - 10., m0.coords)
     
     tsgraph = database2graph(self.db)
     dgraph = DisconnectivityGraph(tsgraph, include_gmin=True)
     dgraph.calculate()
     dgraph.plot()
开发者ID:Mahdisadjadi,项目名称:pele,代码行数:10,代码来源:test_disconnectivity_graph.py

示例6: make_disconnectivity_graph

# 需要导入模块: from pele.utils.disconnectivity_graph import DisconnectivityGraph [as 别名]
# 或者: from pele.utils.disconnectivity_graph.DisconnectivityGraph import plot [as 别名]
def make_disconnectivity_graph(system, database, fname='dg.pdf', **kwargs):
    import matplotlib.pyplot as plt
    from pele.utils.disconnectivity_graph import DisconnectivityGraph, database2graph
    graph = database2graph(database)
    dg = DisconnectivityGraph(graph, **kwargs)
    dg.calculate()
    dg.plot(linewidth=1.5)
    plt.savefig(fname)
开发者ID:Mahdisadjadi,项目名称:pele,代码行数:10,代码来源:start_serial.py

示例7: test_Emax

# 需要导入模块: from pele.utils.disconnectivity_graph import DisconnectivityGraph [as 别名]
# 或者: from pele.utils.disconnectivity_graph.DisconnectivityGraph import plot [as 别名]
 def test_Emax(self):
     emax = self.db._highest_energy_minimum().energy
     m1 = self.db.addMinimum(emax-5.1, [0.])
     m2 = self.db.addMinimum(emax-5.2, [0.])
     self.db.addTransitionState(emax-5, [0.], m1, m2)
     self.db.addMinimum(emax-5.3, [0.]) # so this will need to be removed
     dgraph = DisconnectivityGraph(self.tsgraph, Emax=emax-2, subgraph_size=1, order_by_energy=True)
     dgraph.calculate()
     dgraph.plot()
开发者ID:Mahdisadjadi,项目名称:pele,代码行数:11,代码来源:test_disconnectivity_graph.py

示例8: make_disconnectivity_graph

# 需要导入模块: from pele.utils.disconnectivity_graph import DisconnectivityGraph [as 别名]
# 或者: from pele.utils.disconnectivity_graph.DisconnectivityGraph import plot [as 别名]
def make_disconnectivity_graph(database):
    from pele.utils.disconnectivity_graph import DisconnectivityGraph, database2graph
    import matplotlib.pyplot as plt
    
    graph = database2graph(database)
    dg = DisconnectivityGraph(graph, nlevels=3, center_gmin=True)
    dg.calculate()
    dg.plot()
    plt.show()
开发者ID:js850,项目名称:machine_learning_landscapes,代码行数:11,代码来源:regmodels.py

示例9: test_disconn_graph

# 需要导入模块: from pele.utils.disconnectivity_graph import DisconnectivityGraph [as 别名]
# 或者: from pele.utils.disconnectivity_graph.DisconnectivityGraph import plot [as 别名]
 def test_disconn_graph(self,database):
     from pele.utils.disconnectivity_graph import DisconnectivityGraph
     from pele.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()
开发者ID:js850,项目名称:pele,代码行数:11,代码来源:amberSystem.py

示例10: test_color_groups

# 需要导入模块: from pele.utils.disconnectivity_graph import DisconnectivityGraph [as 别名]
# 或者: from pele.utils.disconnectivity_graph.DisconnectivityGraph import plot [as 别名]
 def test_color_groups(self):
     dgraph = DisconnectivityGraph(self.tsgraph)
     dgraph.calculate()
     groups = [ self.db.minima()[:5],
               self.db.minima()[5:10],
               self.db.minima()[10:15],
               self.db.minima()[15:18],
               ]
     dgraph.color_by_group(groups)
     dgraph.plot(linewidth=2.)
     if _show:
         from matplotlib import pyplot as plt
         plt.title("color by group")
开发者ID:jdf43,项目名称:pele,代码行数:15,代码来源:test_disconnectivity_graph.py

示例11: test_color_groups_many

# 需要导入模块: from pele.utils.disconnectivity_graph import DisconnectivityGraph [as 别名]
# 或者: from pele.utils.disconnectivity_graph.DisconnectivityGraph import plot [as 别名]
 def test_color_groups_many(self):
     dgraph = DisconnectivityGraph(self.tsgraph)
     dgraph.calculate()
     groups = []
     for m in self.db.minima():
         groups.append([m])
         if len(groups) > 13:
             break
     dgraph.color_by_group(groups)
     dgraph.plot(linewidth=2.)
     if _show:
         from matplotlib import pyplot as plt
         plt.title("color by group")
开发者ID:jdf43,项目名称:pele,代码行数:15,代码来源:test_disconnectivity_graph.py

示例12: make_graph

# 需要导入模块: from pele.utils.disconnectivity_graph import DisconnectivityGraph [as 别名]
# 或者: from pele.utils.disconnectivity_graph.DisconnectivityGraph import plot [as 别名]
def make_graph(database):
    # make a graph from the database
    graph = database2graph(database)

    # turn the graph into a disconnectivity graph
    dg = DisconnectivityGraph(graph,
                              nlevels=5,
                              center_gmin=False,
                              order_by_energy=True)
    dg.calculate()

    print "number of minima:", dg.tree_graph.number_of_leaves()
    dg.plot()
    dg.show()
开发者ID:Mahdisadjadi,项目名称:pele,代码行数:16,代码来源:make_disconnectivity_graph.py

示例13: test_color_value

# 需要导入模块: from pele.utils.disconnectivity_graph import DisconnectivityGraph [as 别名]
# 或者: from pele.utils.disconnectivity_graph.DisconnectivityGraph import plot [as 别名]
 def test_color_value(self):
     dgraph = DisconnectivityGraph(self.tsgraph)
     dgraph.calculate()
     def minimum_to_value(m):
         if m.energy < 5.:
             return m.energy
         else:
             return None
     dgraph.color_by_value(minimum_to_value)
     dgraph.plot(linewidth=2.)
     dgraph.label_minima({self.db.minima()[0]: "gmin", 
                          self.db.minima()[1]: "2nd lowest"})
     if _show:
         from matplotlib import pyplot as plt
         plt.title("color by value")
         dgraph.show()
开发者ID:jdf43,项目名称:pele,代码行数:18,代码来源:test_disconnectivity_graph.py

示例14: make_validation_disconnectivity_graph

# 需要导入模块: from pele.utils.disconnectivity_graph import DisconnectivityGraph [as 别名]
# 或者: from pele.utils.disconnectivity_graph.DisconnectivityGraph import plot [as 别名]
def make_validation_disconnectivity_graph(system, database):
    from pele.utils.disconnectivity_graph import DisconnectivityGraph, database2graph
    import matplotlib.pyplot as plt
 
    inputs, targets = get_validation_data()
   
    """ make validation_energy a minimum object"""    
    pot = system.get_potential()
    validation_energy = lambda m: pot.getValidationEnergy(m.coords, inputs, targets)
    graph = database2graph(database)
    for m in graph.nodes():
        m.validation_energy = validation_energy(m)
    for u,v,data in graph.edges(data=True):
        ts = data["ts"]
        ve = max([validation_energy(ts), u.validation_energy, v.validation_energy])
        ts.validation_energy = ve

    gmin = min(graph.nodes(), key=lambda m:m.energy)
#     smin = graph.nodes().sort(key=lambda m:m.energy)
    smin = sorted(graph.nodes(), key=lambda m:m.energy)
#     gmax = max(graph.nodes(), key=lambda m:m.energy)
    
    labels = dict()
    for i,s in enumerate(smin):
        if i % 10 == 0: labels[s] = str(i)
#     labels = {gmin : "gmin"}
    dg = DisconnectivityGraph(graph, nlevels=10, center_gmin=True, energy_attribute="validation_energy", subgraph_size=3)
    dg.calculate()
    
#     minimum_to_validation_energy = lambda m: pot.getValidationEnergy(m.coords, inputs, targets)
    
#     dg.color_by_value(validation_energy)
    
    dg.plot()
    dg.label_minima(labels)
    print labels
    plt.show()
开发者ID:js850,项目名称:machine_learning_landscapes,代码行数:39,代码来源:dg_vis.py

示例15: Database

# 需要导入模块: from pele.utils.disconnectivity_graph import DisconnectivityGraph [as 别名]
# 或者: from pele.utils.disconnectivity_graph.DisconnectivityGraph import plot [as 别名]
from pele.utils.disconnectivity_graph import DisconnectivityGraph
from pele.storage import Database
from pele.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
开发者ID:Mahdisadjadi,项目名称:pele,代码行数:33,代码来源:tip4p_dgraph.py


注:本文中的pele.utils.disconnectivity_graph.DisconnectivityGraph.plot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。