domains['domain{}'.format(i + 1)] = {}
    domains['domain{}'.format(i +
                              1)]['slab'] = globals()['surface_{}'.format(i +
                                                                          1)]
    domains['domain{}'.format(i + 1)]['sorbate'] = [
        globals()['domain_sorbate_{}'.format(j + 1)]
        for j in range(num_sorbate_slabs)
    ]
    domains['domain{}'.format(i + 1)]['wt'] = getattr(
        globals()['rgh_wt'], 'wt_domain{}'.format(i + 1))
    domains['domain{}'.format(i + 1)]['sorbate_sym'] = globals()[
        'sorbate_syms_{}'.format(i + 1)]
    domains['domain{}'.format(i + 1)]['layered_water'] = rgh_lw
sample = model.Sample(inst,
                      bulk,
                      domains,
                      unitcell,
                      surface_parms=surface_parms)
#/sample/end#


def Sim(data, VARS=vars()):
    F = []
    fom_scaler = []
    beta = rgh.beta

    #/update_sorbate/begin#
    for i in range(num_sorbate_slabs):
        VARS['{}{}'.format(VARS['sorbate_instance_head'],
                           i + 1)].set_coordinate_all_rgh()
#/update_sorbate/end#
#/sorbatesym/end#

#/sample/begin#
domains = {}
for i in range(num_surface_slabs):
    domains['domain{}'.format(i + 1)] = {}
    domains['domain{}'.format(i +
                              1)]['slab'] = globals()['surface_{}'.format(i +
                                                                          1)]
    domains['domain{}'.format(i + 1)]['sorbate'] = globals()[
        'sorbate_{}'.format(i + 1)]
    domains['domain{}'.format(i + 1)]['wt'] = getattr(
        globals()['rgh_wt'], 'wt_domain{}'.format(i + 1))
    domains['domain{}'.format(i + 1)]['sorbate_sym'] = globals()[
        'sorbate_syms_{}'.format(i + 1)]
sample = model.Sample(inst, bulk, domains, unitcell)
#/sample/end#


def Sim(data, VARS=vars()):
    F = []
    fom_scaler = []
    beta = rgh.beta

    #/update_sorbate/begin#
    for i in range(num_sorbate_slabs):
        VARS['{}{}'.format(VARS['sorbate_instance_head'],
                           i + 1)].set_coordinate_all_rgh()
    #/update_sorbate/end#

    #normalize the domain weight to make total = 1