def test_combine(self): minima = self.db.minima() i = 5 for m1, m2 in zip(minima[:i-1], minima[1:i]): self.connect_min(m1, m2) for m1, m2 in zip(minima[i:], minima[i+1:]): self.connect_min(m1, m2) # at this point the minima should be in two disconnected groups g = database2graph(self.db) self.assertEqual(len(list(nx.connected_components(g))), 2) manager = ConnectManager(self.db, strategy="combine") m1, m2 = manager.get_connect_job() self.connect_min(m1, m2) # they should all be connected now g = database2graph(self.db) self.assertEqual(len(list(nx.connected_components(g))), 1)
def make_graph(path_to_data_dir,database): # make a graph from the database graph = database2graph(database) # turn the graph into a disconnectivity graph dg = DisconnectivityGraph(graph) dg.calculate() print "number of minima:", dg.tree_graph.number_of_leaves() dg.plot() path_to_file = os.path.join(path_to_data_dir,"Disconnectivity_graph.png") plt.savefig(path_to_file,dpi=1000)
def test_combine(self): minima = self.db.minima() i = 5 for m1, m2 in zip(minima[:i - 1], minima[1:i]): self.connect_min(m1, m2) for m1, m2 in zip(minima[i:], minima[i + 1:]): self.connect_min(m1, m2) # at this point the minima should be in two disconnected groups g = database2graph(self.db) self.assertEqual(len(list(nx.connected_components(g))), 2) manager = ConnectManager(self.db, strategy="combine") m1, m2 = manager.get_connect_job() self.connect_min(m1, m2) # they should all be connected now g = database2graph(self.db) self.assertEqual(len(list(nx.connected_components(g))), 1)
def print_info(dbfname="ss60.sqlite"): system, db = create_soft_sphere_system_from_db(dbfname) import networkx as nx from pele.landscape import database2graph graph = database2graph(db) cc = nx.connected_components(graph) c = cc[0] for i in range(3): print(c[i].energy)
def print_info(dbfname="ss60.sqlite"): system, db = create_soft_sphere_system_from_db(dbfname) import networkx as nx from pele.landscape import database2graph graph = database2graph(db) cc = nx.connected_components(graph) c = cc[0] for i in xrange(3): print c[i].energy
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()
if Emax is None: Emax = -1e20 for ts in db.transition_states(): if ts.energy > Emax: Emax = ts.energy print 'max ts:', Emax #check the structures with energy larger than check_e #print paras['check_structure'] if check_structure: for ts in db.transition_states(): if ts.energy > check_e: print ts.coords for rs in db.minima(): if ts.energy > check_e: print rs.coords graph = database2graph(db) dg = DisconnectivityGraph(graph, nlevels=nlevels, Emax=Emax + 0.05, node_offset=0) dg.calculate() dg.plot() if min_state_n == 0: dg.draw_minima([start_state], c='tab:gray') if len(emphasize) > 0: dg.draw_minima(emphasize, marker='o', c='tab:red') if specified_min is not None: dg.draw_minima([specified_min], marker='8', c='tab:green') #find max number of atoms on surface