Пример #1
0
def benchmark_number_of_minima():
    import time, sys
    import numpy as np
    db = Database("test.large.db")

    if True:
        istart = np.random.randint(0, sys.maxsize)
        for i in range(istart, istart + 10000):
            e = float(i)
            db.addMinimum(e, [e], commit=False)
        db.session.commit()
    else:
        i = 1

    t1 = time.process_time()
    print(db.number_of_minima())
    print("time", t1 - time.process_time())
    t1 = time.process_time()
    print(db.number_of_minima())
    print("time", t1 - time.process_time())
    t1 = time.process_time()
    print(db.number_of_minima())
    print("time", t1 - time.process_time())
    t1 = time.process_time()
    e = float(i + 1)
    db.addMinimum(e, [e], commit=False)
    t1 = time.process_time()
    print(db.number_of_minima())
    print("time", t1 - time.process_time())
    t1 = time.process_time()

    print(len(db.minima()))
    print("time", t1 - time.process_time())
    t1 = time.process_time()
Пример #2
0
    def test1(self):
        current_dir = os.path.dirname(__file__)
        db = Database()
        converter = OptimDBConverter(
            db,
            mindata=os.path.join(current_dir, "min.data"),
            tsdata=os.path.join(current_dir, "ts.data"),
            pointsmin=os.path.join(current_dir, "points.min"),
            pointsts=os.path.join(current_dir, "points.ts"),
            endianness="<")
        converter.convert()
        self.assertEqual(db.number_of_minima(), 2)
        self.assertEqual(db.number_of_transition_states(), 1)

        ts = db.transition_states()[0]
        self.assertAlmostEqual(ts.coords[0], 1.548324, 5)
        self.assertAlmostEqual(ts.coords[2], 0.18178001, 5)
        self.assertAlmostEqual(ts.coords[-1], -0.50953229, 5)
        self.assertEqual((180, ), ts.coords.shape)

        m = db.minima()[0]
        print repr(m.coords)
        self.assertAlmostEqual(m.coords[0], 1.53700142, 5)
        self.assertAlmostEqual(m.coords[2], 0.87783657, 5)
        self.assertAlmostEqual(m.coords[-1], -0.50953229, 5)
        self.assertEqual((180, ), m.coords.shape)
Пример #3
0
def benchmark_number_of_minima():
    import time, sys
    import numpy as np
    db = Database("test.large.db")
    
    if True:
        istart = np.random.randint(0, sys.maxint)
        for i in xrange(istart,istart+10000):
            e = float(i)
            db.addMinimum(e, [e], commit=False)
        db.session.commit()
    else:
        i=1
    
    t1 = time.clock()
    print db.number_of_minima()
    print "time", t1 - time.clock(); t1 = time.clock()
    print db.number_of_minima()
    print "time", t1 - time.clock(); t1 = time.clock()
    print db.number_of_minima()
    print "time", t1 - time.clock(); t1 = time.clock()
    e = float(i+1)
    db.addMinimum(e, [e], commit=False)
    t1 = time.clock()
    print db.number_of_minima()
    print "time", t1 - time.clock(); t1 = time.clock()

    print len(db.minima())
    print "time", t1 - time.clock(); t1 = time.clock()
Пример #4
0
    def test1(self):
        current_dir = os.path.dirname(__file__)
        db = Database()
        converter = OptimDBConverter(db, 
                                     mindata=os.path.join(current_dir, "min.data"),
                                     tsdata=os.path.join(current_dir, "ts.data"),
                                     pointsmin=os.path.join(current_dir, "points.min"),
                                     pointsts=os.path.join(current_dir, "points.ts"),
                                     endianness="<")
        converter.convert()
        self.assertEqual(db.number_of_minima(), 2)
        self.assertEqual(db.number_of_transition_states(), 1)
        
        ts = db.transition_states()[0]
        self.assertAlmostEqual(ts.coords[0], 1.548324, 5)
        self.assertAlmostEqual(ts.coords[2], 0.18178001, 5)
        self.assertAlmostEqual(ts.coords[-1], -0.50953229, 5)
        self.assertEqual((180,), ts.coords.shape)

        m = db.minima()[0]
        print(repr(m.coords))
        self.assertAlmostEqual(m.coords[0], 1.53700142, 5)
        self.assertAlmostEqual(m.coords[2], 0.87783657, 5)
        self.assertAlmostEqual(m.coords[-1], -0.50953229, 5)
        self.assertEqual((180,), m.coords.shape)
Пример #5
0
def bh_no_system_class():
    import numpy as np
    from pele.potentials import LJ
    natoms = 17
    potential = LJ()
    x0 = np.random.uniform(-1, 1, 3*natoms)
    
    from pele.takestep import RandomDisplacement, AdaptiveStepsizeTemperature
    displace = RandomDisplacement()
    adaptive_displacement = AdaptiveStepsizeTemperature(displace)
    
    from pele.storage import Database
    database = Database("lj17.sqlite")
    
    from pele.basinhopping import BasinHopping
    bh = BasinHopping(x0, potential, adaptive_displacement, storage=database.minimum_adder)
    bh.run(10)
    
    for m in database.minima():
        print m.energy
Пример #6
0
    def test2(self):
        from pele.storage import Database
        from pele.systems import LJCluster
        np.random.seed(0)

        natoms = 13
        system = LJCluster(natoms)
        pot = system.get_potential()
        mindist = system.get_mindist(niter=1)
        
        db = Database()
        db.addMinimum(pot.getEnergy(_x1), _x1)
        db.addMinimum(pot.getEnergy(_x2), _x2)
        m1, m2 = db.minima()
        
        connect = DoubleEndedConnect(m1, m2, pot, mindist, db, verbosity=10)
        connect.connect()
        self.assertTrue(connect.success())
        
        path = connect.returnPath()
