def coloumb_configured_interface(iface, random=True, translations=None, rotations=None, samples=10, lowest=5, ecut=None): """ Creates Ligand Slab interfaces of user specified translations and rotations away from the initial guess of binding site configuration, returns lowest energy structure according to Coulomb model Args: Interface: Interface object: initial interface object random: True for using Gaussian sampled random numbers for rotations and translations translations: list of [x,y,z] translations to be performed rotation: list of [a,b,c] rotations to be performed w.r.t Ligand axis samples: number of interfaces to create lowest: number of structures to return according to order of minimum energies Returns: list of lowest energy interface objects """ ifaces = [] transform = [] for i in range(samples): if random: x = np.random.normal() # shift along x direction y = np.random.normal() # shift along y direction z = np.random.normal() # shift aling z direction a = SymmOp.from_axis_angle_and_translation(axis=[1, 0, 0], \ angle=np.random.normal(0, 180)) b = SymmOp.from_axis_angle_and_translation(axis=[0, 1, 0], \ angle=np.random.normal(0, 180)) c = SymmOp.from_axis_angle_and_translation(axis=[0, 0, 1], \ angle=np.random.normal(0, 180)) ligand = iface.ligand ligand.apply_operation(a) ligand.apply_operation(b) ligand.apply_operation(c) # check if created interface maintains the ligand adsorbed # over the surface for j in iface.top_atoms: if not iface.cart_coords[j][2] + iface.displacement > \ min(ligand.cart_coords[:, 2]): transform.append(True) if all(transform): iface = Interface(iface.strt, hkl=iface.hkl, min_thick=iface.min_thick, min_vac=iface.min_vac, supercell=iface.supercell, surface_coverage=iface.surface_coverage, ligand=iface.ligand, displacement=z, adatom_on_lig=iface.adatom_on_lig, adsorb_on_species=iface.adsorb_on_species, primitive=False, from_ase=True, x_shift=x, y_shift=y) iface.create_interface() energy = iface.calc_energy() iface.sort() if energy < ecut: ifaces.append((energy, iface)) # ifaces.zip(energy, iface) return ifaces
def coloumb_configured_interface(iface, random=True, translations= None, rotations=None, samples=10, lowest=5, ecut=None): """ Creates Ligand Slab interfaces of user specified translations and rotations away from the initial guess of binding site configuration, returns lowest energy structure according to Coulomb model Args: Interface: Interface object: initial interface object random: True for using Gaussian sampled random numbers for rotations and translations translations: list of [x,y,z] translations to be performed rotation: list of [a,b,c] rotations to be performed w.r.t Ligand axis samples: number of interfaces to create lowest: number of structures to return according to order of minimum energies Returns: list of lowest energy interface objects """ ifaces= [] transform= [] for i in range(samples): if random: x = np.random.normal() # shift along x direction y = np.random.normal() # shift along y direction z = np.random.normal() # shift aling z direction a= SymmOp.from_axis_angle_and_translation(axis=[1,0,0],\ angle=np.random.normal(0,180)) b= SymmOp.from_axis_angle_and_translation(axis=[0,1,0],\ angle=np.random.normal(0,180)) c= SymmOp.from_axis_angle_and_translation(axis=[0,0,1],\ angle=np.random.normal(0,180)) ligand=iface.ligand ligand.apply_operation(a) ligand.apply_operation(b) ligand.apply_operation(c) # check if created interface maintains the ligand adsorbed # over the surface for j in iface.top_atoms: if not iface.cart_coords[j][2] + iface.displacement > \ min(ligand.cart_coords[:,2]): transform.append(True) if all(transform): iface= Interface(iface.strt, hkl=iface.hkl, min_thick=iface.min_thick, min_vac=iface.min_vac, supercell=iface.supercell, surface_coverage=iface.surface_coverage, ligand=iface.ligand, displacement=z, adatom_on_lig=iface.adatom_on_lig, adsorb_on_species=iface.adsorb_on_species, primitive= False, from_ase=True, x_shift=x, y_shift=y) iface.create_interface() energy= iface.calc_energy() iface.sort() if energy<ecut: ifaces.append((energy,iface)) # ifaces.zip(energy, iface) return ifaces
# adsorb_on_species atom # on the slab # in Angstrom displacement = 3.0 # here we create the adsorbate slab Interface iface = Interface(strt, hkl=hkl, min_thick=min_thick, min_vac=min_vac, supercell=supercell, surface_coverage=surface_coverage, ligand=hydrazine, displacement=displacement, adatom_on_lig=adatom_on_lig, adsorb_on_species=adsorb_on_species, primitive=False, from_ase=True) iface.create_interface() iface.sort() energy = iface.calc_energy() iface.to('poscar', 'POSCAR_interface.vasp') interfaces = coloumb_configured_interface(iface, random=True, translations=None, rotations=None, samples=20, lowest=5, ecut=energy) for i, iface in enumerate(interfaces): print("Coloumb Energy") print(i, iface[0]) iface[1].to('poscar', 'POSCAR_interface' + str(iface[0]) + '.vasp') iface_slab = iface[1].slab iface_slab.sort() # set selective dynamics flags as required true_site = [1, 1, 1] false_site = [0, 0, 0]
#adsorb_on_species atom #on the slab #in Angstrom displacement = 3.0 #here we create the adsorbate slab Interface iface = Interface(strt, hkl=hkl, min_thick=min_thick, min_vac=min_vac, supercell=supercell, surface_coverage=surface_coverage, ligand=hydrazine, displacement=displacement, adatom_on_lig=adatom_on_lig, adsorb_on_species= adsorb_on_species, primitive= False, from_ase=True) iface.create_interface() iface.sort() energy=iface.calc_energy() iface.to('poscar','POSCAR_interface.vasp') interfaces= coloumb_configured_interface(iface, random=True, translations= None, rotations=None, samples=20, lowest=5, ecut=energy) for i, iface in enumerate(interfaces): print ("Coloumb Energy") print (i, iface[0]) iface[1].to('poscar', 'POSCAR_interface'+str(iface[0])+'.vasp') iface_slab = iface[1].slab iface_slab.sort() #set selective dynamics flags as required true_site= [1, 1, 1] false_site= [0, 0, 0]