class GATest(unittest.TestCase): def setUp(self): natoms = 10 minimiser = PeleMinimiser(lj.LJ()) self.ga = GeneticAlgorithm(natoms, minimiser, max_generation=2) def tearDown(self): os.remove("restart.xyz") def test_run(self): #For now, just run and see that there are no exceptions. self.ga.run()
class GATest(unittest.TestCase): def setUp(self): natoms=10 minimiser=PeleMinimiser(lj.LJ()) self.ga=GeneticAlgorithm(natoms,minimiser,max_generation=2) def tearDown(self): os.remove("restart.xyz") def test_run(self): #For now, just run and see that there are no exceptions. self.ga.run()
''' Example input file for PyBCGA-DFT using NWChem. Note that this is a very short run on a trivially small system because DFT calculations are computationally expensive. @author: Mark Oakley ''' from bcga.genetic_algorithm import GeneticAlgorithm from bcga.nwchem_interface import NWMinimiser myga = GeneticAlgorithm(natoms=3, minimiser=NWMinimiser(basis='6-31G',xc='b3lyp'), labels=["He"], pop_size=3, offspring=1, max_generation=1, mutant_rate=0.0) myga.run()
''' A simple GA run. We use a 38 atom Lennard-Jones in this example. The natoms argument defines the number of atoms in the cluster and is required for all GA searchs. The minimiser object is also needed to perform the energy evaluations. This example uses a simple Lennard-Jones minimiser. Other examples show how to set up minimisers for more complicated potentials. @author: Mark Oakley ''' from bcga.genetic_algorithm import GeneticAlgorithm import pele.potentials.lj as lj from bcga.pele_interface import PeleMinimiser myga = GeneticAlgorithm( natoms=38, # Number of atoms minimiser=PeleMinimiser(lj.LJ())) #Energy minimisation method myga.run()
''' Example input file for PyBCGA-DFT using NWChem. Note that this is a very short run on a trivially small system because DFT calculations are computationally expensive. @author: Mark Oakley ''' from bcga.genetic_algorithm import GeneticAlgorithm from bcga.nwchem_interface import NWMinimiser myga = GeneticAlgorithm(natoms=3, minimiser=NWMinimiser(basis='6-31G', xc='b3lyp'), labels=["He"], pop_size=3, offspring=1, max_generation=1, mutant_rate=0.0) myga.run()
def setUp(self): natoms = 10 minimiser = PeleMinimiser(lj.LJ()) self.ga = GeneticAlgorithm(natoms, minimiser, max_generation=2)
def setUp(self): natoms=10 minimiser=PeleMinimiser(lj.LJ()) self.ga=GeneticAlgorithm(natoms,minimiser,max_generation=2)
''' Example PyBCGA input for a binary Lennard-Jones cluster. @author: Mark Oakley ''' from bcga.genetic_algorithm import GeneticAlgorithm from pele.potentials import BLJCut from bcga.pele_interface import PeleMinimiser natoms = 13 ntypea = 5 ntypeb = 8 myga = GeneticAlgorithm(natoms=natoms, minimiser=PeleMinimiser(BLJCut(natoms, ntypea)), composition=[ntypea, ntypeb], labels=["A", "B"], remove_duplicates=True, max_generation=50) myga.run()
''' Example input file for PyBCGA-DFT using GPAW. @author: Mark Oakley ''' from bcga.genetic_algorithm import GeneticAlgorithm from bcga.gpaw_interface import GPAWMinimiser from gpaw import PW natoms = 4 minimiser=GPAWMinimiser(mode=PW(),xc="PBE") myga = GeneticAlgorithm(natoms,minimiser, labels=["Ag","Au"], composition=[2,2], pop_size=10, offspring=8, max_generation=1, mutant_rate=0.1) myga.run() #myga.write_xyz()