예제 #1
0
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()
예제 #2
0
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()
예제 #3
0
'''
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()
예제 #4
0
'''
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()