Esempio n. 1
0
 def __init__(self, strt, hkl=[1,1,1], min_thick=10, min_vac=10,
              supercell=[1,1,1], name=None, adsorb_on_species=None,
              adatom_on_lig=None, ligand=None, displacement=1.0,
              surface_coverage=None, scell_nmax=10,
              coverage_tol=0.25, solvent=None, 
              start_from_slab=False, validate_proximity=False,
              to_unit_cell=False, coords_are_cartesian=False,
              primitive=True, from_ase=False,
              x_shift=0, y_shift=0, rot=[0,0,0],
              center_slab=True):
     self.from_ase = from_ase
     vac_extension = 0
     if ligand is not None:
         vac_extension = ligand.max_dist
     if isinstance(strt, Structure) and not isinstance(strt, Slab):
         self.min_vac = min_vac + vac_extension
         if self.from_ase:
             strt = get_ase_slab(strt,
                                 hkl=hkl,
                                 min_thick=min_thick,
                                 min_vac=min_vac + vac_extension, 
                                 center_slab=center_slab)
         else:
             strt = SlabGenerator(strt, hkl, min_thick,
                                  min_vac + vac_extension,
                                  center_slab=center_slab,
                                  primitive = primitive).get_slab()
         strt.make_supercell(supercell)
     else:
         self.min_vac = min_vac
     Slab.__init__(self, strt.lattice, strt.species_and_occu,
                   strt.frac_coords,
                   miller_index=strt.miller_index,
                   oriented_unit_cell=strt.oriented_unit_cell,
                   shift=strt.shift, scale_factor=strt.scale_factor,
                   validate_proximity=validate_proximity,
                   to_unit_cell=to_unit_cell,
                   coords_are_cartesian=coords_are_cartesian,
                   site_properties=strt.site_properties,
                   energy=strt.energy )
     self.strt= strt
     self.name = name
     self.hkl = hkl
     self.min_thick = min_thick
     self.supercell = supercell
     self.ligand = ligand
     self.slab = strt
     self.displacement = displacement
     self.solvent = solvent
     self.surface_coverage = surface_coverage
     self.adsorb_on_species = adsorb_on_species
     self.adatom_on_lig = adatom_on_lig
     self.scell_nmax = scell_nmax
     self.coverage_tol = coverage_tol
     self.x_shift = x_shift
     self.y_shift = y_shift
     self.rot = rot
Esempio n. 2
0
 def __init__(self,
              strt,
              hkl=[1, 1, 1],
              min_thick=10,
              min_vac=10,
              supercell=[1, 1, 1],
              name=None,
              adsorb_on_species=None,
              adatom_on_lig=None,
              ligand=None,
              displacement=1.0,
              surface_coverage=None,
              scell_nmax=10,
              coverage_tol=0.25,
              solvent=None,
              start_from_slab=False,
              validate_proximity=False,
              to_unit_cell=False,
              coords_are_cartesian=False,
              primitive=True,
              from_ase=False,
              lll_reduce=False,
              center_slab=True,
              max_normal_search=None,
              force_normalize=False,
              x_shift=0,
              y_shift=0,
              rot=[0, 0, 0]):
     self.from_ase = from_ase
     vac_extension = 0
     if ligand is not None:
         vac_extension = ligand.max_dist
     if isinstance(strt, Structure) and not isinstance(strt, Slab):
         self.min_vac = min_vac + vac_extension
         if self.from_ase:
             strt = get_ase_slab(strt,
                                 hkl=hkl,
                                 min_thick=min_thick,
                                 min_vac=min_vac + vac_extension)
         else:
             slab = SlabGenerator(strt,
                                  hkl,
                                  min_thick,
                                  min_vac + vac_extension,
                                  center_slab=center_slab,
                                  lll_reduce=lll_reduce,
                                  max_normal_search=max_normal_search,
                                  primitive=primitive).get_slab()
             if force_normalize:
                 strt = slab.get_orthogonal_c_slab()
             else:
                 strt = slab
         strt.make_supercell(supercell)
     else:
         self.min_vac = min_vac
     Slab.__init__(self,
                   strt.lattice,
                   strt.species_and_occu,
                   strt.frac_coords,
                   miller_index=strt.miller_index,
                   oriented_unit_cell=strt.oriented_unit_cell,
                   shift=strt.shift,
                   scale_factor=strt.scale_factor,
                   validate_proximity=validate_proximity,
                   to_unit_cell=to_unit_cell,
                   coords_are_cartesian=coords_are_cartesian,
                   site_properties=strt.site_properties,
                   energy=strt.energy)
     self.strt = strt
     self.name = name
     self.hkl = hkl
     self.min_thick = min_thick
     self.supercell = supercell
     self.ligand = ligand
     self.slab = strt
     self.displacement = displacement
     self.solvent = solvent
     self.surface_coverage = surface_coverage
     self.adsorb_on_species = adsorb_on_species
     self.adatom_on_lig = adatom_on_lig
     self.scell_nmax = scell_nmax
     self.coverage_tol = coverage_tol
     self.x_shift = x_shift
     self.y_shift = y_shift
     self.rot = rot