Exemple #1
0
import matplotlib.pyplot as plt
import matplotlib.cm  as cm
from MAST.structopt_stem.tools.StemCalc import ConvStem
from MAST.structopt_stem.generate.gen_pop_box import gen_pop_box as gpb
from MAST.structopt_stem 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()
Exemple #2
0
    A = ConvStem(parameters=autostemparameters, calc_exp=False)
    try:
        atoms_ref = inp_out.read_xyz(parameters['stem_ref'], 0)
    except KeyError:
        atoms_ref = inp_out.read_xyz(
            '/home/usitguest/USIT/dropbox_app/STEM_ref', 0)

    nk = autostemparameters['Pixels']
    A.psf = np.empty([nk, nk], dtype=float)
    try:
        fileobj = open(parameters['psf'], 'r')
    except KeyError:
        fileobj = open('/home/usitguest/USIT/dropbox_app/PSF.txt', 'r')
    lines = fileobj.readlines()
    for x in range(0, nk):
        A.psf[x] = lines[x].split()
    fileobj.close()

    STEM_ref = A.get_image(A.psf, atoms_ref, autostemparameters['Slice size'],
                           autostemparameters['Pixels'])

    parameters['stem_parameters'] = autostemparameters
    autostemparameters['Exp_Image'] = STEM_ref
    autostemparameters['Grid_sim2exp'] = 1
    autostemparameters['Pixelshift'] = False
else:
    parameters = None
parameters = MPI.COMM_WORLD.bcast(parameters, root=0)
C = Optimizer(parameters)
C.run()
Exemple #3
0
    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

if rank == 0:
    print 'Running parallel...'
    parameters['filename'] = 'Test-Parallel'
    parameters['parallel'] = True
    A = Optimizer(parameters)
else:
    A = None
A = MPI.COMM_WORLD.bcast(A, root=0)
Exemple #4
0
            'fusslimit' : 5,
            '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'
Exemple #5
0
def main():
    from MAST.structopt_stem import Optimizer
    from MAST.structopt_stem 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()
Exemple #6
0
def main():
    from MAST.structopt_stem import Optimizer
    from MAST.structopt_stem 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()
Exemple #7
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()
Exemple #8
0
            parameters['stem_ref'] = ast.literal_eval(data[line].strip())['stem_ref']
    '''
    A = ConvStem(parameters=autostemparameters,calc_exp=False)
    try:
        atoms_ref=inp_out.read_xyz(parameters['stem_ref'],0)
    except KeyError:
        atoms_ref=inp_out.read_xyz('/home/usitguest/USIT/dropbox_app/STEM_ref',0)

    nk = autostemparameters['Pixels']
    A.psf = np.empty([nk,nk],dtype=float)
    try:
        fileobj = open(parameters['psf'], 'r')
    except KeyError:
        fileobj = open('/home/usitguest/USIT/dropbox_app/PSF.txt', 'r')
    lines = fileobj.readlines()
    for x in range(0,nk):
       A.psf[x] = lines[x].split()
    fileobj.close()

    STEM_ref = A.get_image(A.psf, atoms_ref, autostemparameters['Slice size'], autostemparameters['Pixels'])
    
    parameters['stem_parameters']=autostemparameters
    autostemparameters['Exp_Image'] = STEM_ref
    autostemparameters['Grid_sim2exp'] = 1
    autostemparameters['Pixelshift'] = False
else:
    parameters=None
parameters = MPI.COMM_WORLD.bcast(parameters,root=0)
C = Optimizer(parameters)
C.run()
Exemple #9
0
            '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()
                   
Exemple #10
0
from MAST.structopt_stem 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()