Beispiel #1
0
    def build_instance(cls,xyzu_oc_m = [0.5, 0.5, 1.5, 0.1, 1, 1], els = ['O','C','C','O'], flat_down_index = [2],anchor_index_list = [1, None, 1, 2 ], lat_pars = [3.615, 3.615, 3.615, 90, 90, 90]):
        domain = model_2.Slab(T_factor = 'u')
        ids_all = deepcopy(els)
        for each in set(els):
            index_temp_all = list(np.where(np.array(els) == each)[0])
            for index_temp in index_temp_all:
                ids_all[index_temp] = "{}{}".format(ids_all[index_temp], index_temp_all.index(index_temp)+1)
        for i in range(len(ids_all)):
            domain.add_atom(ids_all[i],els[i],*xyzu_oc_m)
        ids = deepcopy(ids_all)
        del(ids[anchor_index_list.index(None)])
        anchor_id = ids_all[anchor_index_list.index(None)]
        flat_down_index_new = [[i,i-1][int(i>anchor_index_list.index(None))] for i in flat_down_index]

        r_list_names = []
        gamma_list_names = []
        delta_list_names = []
        for i in range(len(anchor_index_list)):
            each = anchor_index_list[i]
            if each != None:
                #if i not in flat_down_index:
                delta_list_names.append("delta_{}_{}".format(ids_all[i],ids_all[each]))
            if each != None:
                r_list_names.append("r_{}_{}".format(ids_all[i],ids_all[each]))
                gamma_list_names.append("gamma_{}_{}".format(ids_all[i],ids_all[each]))
        rgh = UserVars()
        rgh.new_var('gamma',0)
        rgh.new_var('rot_ang_x',0)
        rgh.new_var('rot_ang_y',0)
        for r in r_list_names:
            rgh.new_var(r, 1.5)
        for i in range(len(delta_list_names)):
            delta = delta_list_names[i]
            if i in flat_down_index_new:
                rgh.new_var(delta, 0)
            else:
                rgh.new_var(delta, 20)

        #for gamma in gamma_list_names:
        #    rgh.new_var(gamma, 10)
        
        instance = cls(domain, ids, anchor_id, flat_down_index = flat_down_index_new, lat_pars = lat_pars)
        instance.rgh = rgh
        instance.r_list_names = r_list_names
        instance.delta_list_names = delta_list_names
        instance.gamma_list_names = gamma_list_names
        instance.gamma_handedness = [1]*anchor_index_list.index(None)+[0]*(len(anchor_index_list)-anchor_index_list.index(None)-1)
        instance.new_anchor_list = [ids_all[i] for i in anchor_index_list if i!=None]
        instance.rot_ang_x_list = [0] * len(instance.ids)
        instance.rot_ang_y_list = [0] * len(instance.ids)
        return instance
Beispiel #2
0
Egam = 6.626 * (10**-34) * 3 * (
    10**8) / wal * 10**10 / 1.602 * 10**19  #energy in ev
LAM = 1.5233e-22 * Egam**6 - 1.2061e-17 * Egam**5 + 2.5484e-13 * Egam**4 + 1.6593e-10 * Egam**3 + 1.9332e-06 * Egam**2 + 1.1043e-02 * Egam
exp_const = 4 * kvect / LAM
auc = unitcell.a * unitcell.b * np.sin(unitcell.gamma)
#/expconstant/end#
#globalsetting/end#

#--set instrument--#
#/instrument/begin#
inst = model.Instrument(wavel=wal, alpha=2.0)
#/instrument/end#

#--set bulk slab--#
#/bulk/begin#
bulk = model.Slab()
bulk_file = 'Cu100_bulk.str'
tool_box.add_atom_in_slab(bulk, os.path.join(batch_path_head, bulk_file))
#/bulk/end#

#--set surface slabs--#
#/surfaceslab/begin#
surface_slab_head = 'Cu100_surface_'
use_same_tag = 1
for i in range(num_surface_slabs):
    globals()['surface_{}'.format(i + 1)] = model.Slab(c=1.0)
    if use_same_tag == None:
        tag = i + 1
    else:
        tag = use_same_tag
    tool_box.add_atom_in_slab(