def test_gui(): from pele.gui import run_gui nmol = 5 system = OTPCluster(nmol) run_gui(system)
def run_gui_nodisorder(L=24): from pele.gui import run_gui dim = [L, L] system = XYModlelSystem(dim=dim, phi_disorder=0.) system.params.basinhopping.temperature = 10. dbname = "xy_%dx%d_nodisorder.sqlite" % (L, L) run_gui(system, db=dbname)
def start_gui(): from pele.systems import MorseCluster from pele.gui import run_gui natoms = 13 system = MorseCluster(13, rho=1.6047, r0=2.8970, A=0.7102) run_gui(system)
def rungui(): from pele.gui import run_gui natoms = 17 # system = MorseCluster(natoms, rho=1.6047, r0=2.8970, A=0.7102) system = MorseCluster(natoms, rho=3., r0=1., A=1.) db = system.create_database() run_gui(system)
def run_gui_nodisorder(L=24): from pele.gui import run_gui dim=[L,L] system = XYModlelSystem(dim=dim, phi_disorder=0.) system.params.basinhopping.temperature=10. dbname="xy_%dx%d_nodisorder.sqlite" %(L,L) run_gui(system, db=dbname)
def main(): parser = argparse.ArgumentParser(description=desc, formatter_class=argparse.RawDescriptionHelpFormatter) # parser.add_argument('--ndof', help='Number of total degrees of freedom (e.g. 3*number of atoms). This is simply the length of a coordinates vector.', # type=int, default=1) # parser.add_argument('--Database','-d', help = 'Name of database to write into', type = str, default="optimdb.sqlite") # parser.add_argument('--Mindata','-m', help = 'Name of min.data file', type = str, default="min.data") # parser.add_argument('--Tsdata','-t', help = 'Name of ts.data file', type = str, default="ts.data") # parser.add_argument('--Pointsmin','-p', help = 'Name of points.min file', type = str, default="points.min") # parser.add_argument('--Pointsts','-q', help = 'Name of points.ts file', type = str, default="points.ts") parser.add_argument('--endianness', help = 'set the endianness of the binary data. Can be "<" for little-endian or ">" for big-endian', type = str, default="=") args = parser.parse_args() system = AMBERSystem(prmtopFname="coords.prmtop", inpcrdFname="coords.inpcrd") db = system.create_database() converter = OptimDBConverter(db, mindata="min.data", tsdata="ts.data", pointsmin="points.min", pointsts="points.ts", endianness=args.endianness) converter.convert() # system.get_ndof = lambda : args.ndof run_gui(system, db=db) print db.number_of_minima()
def main(): parser = argparse.ArgumentParser( description=desc, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument( '--ndof', help= 'Number of total degrees of freedom (e.g. 3*number of atoms). This is simply the length of a coordinates vector.', type=int, default=1) # parser.add_argument('--Database','-d', help = 'Name of database to write into', type = str, default="optimdb.sqlite") # parser.add_argument('--Mindata','-m', help = 'Name of min.data file', type = str, default="min.data") # parser.add_argument('--Tsdata','-t', help = 'Name of ts.data file', type = str, default="ts.data") # parser.add_argument('--Pointsmin','-p', help = 'Name of points.min file', type = str, default="points.min") # parser.add_argument('--Pointsts','-q', help = 'Name of points.ts file', type = str, default="points.ts") # parser.add_argument('--endianness', help = 'set the endianness of the binary data. Can be "<" for little-endian or ">" for big-endian', type = str, default="=") args = parser.parse_args() system = BaseSystem() db = system.create_database() converter = OptimDBConverter(db, mindata="min.data", tsdata="ts.data", pointsmin="points.min", pointsts="points.ts", endianness="=", assert_coords=False) converter.convert_no_coords() system.get_ndof = lambda: args.ndof run_gui(system, db=db) print(db.number_of_minima())
def test_gui(): # pragma: no cover from pele.gui import run_gui nmol = 20 boxvec = np.array([6,6,6]) rcut = 2.5 system = OTPBulk(nmol, boxvec, rcut) run_gui(system)
def main(): natoms = 8 system = LJClusterFrozen2D(natoms) db = system.create_database() from pele.gui import run_gui run_gui(system, db=db)
def rungui(): # pragma: no cover from pele.gui import run_gui natoms = 17 # system = MorseCluster(natoms, rho=1.6047, r0=2.8970, A=0.7102) system = MorseCluster(natoms, rho=3., r0=1., A=1.) db = system.create_database() run_gui(system, db)
def test_gui(): # pragma: no cover from pele.gui import run_gui nmol = 324 boxvec = np.ones(3)*10.06355661335453 rcut = 2.614 system = OTPBulk(nmol, boxvec, rcut) run_gui(system)
def rungui(): from pele.gui import run_gui natoms = 17 boxl = 2. boxvec = np.ones(3) * boxl # system = MorseCluster(natoms, rho=1.6047, r0=2.8970, A=0.7102, rcut=9.5) system = MorseBulk(natoms, boxvec, rho=3., r0=1., A=1.) db = system.create_database() run_gui(system)
def rungui(): from pele.gui import run_gui natoms = 17 boxl = 10. boxvec = np.ones(3) * boxl system = SuttonChenBulk(natoms, rcut=30000.2, boxvec=boxvec, c=144.41, n=12, m=6) # system = MorseBulk(natoms, boxvec, rho=3., r0=1., A=1.) db = system.create_database() run_gui(system)
def run_gui_db(dbname="xy_10x10.sqlite"): from pele.gui import run_gui from pele.storage import Database try: db = Database(dbname, createdb=False) phases = db.get_property("phases").value() except IOError: phases = None system = XYModlelSystem(dim=[10, 10], phi_disorder=np.pi, phases=phases) run_gui(system, db=dbname)
def rungui(): # pragma: no cover from pele.gui import run_gui natoms = 17 boxl = 2. boxvec = np.ones(3) * boxl # system = MorseCluster(natoms, rho=1.6047, r0=2.8970, A=0.7102, rcut=9.5) system = BLJBulk(natoms, boxvec) db = system.create_database() run_gui(system, db)
def run_gui_db(dbname="xy_10x10.sqlite"): from pele.gui import run_gui from pele.storage import Database try: db = Database(dbname, createdb=False) phases = db.get_property("phases").value() except IOError: phases=None system = XYModlelSystem(dim=[10,10], phi_disorder=np.pi, phases=phases) run_gui(system, db=dbname)
def test(): from pele.gui import run_gui natoms = 13 fsys = LJCluster(natoms) reference_coords = fsys.get_random_configuration() frozen_atoms = [0,2,3,4] system = LJClusterFrozen(natoms, frozen_atoms, reference_coords) run_gui(system)
def rungui(): # pragma: no cover from pele.gui import run_gui natoms = 17 boxl = 2. boxvec = np.ones(3) * boxl # system = MorseCluster(natoms, rho=1.6047, r0=2.8970, A=0.7102, rcut=9.5) system = MorseBulk(natoms, boxvec, rho=3., r0=1., A=1.) db = system.create_database() run_gui(system, db)
def rungui(): from pele.gui import run_gui system = HeisenbergSystem(field_disorder=3.1, disorder=True) # system = HeisenbergSystem(field_disorder=0., disorder=False) # x = system.get_random_configuration() # print system.get_metric_tensor(x) # return # bh = system.get_basinhopping() # bh.run(10) run_gui(system)
def test(): # pragma: no cover from pele.gui import run_gui natoms = 13 fsys = LJCluster(natoms) reference_coords = fsys.get_random_configuration() frozen_atoms = [0, 2, 3, 4] system = LJClusterFrozen(natoms, frozen_atoms, reference_coords) run_gui(system)
def run_gui_db(dbname="pspin_spherical_p3_N20.sqlite"): from pele.gui import run_gui try: db = Database(dbname, createdb=False) interactions = db.get_property("interactions").value() nspins = db.get_property("nspins").value() p = db.get_property("p").value() except IOError: interactions=None system = MeanFieldPSpinSphericalSystem(nspins, p=p, interactions=interactions) run_gui(system, db=dbname)
def rungui(): # pragma: no cover from pele.gui import run_gui natoms = 40 boxl = 3. boxvec = np.ones(3) * boxl fsys = BLJBulk(natoms, boxvec) # system = MorseCluster(natoms, rho=1.6047, r0=2.8970, A=0.7102, rcut=9.5) reference_coords = fsys.get_random_configuration() frozen_atoms = [0, 2, 3, 4, natoms - 1] system = BLJBulkFrozen(natoms, boxvec, reference_coords, frozen_atoms) print(system.ntypeA) db = system.create_database() run_gui(system, db)
def rungui(): # pragma: no cover from pele.gui import run_gui natoms = 40 boxl = 3. boxvec = np.ones(3) * boxl fsys = BLJBulk(natoms, boxvec) # system = MorseCluster(natoms, rho=1.6047, r0=2.8970, A=0.7102, rcut=9.5) reference_coords = fsys.get_random_configuration() frozen_atoms = [0, 2, 3, 4, natoms-1] system = BLJBulkFrozen(natoms, boxvec, reference_coords, frozen_atoms) print(system.ntypeA) db = system.create_database() run_gui(system, db)
def main(): """ load training data""" inputs = np.loadtxt("../handwriting/X2_100samples.dat") targets = np.loadtxt("../handwriting/y2_100samples.dat") """ define network topology """ conec = mlgraph((inputs.shape[1], 10, 1)) # reg = 0.1 reg = False net = ffnet(conec) system = NNSystem(net, inputs, targets, reg=reg) database = system.create_database( # db="/home/ab2111/machine_learning_landscapes/neural_net/db_ffnet_100samples_reg"+str(reg) +".sqlite" db="../db/db_ffnet_100samples.sqlite") run_gui(system, database)
def run_gui_db(dbname="regression_logit_mnist.sqlite", scale=2.5, device='cpu'): from pele.gui import run_gui try: db = Database(dbname, createdb=False) x_train_data=db.get_property("x_train_data").value(), y_train_data=db.get_property("y_train_data").value(), hnodes=db.get_property("hnodes").value(), reg=db.get_property("reg").value(), except IOError: pass hnodes, reg = hnodes[0], reg[0] x_train_data, y_train_data = np.array(np.array(x_train_data)[0,:,:]), np.array(np.array(y_train_data)[0,:,:]) print np.array(x_train_data).shape, np.array(y_train_data).shape # system = Mlp3System(x_train_data, y_train_data, hnodes, reg=reg, device=device) system = Elu2NNSystem(x_train_data, y_train_data, hnodes, reg=reg, scale=scale, device=device) run_gui(system, db=dbname)
def rungui(): # pragma: no cover import os from pele.gui import run_gui dbfname = "test24.sqlite" if os.path.isfile(dbfname): system, db = create_soft_sphere_system_from_db(dbfname) else: natoms = 24 boxl = 3 boxvec = np.ones(3) * boxl # system = MorseCluster(natoms, rho=1.6047, r0=2.8970, A=0.7102, rcut=9.5) radii = np.ones(natoms) * .6 radii += np.random.uniform(-1,1,radii.size) * 1e-1 system = SoftSphereSystem(radii, boxvec, power=2.5) db = system.create_database("test24.sqlite") run_gui(system, db)
def main(): """ load training data""" inputs = np.loadtxt("../handwriting/X2_100samples.dat") targets = np.loadtxt("../handwriting/y2_100samples.dat") """ define network topology """ conec = mlgraph((inputs.shape[1],10,1)) # reg = 0.1 reg=False net = ffnet(conec) system = NNSystem(net, inputs, targets, reg=reg) database = system.create_database( # db="/home/ab2111/machine_learning_landscapes/neural_net/db_ffnet_100samples_reg"+str(reg) +".sqlite" db="../db/db_ffnet_100samples.sqlite" ) run_gui(system, database)
def rungui(): # pragma: no cover from pele.gui import run_gui import random import math natoms = 256 boxl = 6.2 c = 0.10 boxvec = np.ones(3) * boxl fsys = BLJBulk(natoms, boxvec) # system = MorseCluster(natoms, rho=1.6047, r0=2.8970, A=0.7102, rcut=9.5) reference_coords = fsys.get_random_configuration() # frozen_atoms = [0, 2, 3, 4, natoms-1] frozen_atoms = random.sample(xrange(natoms),int(math.floor(c*natoms))) system = BLJBulkFrozen(natoms, boxvec, reference_coords, frozen_atoms) print system.ntypeA db = system.create_database() run_gui(system, db)
def main(): parser = argparse.ArgumentParser( description="do nested sampling on a 3 layer elu neural network") # NN variables parser.add_argument("dbname", type=str, help="database name") parser.add_argument("--scale", type=float, help="scale for stepsize and random sampling", default=1) parser.add_argument("--dtype", type=str, help="data type (recommended float32)", default='float32') parser.add_argument("--device", type=str, help="device on which TensorFlow should run", default='cpu') args = parser.parse_args() print args # NN parameters dbname = os.path.abspath(args.dbname) scale = args.scale dtype, device = args.dtype, args.device db, (trX, trY, hnodes, hnodes2, reg) = get_database_params(dbname) system = create_system(trX, trY, hnodes, hnodes2, reg=reg, scale=scale, dtype=dtype, device=device) run_gui(system, db)
def main(): parser = argparse.ArgumentParser( description="do nested sampling on a 3 layer elu neural network") # psping variables parser.add_argument("dbname", type=str, help="database name") parser.add_argument("--dtype", type=str, help="data type (recommended float64)", default='float64') parser.add_argument("--device", type=str, help="device on which TensorFlow should run", default='cpu') args = parser.parse_args() print args # pspin parameters dbname = os.path.abspath(args.dbname) dtype, device = args.dtype, args.device db, (nspins, p, interactions) = get_database_params(dbname) system = create_system(nspins, p, interactions, dtype=dtype, device=device) run_gui(system, db)
epsB=0.01, epsA=0.01, sigA=1.3, sigB=1.3, sigAB=1., boxl=boxl, only_AB_neibs=only_AB_neibs) #system.params.basinhopping.outstream = None if only_AB_neibs: onlyAB = "_onlyAB" else: onlyAB = "" if periodic: textboxl = "_boxl%.2f" % boxl else: textboxl = "" dbname = "blj_N%d_NA%d_n%d%s%s_rneib%.2f_newsig.db" % ( natoms, ntypeA, max_neibs, textboxl, onlyAB, rneib) print(dbname) gui = True if gui: run_gui(system, db=dbname) else: db = system.create_database(dbname) bh = system.get_basinhopping(database=db) bh.run(1000000)
super(MagneticColloidSystem, self).__init__(natoms) self.natoms = natoms self.box = box def get_potential(self): return MagneticColloidPotential(self.natoms, self.box) def get_compare_exact(self, **kwargs): raise NotImplementedError def get_mindist(self, **kwargs): raise NotImplementedError if __name__ == "__main__": natoms = 10 box = np.array([10., 10., 10.]) pot = MagneticColloidPotential(natoms, box) coords = np.random.uniform(0, 1, 3 * natoms) * 2. print "starting potential" e, grad = pot.getEnergyGradient(coords) print "finished potential" print e pot.test_potential(coords) system = MagneticColloidSystem(natoms, box) from pele.gui import run_gui run_gui(system)
def run_gui(): from pele.gui import run_gui system = MeanFieldPSpinSphericalSystem(20, p=3) run_gui(system)
def run_gui(): from pele.gui import run_gui system = XYModlelSystem(dim=[24,24], phi_disorder=np.pi) run_gui(system)
import numpy as np from pele.systems import LJCluster from pele.gui import run_gui natoms = 38 system = LJCluster(natoms) pot = system.get_potential() db = system.create_database() x1 = np.genfromtxt("lj{}_m1".format(natoms)).ravel() #x2 = np.genfromtxt("lj{}_m2".format(natoms)).ravel() x2 = np.genfromtxt("lj{}_m3".format(natoms)).ravel() db.addMinimum(pot.getEnergy(x1), x1) db.addMinimum(pot.getEnergy(x2), x2) run_gui(system, db)
system = MaxNeibsBLJSystem(natoms, ntypeA=ntypeA, max_neibs=max_neibs, neib_crossover=.3, rneib=rneib, epsneibs=6., epsAB=1., epsB=0.01, epsA=0.01, sigA=1.3, sigB=1.3, sigAB=1., boxl=boxl, only_AB_neibs=only_AB_neibs) #system.params.basinhopping.outstream = None if only_AB_neibs: onlyAB = "_onlyAB" else: onlyAB = "" if periodic: textboxl = "_boxl%.2f" % boxl else: textboxl = "" dbname = "blj_N%d_NA%d_n%d%s%s_rneib%.2f_newsig.db" %(natoms, ntypeA, max_neibs, textboxl, onlyAB, rneib) print dbname gui = True if gui: run_gui(system, db=dbname) else: db=system.create_database(dbname) bh = system.get_basinhopping(database=db) bh.run(1000000)
def run_gui(N, p): from pele.gui import run_gui system = MeanFieldPSpinSphericalSystem(N, p=p) run_gui(system)
print np.max(x), np.min(x) m.coords = x db.session.commit() def run_gui(): from pele.gui import run_gui system = MeanFieldPSpinSphericalSystem(20, p=3) run_gui(system) #def run_gui_db(dbname="xy_10x10.sqlite"): # from pele.gui import run_gui # from pele.storage import Database # try: # db = Database(dbname, createdb=False) # phases = db.get_property("phases").value() # except IOError: # phases=None # system = XYModlelSystem(dim=[10,10], phi_disorder=np.pi, phases=phases) # run_gui(system, db=dbname) if __name__ == "__main__": run_gui() # test_potential() # from pele.storage import Database # db = Database("20x20_no_disorder.sqlite") # normalize_spins_db(db) # run_gui_db() # run_gui_nodisorder()
def test_gui(): from pele.gui import run_gui nmol = 4 system = PlateFolder(nmol) db = system.create_database("tetrahedra.sqlite") run_gui(system, db)
def test_gui(): from pele.gui import run_gui nmol = 7 system = OTPCluster(nmol) run_gui(system)
def rungui_from_db(dbname): from pele.gui import run_gui system, db, x0 = create_frozenblj_system_from_db(dbname) run_gui(system, db)
def on_buttonBox_accepted(self): self.get_input() self.close() def on_buttonBox_rejected(self): self.close() if __name__ == "__main__": # create a pop up window to get the number of atoms app = QtGui.QApplication(sys.argv) dialog = BLJDialog() dialog.exec_() if dialog.natoms is None: sys.exit() print dialog.ntypeA, "A atoms interacting with eps", dialog.epsAA, "sig", dialog.sigAA print dialog.natoms - dialog.ntypeA, "B atoms interacting with eps", dialog.epsBB, "sig", dialog.sigBB print "The A and B atoms interact with eps", dialog.epsAB, "sig", dialog.sigAB # create the system and start the gui # (note: since the application is already started we need to pass it to run_gui) system = BLJCluster(dialog.natoms, dialog.ntypeA, sigAB=dialog.sigAB, epsAB=dialog.epsAB, sigBB=dialog.sigBB, epsBB=dialog.epsBB, ) run_gui(system, application=app)
def run_gui(): from pele.gui import run_gui system = XYModlelSystem(dim=[24, 24], phi_disorder=np.pi) run_gui(system)
m.coords = x db.session.commit() def run_gui(): from pele.gui import run_gui system = MeanFieldPSpinSphericalSystem(20, p=3) run_gui(system) #def run_gui_db(dbname="xy_10x10.sqlite"): # from pele.gui import run_gui # from pele.storage import Database # try: # db = Database(dbname, createdb=False) # phases = db.get_property("phases").value() # except IOError: # phases=None # system = XYModlelSystem(dim=[10,10], phi_disorder=np.pi, phases=phases) # run_gui(system, db=dbname) if __name__ == "__main__": run_gui() # test_potential() # from pele.storage import Database # db = Database("20x20_no_disorder.sqlite") # normalize_spins_db(db) # run_gui_db() # run_gui_nodisorder()
from pele.potentials.maxneib_blj import MaxNeibsBLJ, MaxNeibsBLJSystem from pele.gui import run_gui natoms = 20 ntypeA = natoms/2 max_neibs = 4.5 system = MaxNeibsBLJSystem(natoms, ntypeA=ntypeA, max_neibs=max_neibs, rneib=1.7, epsneibs=12., epsAB=1., epsB=0.01, epsA=0.01, neib_crossover=.05) dbname = "blj_N%d_NA%d_n%d.db" %(natoms, ntypeA, max_neibs) run_gui(system)#, db=dbname)
def rungui(): from pele.gui import run_gui natoms = 13 system = GuptaCluster(natoms) db = system.create_database() run_gui(system)
from pele.potentials.maxneib_blj import MaxNeibsBLJ, MaxNeibsBLJSystem from pele.gui import run_gui natoms = 20 ntypeA = natoms / 2 max_neibs = 4.5 system = MaxNeibsBLJSystem( natoms, ntypeA=ntypeA, max_neibs=max_neibs, rneib=1.7, epsneibs=12.0, epsAB=1.0, epsB=0.01, epsA=0.01, neib_crossover=0.05, ) dbname = "blj_N%d_NA%d_n%d.db" % (natoms, ntypeA, max_neibs) run_gui(system) # , db=dbname)
def on_buttonBox_accepted(self): self.get_input() self.close() def on_buttonBox_rejected(self): self.close() if __name__ == "__main__": # create a pop up window to get the number of atoms app = QtGui.QApplication(sys.argv) dialog = BLJDialog() dialog.exec_() if dialog.natoms is None: sys.exit() print(dialog.ntypeA, "A atoms interacting with eps", dialog.epsAA, "sig", dialog.sigAA) print(dialog.natoms - dialog.ntypeA, "B atoms interacting with eps", dialog.epsBB, "sig", dialog.sigBB) print("The A and B atoms interact with eps", dialog.epsAB, "sig", dialog.sigAB) # create the system and start the gui # (note: since the application is already started we need to pass it to run_gui) system = BLJCluster(dialog.natoms, dialog.ntypeA, sigAB=dialog.sigAB, epsAB=dialog.epsAB, sigBB=dialog.sigBB, epsBB=dialog.epsBB, ) run_gui(system, application=app)
def rungui(): from pele.gui import run_gui sys = LJCluster(31) db = sys.create_database() run_gui(sys, db)