Example #1
0
import numpy as np
from src.runmc import mc_cython

from lj_run import LJClusterNew, MonteCarloCompiled
from nested_sampling import MonteCarloChain
from pele.takestep import RandomDisplacement
from pele.utils.xyz import write_xyz

system = LJClusterNew(31)

x = system.get_random_configuration()

with open("test.xyz", "w") as fout:
    write_xyz(fout, x)

mciter = 100000
stepsize = .01
Emax = 1e20
radius = 2.5

mcc = MonteCarloCompiled(system, radius)
mcc(x.copy(), mciter, stepsize, Emax)
print mcc.naccept, mcc.nsteps, mcc.energy

takestep = RandomDisplacement(stepsize=stepsize)
mc = MonteCarloChain(system.get_potential(), x.copy(), takestep, Emax,
                     system.get_config_tests())
for i in xrange(mciter):
    mc.step()
print mc.naccept, mc.nsteps, mc.energy
Example #2
0
import numpy as np

from lj_run import LJClusterNew
from pygmin.takestep import RandomDisplacement, AdaptiveStepsize, Reseeding

if __name__ == "__main__":
    natoms = 75
    system = LJClusterNew(natoms)
    
    ts = RandomDisplacement(stepsize=0.42)
    takestep = AdaptiveStepsize(ts)
    takestep = Reseeding(takestep,system.get_random_configuration(),maxnoimprove=80)

    label = "lj%d" % (natoms)
    dbname = label + ".db"
    db = system.create_database(dbname)
    bh = system.get_basinhopping(database=db, takestep=ts, temperature=0.45, insert_rejected=True)
    bh.run(1000000)
        

    
    
Example #3
0
from lj_run import LJClusterNew
import sys
from pele.landscape import Graph

natoms = int(sys.argv[1])
dbname = sys.argv[2]

system = LJClusterNew(natoms)
db = system.create_database(dbname)

while True:
    min1 = db.minima()[0]

    graph = Graph(db)

    all_connected = True
    for m2 in db.minima()[1:]:
        if not graph.areConnected(min1, m2):
            all_connected = False
            break
    if all_connected:
        print "minima are all connected, ending"
        exit(1) 

    connect = system.get_double_ended_connect(min1, m2, db, fresh_connect=True, load_no_distances=True)
    connect.connect()


Example #4
0
def build_lj_nested_sampling(system, db):
    from pele.takestep import RandomDisplacement
    nreplicas = 20
    mciter = 10000
    nminima = 10000
    minima = db.minima()
    if len(minima) > nminima:
        minima = minima[:nminima]
    takestep = RandomDisplacement(stepsize=0.5)
    accept_tests = system.get_config_tests()
    ns = NestedSamplingBS(system,
                          nreplicas,
                          takestep,
                          minima,
                          mciter=mciter,
                          accept_tests=accept_tests)
    return ns


if __name__ == "__main__":
    from lj_run import LJClusterNew
    natoms = 31
    system = LJClusterNew(31)

    dbname = "lj%d.db" % (natoms)
    db = system.create_database(dbname)

    ns = build_lj_nested_sampling(system, db)

    run_gui(system, ns)
Example #5
0
        onset_prob = self.onset_prob_func(Emax)
        prob = onset_prob / float(self.nreplicas)
        for i in range(len(configs)):
            if np.random.uniform(0, 1) < prob:
                x, energy = self.get_starting_configuration_minima(Emax)
                configs[i] = Replica(x, energy, from_random=False)
                if self.verbose:
                    print "sampling from minima, E minimum:", energy, "with probability:", prob
        return configs


if __name__ == "__main__":
    # define the system
    from lj_run import LJClusterNew
    natoms = 13
    system = LJClusterNew(natoms)

    db = system.create_database("lj%d.db" % (natoms))
    #    if True:
    #        populate_database(system, db, niter=100)

    print "pgorder", db.minima()[0].pgorder
    print "fvib", db.minima()[0].fvib
    get_thermodynamic_information(system, db)
    print "pgorder", db.minima()[0].pgorder
    print "fvib", db.minima()[0].fvib

    Emin = db.minima()[0].energy
    Emax = Emin + 1.

    k = system.k
