コード例 #1
0
ファイル: calibrate.py プロジェクト: santiama/MPInterfaces
 def create_interface(self):
     """
     add params that you want to vary
     """
     structure = self.input_structure.copy()
     iface = Interface(structure,
                       hkl=self.system['hkl'],
                       ligand=Ligand.from_dict(self.system['ligand']),
                       from_ase=self.from_ase)
     iface.sort()
     sd = self.set_sd_flags(iface, n_layers=2)
     # if there are other paramters that are being varied
     # change the comment accordingly
     comment = self.system['hkl'] + self.system['ligand']['name']
     return Poscar(iface, comment=comment, selective_dynamics=sd)
コード例 #2
0
ファイル: calibrate.py プロジェクト: zhuyizhou/MPInterfaces
 def create_interface(self):
     """
     add params that you want to vary
     """
     structure = self.input_structure.copy()
     iface = Interface(structure,
                       hkl=self.system['hkl'],
                       ligand = Ligand.from_dict(self.system['ligand']),
                       from_ase=self.from_ase)
     iface.sort()
     sd = self.set_sd_flags(iface, n_layers=2)
     #if there are other paramters that are being varied
     #change the comment accordingly
     comment = self.system['hkl']+self.system['ligand']['name']
     return Poscar(iface, comment=comment,
                   selective_dynamics=sd)
コード例 #3
0
    # ligand displacement from the slab surface along the surface normal
    # i.e adatom_on_lig will be displced by this amount from the
    # adsorb_on_species atom
    # on the slab
    # in Angstrom
    displacement = 3.0

    # here we create the interface
    iface = Interface(strt, hkl=hkl,
                      min_thick=min_thick, min_vac=min_vac,
                      supercell=supercell, surface_coverage=0.01,
                      ligand=hydrazine, displacement=displacement,
                      adatom_on_lig='N', adsorb_on_species='Pb',
                      primitive=False)
    iface.create_interface()
    iface.sort()
    # extract bare slab
    iface_slab = iface.slab
    iface_slab.sort()
    # set selective dynamics flags as required
    true_site = [1, 1, 1]
    false_site = [0, 0, 0]
    sd_flag_iface = []
    sd_flag_slab = []
    # selective dynamics flags for the interface
    for i in iface.sites:
        sd_flag_iface.append(false_site)
    # selective dynamics flags for the bare slab
    for i in iface_slab.sites:
        sd_flag_slab.append(false_site)
    interface_poscar = Poscar(iface, selective_dynamics=sd_flag_iface)
コード例 #4
0
    displacement = 3.0

    # here we create the interface
    iface = Interface(strt,
                      hkl=hkl,
                      min_thick=min_thick,
                      min_vac=min_vac,
                      supercell=supercell,
                      surface_coverage=0.01,
                      ligand=hydrazine,
                      displacement=displacement,
                      adatom_on_lig='N',
                      adsorb_on_species='Pb',
                      primitive=False)
    iface.create_interface()
    iface.sort()
    # extract bare slab
    iface_slab = iface.slab
    iface_slab.sort()
    # set selective dynamics flags as required
    true_site = [1, 1, 1]
    false_site = [0, 0, 0]
    sd_flag_iface = []
    sd_flag_slab = []
    # selective dynamics flags for the interface
    for i in iface.sites:
        sd_flag_iface.append(false_site)
    # selective dynamics flags for the bare slab
    for i in iface_slab.sites:
        sd_flag_slab.append(false_site)
    interface_poscar = Poscar(iface, selective_dynamics=sd_flag_iface)
コード例 #5
0
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
コード例 #6
0
    # firework 3 and firework 2 
    # at thickness and vac spacing of firework 4
    # firework 5 firetask1: Interface relaxation , firetask2: slab relaxation
    interface_firetasks = []
    interface_fireworks = []
    interface = Interface(bulk, hkl=[1,0,0], min_thick=10, min_vac=10,
                 supercell=[1,1,1], name=None, adsorb_on_species='Pb',
                 adatom_on_lig='O', ligand=ligand, displacement=3.0,
                 surface_coverage=0.01, scell_nmax=10, coverage_tol=0.25,
                 solvent="amine", start_from_slab=False, validate_proximity=False,
                 to_unit_cell=False, coords_are_cartesian=False, primitive = True,
                 from_ase=True, x_shift= 0, y_shift= 0)
    
    interface.create_interface()  #with pre-configure as true, will generate different
                                  #ligand interface configurations
    interface.sort()
    slab = interface.slab
    slab.sort()
    
    # create interface firetasks: interface relaxation and slab relaxation 
    interface_firetasks.append(get_calibration_task(structure=interface, \
                                              incar_params = {'NSW':100}, \
                                              other_params = {'job_dir': 'InterfaceRelax'}))
    interface_firetasks.append(get_calibration_task(structure=slab, \
                                              incar_params = {'NSW':100}))

    interface_fireworks.append(Firework(interface_firetasks, name='interface_convergence'))

    workflows.append(get_workflow(interface_fireworks, name='Interface'))

コード例 #7
0
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 
コード例 #8
0
                          scell_nmax=10,
                          coverage_tol=0.25,
                          solvent="amine",
                          start_from_slab=False,
                          validate_proximity=False,
                          to_unit_cell=False,
                          coords_are_cartesian=False,
                          primitive=True,
                          from_ase=True,
                          x_shift=0,
                          y_shift=0)

    interface.create_interface(
    )  #with pre-configure as true, will generate different
    #ligand interface configurations
    interface.sort()
    slab = interface.slab
    slab.sort()

    # create interface firetasks: interface relaxation and slab relaxation
    interface_firetasks.append(get_calibration_task(structure=interface, \
                                              incar_params = {'NSW':100}, \
                                              other_params = {'job_dir': 'InterfaceRelax'}))
    interface_firetasks.append(get_calibration_task(structure=slab, \
                                              incar_params = {'NSW':100}))

    interface_fireworks.append(
        Firework(interface_firetasks, name='interface_convergence'))

    workflows.append(get_workflow(interface_fireworks, name='Interface'))