Пример #7
0
    def test2(self):
        from pele.utils.tests.test_disconnectivity_graph import create_random_database

        db = create_random_database(nmin=20, nts=15)

        delete = False
        mdata = tempfile.NamedTemporaryFile(delete=delete, suffix=".min.data")
        tsdata = tempfile.NamedTemporaryFile(delete=delete, suffix=".ts.data")
        pm = tempfile.NamedTemporaryFile(delete=delete)
        pts = tempfile.NamedTemporaryFile(delete=delete)
        print mdata.name, tsdata.name
        writer = WritePathsampleDB(db,
                                   mindata=mdata.name,
                                   tsdata=tsdata.name,
                                   pointsmin=pm.name,
                                   pointsts=pts.name,
                                   endianness="<")

        writer.write_db()

        newdb = Database()
        reader = OptimDBConverter(newdb,
                                  mindata=mdata.name,
                                  tsdata=tsdata.name,
                                  pointsmin=pm.name,
                                  pointsts=pts.name,
                                  endianness="<")
        reader.convert()

        for m1, m2 in izip(db.minima(), newdb.minima()):
            self.assertAlmostEqual(m1.energy, m2.energy)
            _base_test.assert_arrays_almost_equal(self, m1.coords, m2.coords)

        for ts1, ts2 in izip(db.transition_states(),
                             newdb.transition_states()):
            self.assertAlmostEqual(ts1.energy, ts2.energy)
            _base_test.assert_arrays_almost_equal(self, ts1.coords, ts2.coords)
            self.assertAlmostEqual(ts1.minimum1.energy, ts2.minimum1.energy)
            self.assertAlmostEqual(ts1.minimum2.energy, ts2.minimum2.energy)
Пример #8
0
 def test2(self):
     from pele.utils.tests.test_disconnectivity_graph import create_random_database
     
     db = create_random_database(nmin=20, nts=15)
     
     delete=False
     mdata = tempfile.NamedTemporaryFile(delete=delete, suffix=".min.data")
     tsdata = tempfile.NamedTemporaryFile(delete=delete, suffix=".ts.data")
     pm = tempfile.NamedTemporaryFile(delete=delete)
     pts = tempfile.NamedTemporaryFile(delete=delete)
     print(mdata.name, tsdata.name)
     writer = WritePathsampleDB(db,
                                mindata=mdata.name,
                                tsdata=tsdata.name,
                                pointsmin=pm.name,
                                pointsts=pts.name,
                                endianness="<")
     
     writer.write_db()
     
     newdb = Database()
     reader = OptimDBConverter(newdb,
                               mindata=mdata.name,
                               tsdata=tsdata.name,
                               pointsmin=pm.name,
                               pointsts=pts.name,
                               endianness="<")
     reader.convert()
     
     for m1, m2 in zip(db.minima(), newdb.minima()):
         self.assertAlmostEqual(m1.energy, m2.energy)
         _base_test.assert_arrays_almost_equal(self, m1.coords, m2.coords)
     
     for ts1, ts2 in zip(db.transition_states(), newdb.transition_states()):
         self.assertAlmostEqual(ts1.energy, ts2.energy)
         _base_test.assert_arrays_almost_equal(self, ts1.coords, ts2.coords)
         self.assertAlmostEqual(ts1.minimum1.energy, ts2.minimum1.energy)
         self.assertAlmostEqual(ts1.minimum2.energy, ts2.minimum2.energy)
Пример #9
0
class TestConnectManager(unittest.TestCase):
    def setUp(self):
        self.db = Database()
        self.nminima = 10
        for i in range(self.nminima):
            e = float(i)
            self.db.addMinimum(e, [e])

    def connect_min(self, m1, m2):
        e = np.random.uniform(0, 100)
        self.db.addTransitionState(e, [e], m1, m2)

    def test_gmin(self):
        manager = ConnectManager(self.db, strategy="gmin")
        m0 = self.db.minima()[0]

        for i in range(5):
            m1, m2 = manager.get_connect_job()
            self.assertEqual(m1, m0)
            self.connect_min(m1, m2)

    def test_random(self):
        manager = ConnectManager(self.db, strategy="random")

        for i in range(5):
            m1, m2 = manager.get_connect_job()
            self.connect_min(m1, m2)

    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 test_untrap(self):
        # first connect them all randomly
        manager = ConnectManager(self.db, strategy="random")
        while True:
            try:
                m1, m2 = manager.get_connect_job()
            except manager.NoMoreConnectionsError:
                break
            self.connect_min(m1, m2)

        for i in range(5):
            try:
                m1, m2 = manager.get_connect_job(strategy="untrap")
            except manager.NoMoreConnectionsError:
                break
            self.connect_min(m1, m2)
Пример #10
0
coords1 = np.genfromtxt("coords.A")
coords2 = np.genfromtxt("coords.B")
res1 = lbfgs_py(coords1.reshape(-1), pot)
res2 = lbfgs_py(coords2.reshape(-1), pot)
coords1 = res1.coords
coords2 = res2.coords
E1 = res1.energy
E2 = res2.energy
natoms = len(coords1)/3

#add the minima to a database
dbfile = "database.sqlite"
database = Database(dbfile)
database.addMinimum(E1, coords1)
database.addMinimum(E2, coords2)
min1 = database.minima()[0]
min2 = database.minima()[1]
    



#set up the structural alignment routine.
#we have to deal with global translational, global rotational,
#and permutational symmetry.
permlist = [range(natoms)]
mindist = MinPermDistAtomicCluster(permlist=permlist, niter=10)

