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()
Example #2
0
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()          
 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()
Example #4
0
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)
 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()
Example #6
0
 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()
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()
    def test_basic(self):
        dgraph = DisconnectivityGraph(self.tsgraph)
        dgraph.calculate()
        dgraph.plot()
        layout = dgraph.get_tree_layout()

        dgraph.draw_minima(self.db.minima()[:2])
Example #9
0
 def _compute_barriers(self, graph, min1):
     """for each minimum graph compute the (approximate) energy barrier to min1"""
     # this is a local import to avoid cyclical imports
     from pele.utils.disconnectivity_graph import DisconnectivityGraph
     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 #10
0
 def _build_disconnectivity_graph(self, **params):
     if self.database is not None:
         db = self.database
         apply_Emax = "Emax" in params and "T" not in params
         if apply_Emax:
             self.graph = database2graph(db, Emax=params['Emax'])
         else:
             self.graph = database2graph(db)
     dg = DisconnectivityGraph(self.graph, **params)
     dg.calculate()
     self.dg = dg
Example #11
0
 def _build_disconnectivity_graph(self, **params):
     if self.database is not None:
         db = self.database
         apply_Emax = "Emax" in params and "T" not in params
         if apply_Emax:
             self.graph = database2graph(db, Emax=params['Emax'])
         else:
             self.graph = database2graph(db)
     dg = DisconnectivityGraph(self.graph, **params)
     dg.calculate()
     self.dg = dg
Example #12
0
    def _compute_barriers(self, graph, min1):
        """for each minimum graph compute the (approximate) energy barrier to min1"""
        # this is a local import to avoid cyclical imports
        from pele.utils.disconnectivity_graph import DisconnectivityGraph

        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
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()   
Example #14
0
def make_only_dg(system, database, color=None):
    from pele.utils.disconnectivity_graph import DisconnectivityGraph, database2graph
    import matplotlib.pyplot as plt
    #     m1 = database.minima()[6]
    #     tss = database.getTransitionStatesMinimum(m1)
    #     for ts in tss:
    #         print orderbyenergy(database, ts.minimum1.energy), orderbyenergy(database, ts.minimum2.energy), ts.minimum1._id, ts.minimum2._id, ts.energy
    #     exit()
    for mi, m in enumerate(database.minima()):
        print mi, m.energy
    graph = database2graph(database)
    #     dg = DisconnectivityGraph(graph, center_gmin=True, Emax=4.0)
    #     dg = DisconnectivityGraph(graph, nlevels=2, center_gmin=True, subgraph_size=3)
    dg = DisconnectivityGraph(graph,
                              nlevels=30,
                              subgraph_size=5,
                              minima=[database.minima()[i] for i in [1, 2]])
    dg.calculate()
    #     dg.color_by_value(lambda x : np.random.random(), colormap=lambda x : np.random.random(3))

    if color != None:
        dg.color_by_value(
            lambda m: color[0, orderbyenergy(database, m.energy)],
            colormap=cmap)
    dg.plot()
    plt.show()
 def test_basic(self):
     dgraph = DisconnectivityGraph(self.tsgraph)
     dgraph.calculate()
     dgraph.plot()
     layout = dgraph.get_tree_layout()
     
     dgraph.draw_minima(self.db.minima()[:2])
 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")
 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")
    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()
Example #19
0
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()          
Example #20
0
    def plot(self):
        from pele.utils.disconnectivity_graph import DisconnectivityGraph, database2graph
        import matplotlib.pyplot as plt

        graph = database2graph(self.db)
        #         dg = DisconnectivityGraph(graph, nlevels=30, subgraph_size=5, minima=[self.db.minima()[i] for i in [1,2]])
        dg = DisconnectivityGraph(graph, nlevels=30, subgraph_size=5)
        dg.calculate()

        dg.color_by_value(
            lambda m: self.hem.HEM[0, orderbyenergy(self.db, m.energy)],
            colormap=self.colormap)
        dg.plot()
        plt.show()
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()
Example #22
0
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)
    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()
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()
 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()
