def make_struc(formula, spacegroup, sc=1): """ Creates the crystal structure using ASE. :param alat: Lattice parameter in angstrom :return: structure object converted from ase """ #src_dir = 'bronze' if('Cu' in formula) else 'steel' src_dir = 'base' cif_in = read("./{}_cifs/{}_{}.cif".format(src_dir, formula, spacegroup)) supercell = make_supercell(cif_in, [[sc, 0, 0], [0, sc, 0], [0, 0, sc]]) structure = Struc(ase2struc(supercell)) #structure = make_supercell(structure, [[sc,0,0],[0,sc,0],[0,0,sc]]) #fecell = bulk('Fe', cell, a=alat) #fecell = make_supercell(fecell, [[2,0,0],[0,2,0],[0,0,2]]) # check how your cell looks like #write('s.cif', gecell) #if(cell == 'bcc' and (mag=='non' or mag=='ferro')): # fecell.set_atomic_numbers([26,26,26,26,26,26,26,26]) # print(fecell) #elif(cell == 'bcc' and mag == 'anti'): # fecell.set_atomic_numbers([26,27,26,27,26,27,26,27]) # print(fecell) #else: #fecell.set_atomic_numbers([26, 27,26,27,26,27,26,27,26, 27,26,27,26,27,26,27]) # print(fecell) #structure = Struc(ase2struc(fecell)) #print(structure.species) return structure
def make_struc(): slab_ideal=fcc110('Au',size=(4,2,8), a=4.163737636, vacuum=20) #slab_ideal=fcc110('Au',size=(4,8,i), vacuum=20) write('slab_ideal.struct',slab_ideal) slab_ideal.edit() #natoms_100=(len(slab_100.numbers)) #print ('positions',slab_ideal.positions) natoms_ideal=len(slab_ideal.positions) #print(natoms_ideal) struc_ideal=Struc(ase2struc(slab_ideal)) return natoms_ideal,struc_ideal
def make_struc(formula, spacegroup, sc=1): """ Creates the crystal structure using ASE. :param alat: Lattice parameter in angstrom :return: structure object converted from ase """ #src_dir = 'bronze' if('Cu' in formula) else 'steel' src_dir = 'bronze' if (('C' in formula) and ('S' in formula)) else 'base' cif_in = read("./{}_cifs/{}_{}.cif".format(src_dir, formula, spacegroup)) supercell = make_supercell(cif_in, [[sc, 0, 0], [0, sc, 0], [0, 0, sc]]) structure = Struc(ase2struc(supercell)) return structure
def make_struc(alat): """ Creates the crystal structure using ASE. :param alat: Lattice parameter in angstrom :return: structure object converted from ase """ unitcell = crystal('Au', [(0, 0, 0)], spacegroup=225, cellpar=[alat, alat, alat, 90, 90, 90]) #unitcell.edit() natoms_unitcell=(len(unitcell.numbers)) print('number of atoms in the bulk is', natoms_unitcell) structure = Struc(ase2struc(unitcell)) return structure
def make_struc(alat): """ Creates the crystal structure using ASE. :param alat: Lattice parameter in angstrom :return: structure object converted from ase """ unitcell = crystal('Al', [(0, 0, 0)], spacegroup=225, cellpar=[alat, alat, alat, 90, 90, 90]) #multiplier = numpy.identity(3) * 2 #ase_supercell = make_supercell(unitcell, multiplier) structure = Struc(ase2struc(unitcell)) return structure
def make_struc(alat): """ Creates the crystal structure using ASE. :param alat: Lattice parameter in angstrom :return: structure object converted from ase """ fecell = bulk('Fe', 'hcp', a=alat) # check how your cell looks like #write('s.cif', gecell) print(fecell, fecell.get_atomic_numbers()) fecell.set_atomic_numbers([26, 27]) structure = Struc(ase2struc(fecell)) print(structure.species) return structure
def make_struc(alat, displacement=0): """ Creates the crystal structure using ASE. :param alat: Lattice parameter in angstrom :return: structure object converted from ase """ lattice = alat * numpy.identity(3) symbols = ['Pb', 'Ti', 'O', 'O', 'O'] sc_pos = [[0,0,0], [0.5,0.5,0.5 + displacement], [0,0.5,0.5], [0.5,0,0.5], [0.5,0.5,0]] perov = Atoms(symbols=symbols, scaled_positions=sc_pos, cell=lattice) # check how your cell looks like # write('s.cif', perov) structure = Struc(ase2struc(perov)) return structure
def make_struc(size): """ Creates the crystal structure using ASE. :param size: supercell multiplier :return: structure object converted from ase """ alat = 4.10 unitcell = crystal('Al', [(0, 0, 0)], spacegroup=225, cellpar=[alat, alat, alat, 90, 90, 90]) multiplier = numpy.identity(3) * size supercell = make_supercell(unitcell, multiplier) structure = Struc(ase2struc(supercell)) return structure
def make_struc(alat): """ Creates the crystal structure using ASE. :param alat: Lattice parameter in angstrom :return: structure object converted from ase """ # set primitive_cell=False if you want to create a simple cubic unit cell with 8 atoms gecell = crystal('Ge', [(0, 0, 0)], spacegroup=227, cellpar=[alat, alat, alat, 90, 90, 90], primitive_cell=True) # check how your cell looks like # write('s.cif', gecell) structure = Struc(ase2struc(gecell)) return structure
def make_struc(size): """ Creates the crystal structure using ASE. :param size: supercell multiplier :return: structure object converted from ase """ alat = 5.1 lattice = alat * numpy.identity(3) symbols = ['Ag', 'I', 'Ag', 'I'] sc_positions = [[1 / 2, 0, 1 / 4], [0, 0, 0], [1, 1 / 2, 3 / 4], [1 / 2, 1 / 2, 1 / 2]] unitcell = Atoms(symbols=symbols, scaled_positions=sc_positions, cell=lattice) multiplier = numpy.identity(3) * size supercell = make_supercell(unitcell, multiplier) structure = Struc(ase2struc(supercell)) return structure
def make_struc(i): slab_ideal = fcc110('Au', size=(16, 16, 40), a=4.0800000183054, vacuum=i) #slab_ideal=fcc110('Au',size=(4,8,i), vacuum=20) write('slab_ideal.struct', slab_ideal) #slab_ideal.edit() #natoms_100=(len(slab_100.numbers)) list_z = [ slab_ideal.positions[i][2] for i in range(len(slab_ideal.positions)) ] min_z = min(list_z) list_x_top_row = [] for i in range(len(slab_ideal.positions)): if slab_ideal.positions[i][2] == min_z: list_x_top_row.append(slab_ideal.positions[i][0]) list_x_top_row_concise = list(set(list_x_top_row)) list_x_top_row_concise.sort() select_list_x = list_x_top_row_concise[ 1::2] #this slices list_x_top_row_concise using even index atoms_to_delete = [] atoms_to_delete_index = [] for i in range(len(slab_ideal.positions)): if slab_ideal.positions[i][ 0] in select_list_x and slab_ideal.positions[i][2] == min_z: atoms_to_delete.append(slab_ideal.positions[i]) atoms_to_delete_index.append(i) atoms_to_delete_index.sort() atoms_to_delete_index.reverse() #to delete atoms in slab to create the 1*2 missing row reconstruction for i in atoms_to_delete_index: slab_ideal.pop(i) #slab_ideal.edit() #print('list of atoms is',slab_ideal.positions) #print('list_x_top_row',list_x_top_row) #print('list_x_top_row_concise',list_x_top_row_concise) #print ('min z is',min_z) #print('select_list_x',select_list_x) #print('atoms_to_delete',atoms_to_delete) print('atoms_to_delete_index', atoms_to_delete_index) natoms_ideal = len(slab_ideal.positions) print('number of atoms left', natoms_ideal) struc_ideal = Struc(ase2struc(slab_ideal)) return natoms_ideal, struc_ideal