#The transition state search needs to know what the eigenvector corresponding
#to the lowest nonzero eigenvector is.  For this we need to know what the
#eivenvector corresponding to the zero eigenvalues are.  These are related
#to global symmetries.  for this system we have 3 zero eigenvalues for translational
Пример #11
0
    parser.add_argument("--Tmax", type=float, help="Minimum temperature for the calculation.", default=1.0)
    parser.add_argument("--Tcount", type=int, help="Number of temperature points for the calculation.", default=300)
    parser.add_argument("--OPTIM", action="store_true", help="read data from a min.data file instead."
                        "fname should be the filename of the min.data file")
    args = parser.parse_args()
    print args.fname
    print args
    k = args.k
    
    # get the list of minima
    if args.OPTIM:
        # fname is a min.data file
        db = Database()
        converter = OptimDBConverter(db, mindata=args.fname)
        converter.convert_no_coords()
        minima = db.minima()
    else:
        dbfname = args.fname
        db = Database(dbfname, createdb=False)
        minima = [m for m in db.minima() if m.fvib is not None and m.pgorder is not None]
        if len(minima) == 0:
            print "There are not minima with the necessary thermodynamic information in the database.  Have you computed the normal mode"\
                  " frequencies and point group order for all the minima?  See pele.thermodynamics "\
                  " for more information"
            exit(1)
    print "computing heat capacity from", len(minima), "minima"

    Tmin = args.Tmin
    Tmax = args.Tmax
    nT = args.Tcount
    dT = (Tmax-Tmin) / nT
Пример #12
0
    run_gui(system, db=dbname)


if __name__ == "__main__":
    p = 5
    N = 20
    #run_gui(N, p)

    #event_after_step = lambda energy, coords, acceptstep : normalize_spins(coords)
    #event_after_step=[event_after_step]
    if False:
        system = MeanFieldPSpinSphericalSystem(N, p=p)
        db = system.create_database("pspin_spherical_p{}_N{}.sqlite".format(p,N))
        bh = system.get_basinhopping(database=db, outstream=None)
        bh.run(100)

    if True:
        run_gui_db(dbname="pspin_spherical_p{}_N{}.sqlite".format(p,N))

    if False:
        compare_minima = lambda m1, m2 : compare_exact(m1.coords, m2.coords, rel_tol=1e-7, debug=False)
        db = Database("pspin_spherical_p{}_N{}.sqlite".format(p,N))
        minima = db.minima()
        minima.sort(key=lambda m: m.energy)
        #for m in minima:
        #    print m.energy, m.coords
        print minima[0].energy, minima[0].coords
        print minima[1].energy, minima[1].coords
        print compare_minima(minima[0],minima[1])

Пример #13
0
#path = [ x for x in InterpolatedPath(path[0].copy(), path[-1].copy(), 34) ]
traj = open("traj.xyz", "w")
#for x in path:
#    #export_xyz(traj, x)
#    #ret = quench.mylbfgs(x, pot.getEnergyGradient)
#    #print i,pot.getEnergy(x), ret[1]
#    
#    # export_xyz(traj, ret[0])
for x in path:
    export_xyz(traj, x)

import pickle
pickle.dump(path, open("interpolate.pickle", "w"))
exit()
db=Database(db="oxdna.sqlite")
path[0]=db.minima()[19].coords
path[-1]=db.minima()[0].coords

e1 = []
e2 = []

e1.append(pot.getEnergy(path[0]))
e2.append(pot.getEnergy(path[0]))

#for i in xrange(1):
for i in xrange(len(path) - 1):
    e1.append(pot.getEnergy(path[i + 1]))
    c1 = CoordsAdapter(nrigid=13, coords=path[i])
    c2 = CoordsAdapter(nrigid=13, coords=path[i + 1])
    com1 = np.sum(c1.posRigid, axis=0) / float(13)
    com2 = np.sum(c1.posRigid, axis=0) / float(13)
Пример #14
0
#                        default="otp.db")
    parser.add_argument("k", type=int, help="number of degrees of vibrational freedom")
    parser.add_argument("fname", type=str, help="database file name")
    args = parser.parse_args()
    print args.fname
    k = args.k
    
    dbfname = args.fname
    db = Database(dbfname)

    Tmin = .001
    Tmax = .5
    nT = 300
    dT = (Tmax-Tmin) / nT
    
    T = np.array([Tmin + dT*i for i in range(nT)])
    Z, U, U2, Cv = compute_cv(db.minima(), T, k)
    print Z, Cv
    
    with open("cv_ha", "w") as fout:
        fout.write("#T Cv <E> <E**2>\n")
        for vals in zip(T, Cv, U, U2):
            fout.write("%g %g %g %g\n" % vals)
    
    import pylab as pl
    pl.plot(T, Cv, 'o-')
    pl.xlabel("T")
    pl.ylabel("Cv")
    pl.savefig("cv_ha.pdf")
        
Пример #15
0
    if min_state_n > 0:
        selected_procs = process_table[process_table['productID'] >= dir]
    else:
        selected_procs = process_table[process_table['productID'] >= 0]
    for i in range(len(selected_procs['productID'])):
        ps_ID = selected_procs['productID'].iloc[i]
        #print ps_ID
        if ps_ID >= max_state_n:
            continue
        try:
            ps = db.addMinimum(states_e[ps_ID], [ps_ID], max_n_minima=-1)
            ts = db.addTransitionState(selected_procs['saddle energy'].iloc[i],
                                       [dir, ps_ID], rs, ps)
        except:
            continue