Example #26
0
 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")
Example #27
0
 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")
Example #28
0
    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()
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)
Example #30
0
def make_disconnectivity_graph(system, database, **kwargs):
    from pele.utils.disconnectivity_graph import DisconnectivityGraph, database2graph

    graph = database2graph(database)
    dg = DisconnectivityGraph(graph, **kwargs)
    dg.calculate()

    # color DG points by test-set error
    #     minimum_to_testerror = lambda m: system.model.testset_error(m.coords)
    #     dg.color_by_value(minimum_to_testerror)
    dg.plot(linewidth=1.5)
    #dg.plot(linewidth=1.5)
    #     plt.colorbar()
    plt.show()
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()
Example #32
0
    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
max_key = 0
for key in Au_seg:
    if len(Au_seg[key]) > 0 and key > max_key:
Example #33
0
def make_disconnectivity_graph(database):
    graph = database2graph(database)
    dg = DisconnectivityGraph(graph, nlevels=3, center_gmin=True)
    dg.calculate()
    dg.plot()
    plt.show()
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()

# 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()


    


 def test_show_minima(self):
     dgraph = DisconnectivityGraph(self.tsgraph)
     dgraph.calculate()
     dgraph.plot(show_minima=True)
Example #36
0
 def test_show_minima(self):
     dgraph = DisconnectivityGraph(self.tsgraph)
     dgraph.calculate()
     dgraph.plot(show_minima=True)
Example #37
0
from __future__ import print_function
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")
    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()
Example #39
0
 def test_basic(self):
     dgraph = DisconnectivityGraph(self.tsgraph)
     dgraph.calculate()
     dgraph.plot()
Example #40
0
def make_disconnectivity_graph(database):
    graph = database2graph(database)
    dg = DisconnectivityGraph(graph, nlevels=3, center_gmin=True)
    dg.calculate()
    dg.plot()
    plt.show()
Example #41
0
    bh.run(20)

print "starting with a database of", len(db.minima()), "minima"

# turn of status printing for the connect run
# first use the logging module to turn off the status messages
logger = logging.getLogger("pele.connect")
logger.setLevel("WARNING")

# 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 #42
0
    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 paras['check_structure']:
    for ts in db.transition_states():
        if ts.energy > paras['check_e']:
            print ts.coords
    for rs in db.minima():
        if ts.energy > paras['check_e']:
            print rs.coords
graph = database2graph(db)
dg = DisconnectivityGraph(graph,
                          nlevels=paras['nlevels'],
                          Emax=Emax + 0.05,
                          node_offset=0)
dg.calculate()
dg.plot()
if paras['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 len(specified_min) > 0:
    dg.draw_minima(specified_min, marker='8', c='tab:green')
#find max number of atoms on surface
max_key = 0
for key in Au_seg:
    if len(Au_seg[key]) > 0 and key > max_key:
Example #43
0
 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()
Example #44
0
import pylab as plt
import sys


class orderByValue(object):
    def __call__(self, min1):
        print 'ID', min1.coords[0]
        return min1.coords[0]


args = sys.argv
db_amp = Database(db=args[1], accuracy=1e-10)
db_lj = Database(db=args[2], accuracy=1e-10)
dg_amp = DisconnectivityGraph(database2graph(db_amp),
                              nlevels=100,
                              Emax=-56.7716 + 0.05,
                              order_by_basin_size=False,
                              center_gmin=False,
                              order_by_value=orderByValue())
dg_lj = DisconnectivityGraph(database2graph(db_lj),
                             nlevels=100,
                             Emax=-56.7716 + 0.05,
                             order_by_basin_size=True,
                             center_gmin=True,
                             order_by_value=orderByValue())
dg_lj.calculate()

fig = plt.figure(figsize=(9, 7))
fig.set_facecolor('white')
ax = fig.add_subplot(111, adjustable='box')
#ax = fig.add_subplot(111)
#ax.axvline(linewidth=4, color="g")