def make_fcc_stacking_fault(symbols, stacking_sequence): # use ASE to make fcc 111 oriented cell direction_x = [1, 2, -1] direction_y = [1, -1, 0] direction_z = [1, 1, 0] ase_fcc_111 = FaceCenteredCubic(\ directions=[direction_x,direction_y,direction_z], size=size, symbol=symbols[0], pbc=pbc) ase_lattice = ase_fcc_111.get_cell() for a in ase_fcc_111: for i in range(3): a.position[i] = round(a.position[i], 8) z_layers = [] for a in ase_fcc_111: if a.position[2] not in z_layers: z_layers.append(a.position[2]) n_layers = len([v for v in stacking_sequence if v is not ',']) layer_spacing = ase_lattice[2, 2] / len(z_layers) simulation_cell = SimulationCell() simulation_cell.lattice_parameter = 1.0 simulation_cell.H = copy.deepcopy(ase_lattice) simulation_cell.H[2, 2] = layer_spacing * n_layers n_layers = len([v for v in stacking_sequence if v is not ',']) for n, c in enumerate([v for v in stacking_sequence if v != ',']): if c == 'A': layer = 'A' z_layer = z_layers[0] elif c == 'B': layer = 'B' z_layer = z_layers[1] elif c == 'C': layer = 'C' z_layer = z_layers[2] for a in ase_fcc_111: if a.position[2] == z_layer: s = a.symbol x = copy.deepcopy(a.position) x[0] = x[0] / simulation_cell.H[0, 0] x[1] = x[1] / simulation_cell.H[1, 1] x[2] = n * layer_spacing / simulation_cell.H[2, 2] simulation_cell.add_atom(s, x) return simulation_cell
import os, shutil, subprocess from pypospack.crystal import SimulationCell import pypospack.io.vasp as vasp import pypospack.crystal as crystal import pypospack.io.slurm as minimize_init_slurm system_name = "Fe-fccD" # define simulation cell cell = SimulationCell() cell.a0 = 3.447 cell.H = [[1, 0, 0], [0, 1, 0], [0, 0, 2]] cell.add_atom('Fe', [0.0, 0.0, 0.00], magmom=2.22) cell.add_atom('Fe', [0.5, 0.5, 0.00], magmom=2.22) cell.add_atom('Fe', [0.5, 0.0, 0.25], magmom=2.22) cell.add_atom('Fe', [0.0, 0.5, 0.25], magmom=2.22) cell.add_atom('Fe', [0.0, 0.0, 0.50], magmom=-2.22) cell.add_atom('Fe', [0.5, 0.5, 0.50], magmom=-2.22) cell.add_atom('Fe', [0.5, 0.0, 0.75], magmom=-2.22) cell.add_atom('Fe', [0.0, 0.5, 0.75], magmom=-2.22) poscar = vasp.Poscar(cell) poscar.write('Fe_fcc_afm_D.init.vasp') print(poscar.get_magmom_tag())