print "#of states:", len(db.minima())
#for mini in db.minima():
#   print mini.coords
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():
Пример #16
0
    parser.add_argument("k",
                        type=int,
                        help="number of degrees of vibrational freedom")
    parser.add_argument("fname", type=str, help="database file name")
    args = parser.parse_args()
    print args.fname
    k = args.k

    dbfname = args.fname
    db = Database(dbfname)

    Tmin = .001
    Tmax = .5
    nT = 300
    dT = (Tmax - Tmin) / nT

    T = np.array([Tmin + dT * i for i in range(nT)])
    Z, U, U2, Cv = compute_cv(db.minima(), T, k)
    print Z, Cv

    with open("cv_ha", "w") as fout:
        fout.write("#T Cv <E> <E**2>\n")
        for vals in zip(T, Cv, U, U2):
            fout.write("%g %g %g %g\n" % vals)

    import pylab as pl
    pl.plot(T, Cv, 'o-')
    pl.xlabel("T")
    pl.ylabel("Cv")
    pl.savefig("cv_ha.pdf")
Пример #17
0
    parser.add_argument("--OPTIM",
                        action="store_true",
                        help="read data from a min.data file instead."
                        "fname should be the filename of the min.data file")
    args = parser.parse_args()
    print(args.fname)
    print(args)
    k = args.k

    # get the list of minima
    if args.OPTIM:
        # fname is a min.data file
        db = Database()
        converter = OptimDBConverter(db, mindata=args.fname)
        converter.convert_no_coords()
        minima = db.minima()
    else:
        dbfname = args.fname
        db = Database(dbfname, createdb=False)
        minima = [
            m for m in db.minima()
            if m.fvib is not None and m.pgorder is not None
        ]
        if len(minima) == 0:
            print("There are not minima with the necessary thermodynamic information in the database.  Have you computed the normal mode"\
                  " frequencies and point group order for all the minima?  See pele.thermodynamics "\
                  " for more information")
            exit(1)
    print("computing heat capacity from", len(minima), "minima")

    Tmin = args.Tmin