Example #6
0
File: ns_gui.py Project: js850/sens
#    refresh_timer.timeout.connect(refresh_pl)
#    refresh_timer.start(0.)
#    
#    myapp.show()
#    sys.exit(app.exec_())

def build_lj_nested_sampling(system, db):
    from pele.takestep import RandomDisplacement
    nreplicas = 20
    mciter = 10000
    nminima = 10000
    minima = db.minima()
    if len(minima) > nminima:
        minima = minima[:nminima]
    takestep = RandomDisplacement(stepsize=0.5)
    accept_tests = system.get_config_tests()
    ns = NestedSamplingBS(system, nreplicas, takestep, minima, mciter=mciter, accept_tests=accept_tests)
    return ns

if __name__ == "__main__":
    from lj_run import LJClusterNew
    natoms = 31
    system = LJClusterNew(31)

    dbname = "lj%d.db" % (natoms)
    db = system.create_database(dbname)

    ns = build_lj_nested_sampling(system, db)

    run_gui(system, ns)
Example #7
0
from lj_run import LJClusterNew
import sys
from pele.landscape import Graph

natoms = int(sys.argv[1])
dbname = sys.argv[2]

system = LJClusterNew(natoms)
db = system.create_database(dbname)

while True:
    min1 = db.minima()[0]

    graph = Graph(db)

    all_connected = True
    for m2 in db.minima()[1:]:
        if not graph.areConnected(min1, m2):
            all_connected = False
            break
    if all_connected:
        print "minima are all connected, ending"
        exit(1)

    connect = system.get_double_ended_connect(min1,
                                              m2,
                                              db,
                                              fresh_connect=True,
                                              load_no_distances=True)
    connect.connect()
Example #8
0
from pele.gui import run_gui
from lj_run import LJClusterNew
import sys

natoms = int(sys.argv[1])
dbname = sys.argv[2]

#natoms = 31
system = LJClusterNew(natoms)
#label = "lj%d" % (natoms)
#dbname = label + ".db"
run_gui(system, dbname)
#db = system.create_database(dbname)
Example #9
0
import numpy as np
from src.runmc import mc_cython

from lj_run import LJClusterNew, MonteCarloCompiled
from nested_sampling import MonteCarloChain
from pele.takestep import RandomDisplacement
from pele.utils.xyz import write_xyz

system = LJClusterNew(31)


x = system.get_random_configuration()

with open("test.xyz", "w") as fout:
    write_xyz(fout, x)


mciter = 100000
stepsize = 0.01
Emax = 1e20
radius = 2.5

mcc = MonteCarloCompiled(system, radius)
mcc(x.copy(), mciter, stepsize, Emax)
print mcc.naccept, mcc.nsteps, mcc.energy


takestep = RandomDisplacement(stepsize=stepsize)
mc = MonteCarloChain(system.get_potential(), x.copy(), takestep, Emax, system.get_config_tests())
for i in xrange(mciter):
    mc.step()
Example #10
0
File: _sens.py Project: js850/sens
        # from the minima with probability prob
        onset_prob = self.onset_prob_func(Emax)
        prob = onset_prob / float(self.nreplicas)
        for i in range(len(configs)):
            if np.random.uniform(0,1) < prob:
                x, energy = self.get_starting_configuration_minima(Emax)
                configs[i] = Replica(x, energy, from_random=False)
                if self.verbose:
                    print "sampling from minima, E minimum:", energy, "with probability:", prob
        return configs

if __name__ == "__main__":
    # define the system
    from lj_run import LJClusterNew
    natoms = 13
    system = LJClusterNew(natoms)

    db = system.create_database("lj%d.db" % (natoms))
#    if True:
#        populate_database(system, db, niter=100)
    
    print "pgorder", db.minima()[0].pgorder
    print "fvib", db.minima()[0].fvib
    get_thermodynamic_information(system, db)
    print "pgorder", db.minima()[0].pgorder
    print "fvib", db.minima()[0].fvib
    
    Emin = db.minima()[0].energy
    Emax = Emin + 1.

    k = system.k