def get_compare_exact(self, **kwargs): if self.pot.periodic: permlist = self.get_permlist() boxlengths = np.ones(3) * self.pot.boxl measure = MeasurePeriodic(boxlengths, permlist) return ExactMatchPeriodic(measure, accuracy=.1) else: return BLJCluster.get_compare_exact(self, **kwargs)
class TestBLJClusterSystem(unittest.TestCase): def setUp(self): self.natoms = 13 self.ntypeA = 8 self.system = BLJCluster(self.natoms, self.ntypeA) def test_database_property(self): db = self.system.create_database() p = db.get_property("natoms") self.assertIsNotNone(p) self.assertEqual(p.value(), self.natoms) p = db.get_property("ntypeA") self.assertIsNotNone(p) self.assertEqual(p.value(), self.ntypeA)
def setUp(self): self.natoms = 13 self.ntypeA = 8 self.system = BLJCluster(self.natoms, self.ntypeA)
def draw(self, coordslinear, index): from pele.systems._opengl_tools import draw_box put_in_box(coordslinear, self.boxvec) BLJCluster.draw(self, coordslinear, index, subtract_com=False) draw_box(self.boxvec)
# only testing below here # def start(): wnd.start() if __name__ == "__main__": from OpenGL.GLUT import glutInit import sys import pylab as pl app = QtGui.QApplication(sys.argv) from pele.systems import LJCluster, BLJCluster pl.ion() natoms = 13 system = BLJCluster(natoms) system.params.double_ended_connect.local_connect_params.NEBparams.iter_density = 5. dbname = "lj%dtest.db" % (natoms,) db = system.create_database()#dbname) #get some minima if True: bh = system.get_basinhopping(database=db) bh.run(20) minima = db.minima() else: x1, e1 = system.get_random_minimized_configuration()[:2] x2, e2 = system.get_random_minimized_configuration()[:2] min1 = db.addMinimum(e1, x1) min2 = db.addMinimum(e2, x2) minima = [min1, min2]
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)