Пример #18
0
class TestDB(unittest.TestCase):
    def setUp(self):
        self.db = Database()
        self.nminima = 10
        for i in range(self.nminima):
            e = float(i)
            self.db.addMinimum(e, [e])
        
        
        self.nts = 3
        self.db.addTransitionState(0., [0.], self.db.minima()[0], self.db.minima()[1], eigenval=0., eigenvec=[0.])
        self.db.addTransitionState(0., [0.], self.db.minima()[1], self.db.minima()[2], eigenval=0., eigenvec=[0.])
        self.db.addTransitionState(0., [0.], self.db.minima()[0], self.db.minima()[2], eigenval=0., eigenvec=[0.])

    def test_size(self):
        self.assertEqual(len(self.db.minima()), self.nminima)
        
    def test_energy(self):
        m = self.db.minima()[0]
        self.assertEqual(m.energy, 0.)

    def test_coords(self):
        m = self.db.minima()[0]
        self.assertEqual(m.coords, [0.])

    def test_sizets(self):
        self.assertEqual(len(self.db.transition_states()), self.nts)
    def test_energyts(self):
        ts = self.db.transition_states()[0]
        self.assertEqual(ts.energy, 0.)

    def test_coordsts(self):
        ts = self.db.transition_states()[0]
        self.assertEqual(ts.coords, [0.])
    
    def test_remove_minimum(self):
        m = self.db.minima()[0]
        self.db.removeMinimum(m)
        self.assertEqual(len(self.db.minima()), self.nminima-1)
        self.assertNotIn(m, self.db.minima())
        
        # m should have 2 minima.  both of those should be gone
        self.assertEqual(len(self.db.transition_states()), self.nts-2)

    def test_remove_ts(self):
        ts = self.db.transition_states()[0]
        self.db.remove_transition_state(ts)
        self.assertEqual(self.db.number_of_transition_states(), self.nts-1)
        self.assertNotIn(ts, self.db.transition_states())
        
        # m should have 2 minima.  both of those should be gone
        self.assertEqual(self.db.number_of_minima(), self.nminima)


    def test_getTransitionState(self):
        m1 = self.db.minima()[0]
        m2 = self.db.minima()[1]
        m3 = self.db.minima()[-1]
        self.assertIsNotNone(self.db.getTransitionState(m1, m2))
        self.assertIsNone(self.db.getTransitionState(m1, m3))
    
    def test_getMinimum(self):
        m = self.db.minima()[0]
        self.assertEqual(m, self.db.getMinimum(m._id))
        
    def test_minimum_adder(self):
        ma = self.db.minimum_adder()
        ma(101., [101.])
        self.assertEqual(len(self.db.minima()), self.nminima+1)
    
    def test_merge_minima(self):
        m1 = self.db.minima()[0]
        m2 = self.db.minima()[1]
        self.db.mergeMinima(m1, m2)
        self.assertEqual(len(self.db.minima()), self.nminima-1)
        # transition states shouldn't be deleted
        self.assertEqual(len(self.db.transition_states()), self.nts)
    
    def test_number_of_minima(self):
        self.assertEqual(self.nminima, self.db.number_of_minima())
    
    def test_number_of_transition_states(self):
        self.assertEqual(self.nts, self.db.number_of_transition_states())
    
    def test_highest_energy_minimum(self):
        m1 = self.db._highest_energy_minimum()
        m2 = self.db.minima()[-1]
        self.assertEqual(m1, m2)
    
    def test_maximum_number_of_minima(self):
        m = self.db.addMinimum(-1., [-1.], max_n_minima=self.nminima)
        self.assertEqual(self.nminima, self.db.number_of_minima())
        self.assertIn(m, self.db.minima())

    def test_maximum_number_of_minima_largestE(self):
        e = float(self.nminima + 1)
        m = self.db.addMinimum(e, [e], max_n_minima=self.nminima)
        self.assertEqual(self.nminima, self.db.number_of_minima())
        self.assertIsNone(m)
        
        #ensure the highest energy minimum is still in the database
        mmax = self.db._highest_energy_minimum()
        self.assertEqual(mmax.energy, float(self.nminima-1))
        
    def test_maximum_number_of_minima_minima_adder(self):
        ma = self.db.minimum_adder(max_n_minima=self.nminima)
        m = ma(-1., [-1.])
        self.assertEqual(self.nminima, self.db.number_of_minima())
        self.assertIn(m, self.db.minima())

    def test_getTSfromID(self):
        ts = self.db.transition_states()[0]
        ts1 = self.db.getTransitionStateFromID(ts._id)
        self.assertEqual(ts, ts1)

    def test_property(self):
        # add some system properties and ensure they were added correctly
        self.db.add_property("natoms", 10)
        p = self.db.get_property("natoms")
        self.assertEqual(p.value(), 10)
        self.db.add_property("eps", 2.1)
        p = self.db.get_property("eps")
        self.assertEqual(p.value(), 2.1)
        self.db.add_property("author", "Jake")
        p = self.db.get_property("author")
        self.assertEqual(p.value(), "Jake")
        self.db.add_property("data", [1, 2])
        p = self.db.get_property("data")
        self.assertEqual(p.value(), [1, 2])
        
        # assert that the not set values are None
        p = self.db.get_property("natoms")
        self.assertIsNone(p.string_value)
        self.assertIsNone(p.float_value)
        self.assertIsNone(p.pickle_value)

        
        p = self.db.get_property("noprop")
        self.assertIsNone(p)

        props = self.db.properties(as_dict=True)
        self.assertIsInstance(props, dict)
        self.assertDictContainsSubset(dict(natoms=10), props)
        self.assertEqual(len(props.items()), 4)
        
        props = self.db.properties(as_dict=False)
        self.assertIn(("natoms", 10), [p.item() for p in props])
        self.assertEqual(len(props), 4)

    def test_property_dtype(self):
        # add some system properties and ensure they were added correctly
        self.db.add_property("natoms", 10, dtype="int")
        p = self.db.get_property("natoms")
        self.assertEqual(p.value(), 10)
        self.db.add_property("eps", 2.1, dtype="float")
        p = self.db.get_property("eps")
        self.assertEqual(p.value(), 2.1)
        self.db.add_property("author", "Jake", dtype="string")
        p = self.db.get_property("author")
        self.assertEqual(p.value(), "Jake")
        self.db.add_property("data", [1, 2], dtype="pickle")
        p = self.db.get_property("data")
        self.assertEqual(p.value(), [1, 2])

    def test_bad_property(self):
        self.db.add_property("natoms", 10, dtype="string")
        p = self.db.get_property("natoms")
        self.assertEqual(p.value(), "10")

    def test_property_overwrite_false(self):
        self.db.add_property("natoms", 10)
        # overwriting with the same value should not raise error
        self.db.add_property("natoms", 10, overwrite=False) 
        # overwriting with a different value should raise error
        with self.assertRaises(RuntimeError):
            self.db.add_property("natoms", 11, overwrite=False)
    
    
    def test_add_properties(self):
        props = dict(natoms=10, author="jake")
        self.db.add_properties(props)
        for name, value in props.iteritems():
            p = self.db.get_property(name)
            self.assertEqual(p.value(), value)
    
    def test_load_wrong_schema(self):
        current_dir = os.path.dirname(__file__)
        dbname = current_dir + "/lj6_schema1.sqlite"
        with self.assertRaises(IOError):
            db = Database(dbname, createdb=False)
    
    def test_load_right_schema(self):
        current_dir = os.path.dirname(__file__)
        dbname = current_dir + "/lj6_schema2.sqlite"
        db = Database(dbname, createdb=False)
    
    def test_invalid(self):
        m = self.db.minima()[0]
        self.assertFalse(m.invalid)
        m.invalid = True
        self.db.session.commit()
        self.assertTrue(m.invalid)
        
        # now with a ts
        m = self.db.transition_states()[0]
        self.assertFalse(m.invalid)
        m.invalid = True
        self.db.session.commit()
        self.assertTrue(m.invalid)
    
    def test_user_data(self):
        m = self.db.minima()[0]
        m.user_data = dict(key="value")
        self.db.session.commit()
        v = m.user_data["key"]
        
        # now with a transition state
        m = self.db.transition_states()[0]
        m.user_data = dict(key="value")
        self.db.session.commit()
        v = m.user_data["key"]
Пример #19
0
sysAmb  = AMBERSystem('../aladipep/coords.prmtop', '../aladipep/coords.inpcrd')
    
# load existing database 
from pele.storage import Database
dbcurr = Database(db="../aladipep/aladipep.db")
                            
# ------ Test potential 
print 'testing potential in ambSystem' 
sysAmb.test_potential("../aladipep/coords.pdb")
    
# ------ BH 
print 'testing BH' 
nsteps = 1
sysAmb.test_BH(dbcurr, nsteps)

for minimum in dbcurr.minima():
    print minimum._id, minimum.energy    

# -- test connect 
dbcurr = Database(db="aladipep.db")
sysAmb.test_connect(dbcurr) 


#print "---------id, m1_id, m2_id, tsener"
#for ts in dbcurr.transition_states() :
#    print ts._id, ts._minimum1_id, ts._minimum2_id,  ts.energy      
            
# connect to existing db 
#    sysOpenMM.create_database(db=dbcurr)   

Пример #20
0
    # calculation.
    minima = db.session.query(Minimum).filter(Minimum.energy <= Emax)
    g.add_nodes_from(minima)
    # if we order by energy first and add the transition states with the largest
    # the we will take the smallest energy transition state in the case of duplicates
    ts = db.session.query(TransitionState).filter(TransitionState.energy <= Emax)\
                                          .order_by(-TransitionState.energy)
    for t in ts:
        g.add_edge(t.minimum1, t.minimum2, ts=t)
    return g


