autostemparameters['Grid_sim2exp'] = 1 autostemparameters['Pixelshift'] = False parameters={'structure':'Cluster', 'optimizer_type':'GA', 'atomlist':[('Au',1,196.9665,-3.6)],'natoms': 309, 'nindiv': 60, 'maxgen': 100, 'reqrep': 10, 'restart': True, 'generate_flag': 'sphere', 'tolerance': 0.01, 'r_ab': 2.5, 'size': 23.0, 'cxpb': 0.8, 'mutpb': 0.2, 'cx_scheme': 'cxtp', #rotct_rand', 'mutation_options': ['lattice_alteration','lattice_alteration_group','rotation','stem_mutation','zp_rotation'], 'selection_scheme': 'tournament2', 'natural_selection_scheme': 'fuss', 'tournsize': 3, 'fusslimit': 10, 'convergence_scheme': 'gen-rep-min', 'fingerprinting': False, 'predator': 'fitpred', 'demin': 0.05, 'pair_style': 'eam', 'pot_file': 'Au_u3.eam', 'filename': 'Output', 'lammps_keep_files': True, 'lammps_min': '1e-8 1e-8 5000 10000', 'lammps_min_style': 'cg\nmin_modify line quadratic', 'lammps_thermo_steps': 1000, 'genealogy': True, 'allenergyfile': True, 'best_inds_list': True, 'postprocessing': True, 'parallel': True, 'energy_cutoff_factor': 4.0, 'stem_keep_files': False, 'stem_coeff': 10.0 } parameters['stem_parameters']=autostemparameters parameters['fitness_scheme']='stem_cost' else: parameters=None parameters = MPI.COMM_WORLD.bcast(parameters,root=0) C = Optimizer(parameters) C.run()
def main(): from MAST.structopt import Optimizer from MAST.structopt import tools #Test for cluster structures parameters = { 'structure': 'Cluster', 'optimizer_type': 'GA', 'atomlist': [('Au', 10, 0, 0), ('Cu', 10, 0, 0)] } A = Optimizer(parameters) A.algorithm_initialize() A.calc = tools.setup_calculator(A) offspring = A.generation_set([]) indiv = offspring[0].duplicate() ind1 = offspring[1].duplicate() ind2 = offspring[2].duplicate() test_mutations(indiv) test_cx(ind1, ind2) A.close_output() #Test for defect structures parameters = { 'structure': 'Defect', 'optimizer_type': 'GA', 'atomlist': [('Au', 3, 0, 0), ('Cu', 3, 0, 0)], 'supercell': (3, 3, 3), 'SolidFile': 'BFe.xyz', 'SolidCell': [8.61, 8.61, 8.61] } A = Optimizer(parameters) A.algorithm_initialize() A.calc = tools.setup_calculator(A) offspring = A.generation_set([]) indiv = offspring[0].duplicate() ind1 = offspring[1].duplicate() ind2 = offspring[2].duplicate() test_mutations(indiv) test_cx(ind1, ind2) A.close_output() #Test for crystal structures parameters = { 'structure': 'Crystal', 'optimizer_type': 'GA', 'atomlist': [('Au', 10, 0, 0), ('Cu', 10, 0, 0)] } A = Optimizer(parameters) A.algorithm_initialize() A.calc = tools.setup_calculator(A) offspring = A.generation_set([]) indiv = offspring[0].duplicate() ind1 = offspring[1].duplicate() ind2 = offspring[2].duplicate() test_mutations(indiv) test_cx(ind1, ind2) A.close_output()
True, 'LammpsMin': '1e-8 1e-8 5000 10000', 'Lmin_style': 'cg\nmin_modify line quadratic', 'genealogy': True, 'allenergyfile': True, 'BestIndsList': True } if rank == 0: print 'Running Serial...' parameters['filename'] = 'Test-Serial' A = Optimizer(parameters) A.run() done = True else: done = False done = MPI.COMM_WORLD.bcast(done, root=0) print done print 'Running parallel...' parameters['filename'] = 'Test-Parallel' parameters['parallel'] = True A = Optimizer(parameters) A.algorithm_parallel() print 'Running Island_Method' parameters['filename'] = 'Test-IM'
'forcing': 'Concentration', 'calc_method': 'LAMMPS', 'pair_style':'eam/fs', 'pot_file':'Fe_mm.eam.fs', 'lammps_thermo_steps':100, 'keep_Lammps_files': True, 'ase_min': False, 'lammps_min': mincomd, 'lammps_min_style': 'cg\nmin_modify line quadratic', 'genealogy': True, 'output_format': 'FormationEnergyPerInt', 'allenergyfile':True, 'bestindslist': True, 'finddefects':True, 'parallel' : True, 'algorithm_type' : 'lambda+mu', 'debug':['None']} bsfe = BCC('Fe', size=parameters['supercell']) rank = MPI.COMM_WORLD.Get_rank() if rank==0: write(parameters['SolidFile'],bsfe) cell=numpy.maximum.reduce(bsfe.get_cell()) parameters['SolidCell']=cell A = Optimizer(parameters) A.algorithm_parallel() if __name__ == "__main__": main()
'lammps_min': '1e-8 1e-8 5000 10000', 'lammps_min_style': 'cg\nmin_modify line quadratic', 'lammps_thermo_steps': 1000, 'genealogy': True, 'allenergyfile': True, 'best_inds_list': True, 'postprocessing': True, 'parallel': True, 'energy_cutoff_factor': 4.0, 'stem_keep_files': False, 'stem_coeff': 10.0 } parameters['stem_parameters'] = autostemparameters parameters['fitness_scheme'] = 'stem_cost' else: parameters = None parameters = MPI.COMM_WORLD.bcast(parameters, root=0) C = Optimizer(parameters) C.run()
'Aperture semiangle': 24.5, 'Source size': 0.882, 'Slice size': 20.0, 'Pixels': 800, 'aber': aber, 'Scale Factor': 0.00570113 } A = ConvStem(parameters=autostemparameters, calc_exp=False) #fig = plt.figure() #ax = fig.add_subplot(111) #psf = numpy.fft.fftshift(A.psf) #ax.imshow(psf,cmap=cm.hot) #plt.show() imAu1 = A.get_image(A.psf, Au1, autostemparameters['Slice size'], autostemparameters['Pixels'], 1) #fig2 = plt.figure() #ax2 = fig2.add_subplot(111) #ax2.imshow(imAu1,cmap=cm.hot) #plt.show() autostemparameters['Exp_Image'] = imAu1 optparameters = { 'structure': 'Cluster', 'optimizer_type': 'BH', 'size': 10, 'atomlist': [('Au', 10, 0, 0), ('Cu', 10, 0, 0)], 'FIT_SCHEME': 'STEM_Cost', 'STEM_Parameters': autostemparameters } B = Optimizer(optparameters) B.algorithm_serial()
from MAST.structopt import Optimizer from mpi4py import MPI rank = MPI.COMM_WORLD.Get_rank() if rank==0: print 'Running Serial...' A = Optimizer('input-clus.txt') A.run() done = True else: done = False done = MPI.COMM_WORLD.bcast(done,root=0) print done print 'Running parallel...' A = Optimizer('input-clus-p.txt') A.run() print 'Running Island_Method' A = Optimizer('input-clus-im.txt') A.run()
#import matplotlib.pyplot as plt #import matplotlib.cm as cm from MAST.structopt.tools.StemCalc import ConvStem from MAST.structopt.generate.gen_pop_box import gen_pop_box as gpb from MAST.structopt import Optimizer import numpy size = 10.0 Au1 = gpb([('Au',10,0,0),('Cu',10,0,0)],size) aber=[[0,0],[0,0],[22.56,-20.1],[22.08,-7.5],[0.1198,0],[0.9018,-170.1],[0.04964,20.9],[28.43,-120.6],[11.84,153.8],[8.456,76.1],[0.622,0],[2.811,-125.5]] autostemparameters={'Electron energy': 200,'Spherical aberration': 1.4,'Defocus':0,'Aperture semiangle': 24.5,'Source size': 0.882,'Slice size': 20.0,'Pixels':800,'aber':aber,'Scale Factor':0.00570113} A = ConvStem(parameters=autostemparameters,calc_exp=False) #fig = plt.figure() #ax = fig.add_subplot(111) #psf = numpy.fft.fftshift(A.psf) #ax.imshow(psf,cmap=cm.hot) #plt.show() imAu1 = A.get_image(A.psf, Au1, autostemparameters['Slice size'], autostemparameters['Pixels'], 1) #fig2 = plt.figure() #ax2 = fig2.add_subplot(111) #ax2.imshow(imAu1,cmap=cm.hot) #plt.show() autostemparameters['Exp_Image'] = imAu1 optparameters = {'structure': 'Cluster', 'optimizer_type': 'BH', 'size':10,'atomlist': [('Au', 10, 0, 0), ('Cu', 10, 0, 0)],'FIT_SCHEME':'STEM_Cost','STEM_Parameters':autostemparameters} B = Optimizer(optparameters) B.algorithm_serial()
"convergence_scheme": "Gen-Rep-Min", "predator": "Mutation_Dups", "mutation_options": ["Lattice_Alteration", "Lattice_Alteration_Group", "Rotation_geo", "Rotation"], "pair_style": "eam", "pot_file": "Au_u3.eam", "keep_Lammps_files": True, "LammpsMin": "1e-8 1e-8 5000 10000", "Lmin_style": "cg\nmin_modify line quadratic", "genealogy": True, "allenergyfile": True, "BestIndsList": True, } if rank == 0: print "Running Serial..." parameters["filename"] = "Test-Serial" A = Optimizer(parameters) A.run() done = True else: done = False done = MPI.COMM_WORLD.bcast(done, root=0) print done print "Running parallel..." parameters["filename"] = "Test-Parallel" parameters["parallel"] = True A = Optimizer(parameters) A.algorithm_parallel() print "Running Island_Method"
def main(): from MAST.structopt import Optimizer from MAST.structopt import tools #Test for cluster structures parameters = {'structure':'Cluster','optimizer_type': 'GA','atomlist':[('Au', 10, 0, 0), ('Cu', 10, 0, 0)]} A = Optimizer(parameters) A.algorithm_initialize() A.calc = tools.setup_calculator(A) offspring = A.generation_set([]) indiv = offspring[0].duplicate() ind1 = offspring[1].duplicate() ind2 = offspring[2].duplicate() test_mutations(indiv) test_cx(ind1,ind2) A.close_output() #Test for defect structures parameters = {'structure':'Defect','optimizer_type': 'GA','atomlist':[('Au', 3, 0, 0), ('Cu', 3, 0, 0)],'supercell':(3,3,3),'SolidFile':'BFe.xyz','SolidCell':[8.61, 8.61, 8.61]} A = Optimizer(parameters) A.algorithm_initialize() A.calc = tools.setup_calculator(A) offspring = A.generation_set([]) indiv = offspring[0].duplicate() ind1 = offspring[1].duplicate() ind2 = offspring[2].duplicate() test_mutations(indiv) test_cx(ind1,ind2) A.close_output() #Test for crystal structures parameters = {'structure':'Crystal','optimizer_type': 'GA','atomlist':[('Au', 10, 0, 0), ('Cu', 10, 0, 0)]} A = Optimizer(parameters) A.algorithm_initialize() A.calc = tools.setup_calculator(A) offspring = A.generation_set([]) indiv = offspring[0].duplicate() ind1 = offspring[1].duplicate() ind2 = offspring[2].duplicate() test_mutations(indiv) test_cx(ind1,ind2) A.close_output()