if __name__ == "__main__":

    db = Database("lj31.db", createdb=False)
    if len(db.minima()) < 2:
        raise Exception("database has no minima")

    if True:
        from pele.systems import LJCluster
        from pele.thermodynamics import get_thermodynamic_information
        system = LJCluster(31)
        get_thermodynamic_information(system, db, nproc=10)

    app = QApplication(sys.argv)
    md = DGraphDialog(db)
    md.show()
    md.rebuild_disconnectivity_graph()

    sys.exit(app.exec_())
Пример #21
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")
Пример #22
0
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
Пример #23
0

if __name__ == "__main__":
    p = 5
    N = 20
    #run_gui(N, p)

    #event_after_step = lambda energy, coords, acceptstep : normalize_spins(coords)
    #event_after_step=[event_after_step]
    if False:
        system = MeanFieldPSpinSphericalSystem(N, p=p)
        db = system.create_database("pspin_spherical_p{}_N{}.sqlite".format(
            p, N))
        bh = system.get_basinhopping(database=db, outstream=None)
        bh.run(100)

    if True:
        run_gui_db(dbname="pspin_spherical_p{}_N{}.sqlite".format(p, N))

    if False:
        compare_minima = lambda m1, m2: compare_exact(
            m1.coords, m2.coords, rel_tol=1e-7, debug=False)
        db = Database("pspin_spherical_p{}_N{}.sqlite".format(p, N))
        minima = db.minima()
        minima.sort(key=lambda m: m.energy)
        #for m in minima:
        #    print m.energy, m.coords
        print(minima[0].energy, minima[0].coords)
        print(minima[1].energy, minima[1].coords)
        print(compare_minima(minima[0], minima[1]))
Пример #24
0
#path = [ x for x in InterpolatedPath(path[0].copy(), path[-1].copy(), 34) ]
traj = open("traj.xyz", "w")
#for x in path:
#    #export_xyz(traj, x)
#    #ret = quench.mylbfgs(x, pot.getEnergyGradient)
#    #print i,pot.getEnergy(x), ret[1]
#
#    # export_xyz(traj, ret[0])
for x in path:
    export_xyz(traj, x)

import pickle
pickle.dump(path, open("interpolate.pickle", "w"))
exit()
db = Database(db="oxdna.sqlite")
path[0] = db.minima()[19].coords
path[-1] = db.minima()[0].coords

e1 = []
e2 = []

e1.append(pot.getEnergy(path[0]))
e2.append(pot.getEnergy(path[0]))

#for i in xrange(1):
for i in range(len(path) - 1):
    e1.append(pot.getEnergy(path[i + 1]))
    c1 = CoordsAdapter(nrigid=13, coords=path[i])
    c2 = CoordsAdapter(nrigid=13, coords=path[i + 1])
    com1 = np.sum(c1.posRigid, axis=0) / float(13)
    com2 = np.sum(c1.posRigid, axis=0) / float(13)
Пример #25
0
class TestConnectManager(unittest.TestCase):
    def setUp(self):
        self.db = Database()
        self.nminima = 10
        for i in range(self.nminima):
            e = float(i)
            self.db.addMinimum(e, [e])

    def connect_min(self, m1, m2):
        e = np.random.uniform(0,100)
        self.db.addTransitionState(e, [e], m1, m2)

    def test_gmin(self):
        manager = ConnectManager(self.db, strategy="gmin")
        m0 = self.db.minima()[0]
        
        for i in range(5):
            m1, m2 = manager.get_connect_job()
            self.assertEqual(m1, m0)
            self.connect_min(m1, m2)
    
    def test_random(self):
        manager = ConnectManager(self.db, strategy="random")
        
        for i in range(5):
            m1, m2 = manager.get_connect_job()
            self.connect_min(m1, m2)
        
    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 test_untrap(self):
        # first connect them all randomly
        manager = ConnectManager(self.db, strategy="random")
        while True:
            try:
                m1, m2 = manager.get_connect_job()
            except manager.NoMoreConnectionsError:
                break
            self.connect_min(m1, m2)
        
        for i in range(5):
            try:
                m1, m2 = manager.get_connect_job(strategy="untrap")
            except manager.NoMoreConnectionsError:
                break
            self.connect_min(m1, m2)
Пример #26
0
    # calculation.
    minima = db.session.query(Minimum).filter(Minimum.energy <= Emax)
    g.add_nodes_from(minima)
    # if we order by energy first and add the transition states with the largest
    # the we will take the smallest energy transition state in the case of duplicates
    ts = db.session.query(TransitionState).filter(TransitionState.energy <= Emax)\
                                          .order_by(-TransitionState.energy)
    for t in ts: 
        g.add_edge(t.minimum1, t.minimum2, ts=t)
    return g


if __name__ == "__main__":
    
    db = Database("lj31.db", createdb=False)
    if len(db.minima()) < 2:
        raise Exception("database has no minima")
    
    if True:
        from pele.systems import LJCluster
        from pele.thermodynamics import get_thermodynamic_information
        system = LJCluster(31)
        get_thermodynamic_information(system, db, nproc=10)
        
    
    app = QApplication(sys.argv)        
    md = DGraphDialog(db)
    md.show()
    md.rebuild_disconnectivity_graph()
    
    sys.exit(app.exec_()) 
Пример #27
0
coords1 = np.genfromtxt("coords.A")
coords2 = np.genfromtxt("coords.B")
res1 = lbfgs_py(coords1.reshape(-1), pot)
res2 = lbfgs_py(coords2.reshape(-1), pot)
coords1 = res1.coords
coords2 = res2.coords
E1 = res1.energy
E2 = res2.energy
natoms = len(coords1) / 3

# add the minima to a database
dbfile = "database.sqlite"
database = Database(dbfile)
database.addMinimum(E1, coords1)
database.addMinimum(E2, coords2)
min1 = database.minima()[0]
min2 = database.minima()[1]




# set up the structural alignment routine.
# we have to deal with global translational, global rotational,
# and permutational symmetry.
permlist = [range(natoms)]
mindist = MinPermDistAtomicCluster(permlist=permlist, niter=10)

# The transition state search needs to know what the eigenvector corresponding
# to the lowest nonzero eigenvector is.  For this we need to know what the
# eivenvector corresponding to the zero eigenvalues are.  These are related
# to global symmetries.  for this system we have 3 zero eigenvalues for translational
Пример #28
0
                             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")
ax.spines['left'].set_linewidth(10.0)
dg_lj.plot(linewidth=2., axes=ax, ylinewidth=1.5, xmin_offset=0.15)
#ylabel='Potential Energy')

plt.subplots_adjust(left=0.2, right=0.95, top=0.95, bottom=0.1)

dg_lj.draw_minima(db_lj.minima(),
                  marker='o',
                  c='black',
                  s=50.0,
                  linewidths=2.0,
                  alpha=1)

dg_amp.calculate()
colors = []
ms = []

for m in db_amp.minima()[0:]:
    colors.append('red')
    ms.append([m])
print len(colors)
dg_amp.color_by_group(ms, colors=colors)
Пример #29
0
class TestDB(unittest.TestCase):
    def setUp(self):
        self.db = Database()
        self.nminima = 10
        for i in range(self.nminima):
            e = float(i)
            self.db.addMinimum(e, [e])

        self.nts = 3
        self.db.addTransitionState(0., [0.],
                                   self.db.minima()[0],
                                   self.db.minima()[1],
                                   eigenval=0.,
                                   eigenvec=[0.])
        self.db.addTransitionState(0., [0.],
                                   self.db.minima()[1],
                                   self.db.minima()[2],
                                   eigenval=0.,
                                   eigenvec=[0.])
        self.db.addTransitionState(0., [0.],
                                   self.db.minima()[0],
                                   self.db.minima()[2],
                                   eigenval=0.,
                                   eigenvec=[0.])

    def test_add_minimum(self):
        # add a duplicate minimum and ensure the db doesn't change
        self.db.addMinimum(0, [0])
        self.assertEqual(self.db.number_of_minima(), self.nminima)

    def test_size(self):
        self.assertEqual(len(self.db.minima()), self.nminima)

    def test_energy(self):
        m = self.db.minima()[0]
        self.assertEqual(m.energy, 0.)

    def test_coords(self):
        m = self.db.minima()[0]
        self.assertEqual(m.coords, [0.])

    def test_sizets(self):
        self.assertEqual(len(self.db.transition_states()), self.nts)

    def test_energyts(self):
        ts = self.db.transition_states()[0]
        self.assertEqual(ts.energy, 0.)

    def test_coordsts(self):
        ts = self.db.transition_states()[0]
        self.assertEqual(ts.coords, [0.])

    def test_remove_minimum(self):
        m = self.db.minima()[0]
        self.db.removeMinimum(m)
        self.assertEqual(len(self.db.minima()), self.nminima - 1)
        self.assertNotIn(m, self.db.minima())

        # m should have 2 minima.  both of those should be gone
        self.assertEqual(len(self.db.transition_states()), self.nts - 2)

    def test_remove_ts(self):
        ts = self.db.transition_states()[0]
        self.db.remove_transition_state(ts)
        self.assertEqual(self.db.number_of_transition_states(), self.nts - 1)
        self.assertNotIn(ts, self.db.transition_states())

        # m should have 2 minima.  both of those should be gone
        self.assertEqual(self.db.number_of_minima(), self.nminima)

    def test_getTransitionState(self):
        m1 = self.db.minima()[0]
        m2 = self.db.minima()[1]
        m3 = self.db.minima()[-1]
        self.assertIsNotNone(self.db.getTransitionState(m1, m2))
        self.assertIsNone(self.db.getTransitionState(m1, m3))

    def test_getMinimum(self):
        m = self.db.minima()[0]
        self.assertEqual(m, self.db.getMinimum(m._id))

    def test_minimum_adder(self):
        ma = self.db.minimum_adder()
        ma(101., [101.])
        self.assertEqual(len(self.db.minima()), self.nminima + 1)

    def test_minimum_adder_Ecut(self):
        ma = self.db.minimum_adder(Ecut=0)
        n0 = self.db.number_of_minima()
        ma(101., [101.])
        self.assertEqual(n0, self.db.number_of_minima())
        ma(-101., [-101.])
        self.assertEqual(n0 + 1, self.db.number_of_minima())

    def test_minimum_adder_commit_interval(self):
        ma = self.db.minimum_adder(commit_interval=2)
        # replace db.session.commit with a wrapper that keeps track of how
        # many times it's been called
        self.real_commit = self.db.session.commit
        self.count = 0

        def commit_wrapper():
            self.count += 1
            self.real_commit()

        self.db.session.commit = commit_wrapper
        # commit should be called for the first minimum
        ma(101., [101.])
        self.assertEqual(self.count, 1)
        self.assertEqual(self.nminima + 1, self.db.number_of_minima())
        # commit should not be called for the second minimum
        ma(102., [102.])
        self.assertEqual(self.count, 1)
        self.assertEqual(self.nminima + 2, self.db.number_of_minima())
        # yes for the third, no for the 4th
        ma(103., [103.])
        self.assertEqual(self.count, 2)
        ma(104., [104.])
        self.assertEqual(self.count, 2)
        # commit should be called when minimum adder is deleted
        del ma
        self.assertEqual(self.count, 3)
        self.assertEqual(self.nminima + 4, self.db.number_of_minima())

    def test_merge_minima(self):
        m1 = self.db.minima()[0]
        m2 = self.db.minima()[1]
        self.db.mergeMinima(m1, m2)
        self.assertEqual(len(self.db.minima()), self.nminima - 1)
        # transition states shouldn't be deleted
        self.assertEqual(len(self.db.transition_states()), self.nts)

    def test_number_of_minima(self):
        self.assertEqual(self.nminima, self.db.number_of_minima())

    def test_number_of_transition_states(self):
        self.assertEqual(self.nts, self.db.number_of_transition_states())

    def test_highest_energy_minimum(self):
        m1 = self.db._highest_energy_minimum()
        m2 = self.db.minima()[-1]
        self.assertEqual(m1, m2)

    def test_maximum_number_of_minima(self):
        m = self.db.addMinimum(-1., [-1.], max_n_minima=self.nminima)
        self.assertEqual(self.nminima, self.db.number_of_minima())
        self.assertIn(m, self.db.minima())

    def test_maximum_number_of_minima_largestE(self):
        e = float(self.nminima + 1)
        m = self.db.addMinimum(e, [e], max_n_minima=self.nminima)
        self.assertEqual(self.nminima, self.db.number_of_minima())
        self.assertIsNone(m)

        #ensure the highest energy minimum is still in the database
        mmax = self.db._highest_energy_minimum()
        self.assertEqual(mmax.energy, float(self.nminima - 1))

    def test_maximum_number_of_minima_minima_adder(self):
        ma = self.db.minimum_adder(max_n_minima=self.nminima)
        m = ma(-1., [-1.])
        self.assertEqual(self.nminima, self.db.number_of_minima())
        self.assertIn(m, self.db.minima())

    def test_getTSfromID(self):
        ts = self.db.transition_states()[0]
        ts1 = self.db.getTransitionStateFromID(ts._id)
        self.assertEqual(ts, ts1)

    def test_property(self):
        # add some system properties and ensure they were added correctly
        self.db.add_property("natoms", 10)
        p = self.db.get_property("natoms")
        self.assertEqual(p.value(), 10)
        self.db.add_property("eps", 2.1)
        p = self.db.get_property("eps")
        self.assertEqual(p.value(), 2.1)
        self.db.add_property("author", "Jake")
        p = self.db.get_property("author")
        self.assertEqual(p.value(), "Jake")
        self.db.add_property("data", [1, 2])
        p = self.db.get_property("data")
        self.assertEqual(p.value(), [1, 2])

        # assert that the not set values are None
        p = self.db.get_property("natoms")
        self.assertIsNone(p.string_value)
        self.assertIsNone(p.float_value)
        self.assertIsNone(p.pickle_value)

        p = self.db.get_property("noprop")
        self.assertIsNone(p)

        props = self.db.properties(as_dict=True)
        self.assertIsInstance(props, dict)
        self.assertDictContainsSubset(dict(natoms=10), props)
        self.assertEqual(len(list(props.items())), 4)

        props = self.db.properties(as_dict=False)
        self.assertIn(("natoms", 10), [p.item() for p in props])
        self.assertEqual(len(props), 4)

    def test_property_dtype(self):
        # add some system properties and ensure they were added correctly
        self.db.add_property("natoms", 10, dtype="int")
        p = self.db.get_property("natoms")
        self.assertEqual(p.value(), 10)
        self.db.add_property("eps", 2.1, dtype="float")
        p = self.db.get_property("eps")
        self.assertEqual(p.value(), 2.1)
        self.db.add_property("author", "Jake", dtype="string")
        p = self.db.get_property("author")
        self.assertEqual(p.value(), "Jake")
        self.db.add_property("data", [1, 2], dtype="pickle")
        p = self.db.get_property("data")
        self.assertEqual(p.value(), [1, 2])

    def test_bad_property(self):
        self.db.add_property("natoms", 10, dtype="string")
        p = self.db.get_property("natoms")
        self.assertEqual(p.value(), "10")

    def test_property_overwrite_false(self):
        self.db.add_property("natoms", 10)
        # overwriting with the same value should not raise error
        self.db.add_property("natoms", 10, overwrite=False)
        # overwriting with a different value should raise error
        with self.assertRaises(RuntimeError):
            self.db.add_property("natoms", 11, overwrite=False)

    def test_add_properties(self):
        props = dict(natoms=10, author="jake")
        self.db.add_properties(props)
        for name, value in props.items():
            p = self.db.get_property(name)
            self.assertEqual(p.value(), value)

    def test_load_wrong_schema(self):
        current_dir = os.path.dirname(__file__)
        dbname = current_dir + "/lj6_schema1.sqlite"
        with self.assertRaises(IOError):
            db = Database(dbname, createdb=False)

    def test_load_right_schema(self):
        current_dir = os.path.dirname(__file__)
        dbname = current_dir + "/lj6_schema2.sqlite"
        db = Database(dbname, createdb=False)

    def test_invalid(self):
        m = self.db.minima()[0]
        self.assertFalse(m.invalid)
        m.invalid = True
        self.db.session.commit()
        self.assertTrue(m.invalid)

        # now with a ts
        m = self.db.transition_states()[0]
        self.assertFalse(m.invalid)
        m.invalid = True
        self.db.session.commit()
        self.assertTrue(m.invalid)

    def test_user_data(self):
        m = self.db.minima()[0]
        m.user_data = dict(key="value")
        self.db.session.commit()
        v = m.user_data["key"]

        # now with a transition state
        m = self.db.transition_states()[0]
        m.user_data = dict(key="value")
        self.db.session.commit()
        v = m.user_data["key"]
Пример #30
0
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