def METHOD_NAME(ts, coor, mode, macro_data=None,
                              term=None, problem=None,
                              iteration=None, define_args=None,
                              output_dir=None, **kwargs):
    if not (mode == 'qp'):
        return
    oprefix = output.prefix
    output.prefix = 'micro:'
    if not hasattr(problem, 'homogen_app'):
        required, other = get_standard_keywords()
        required.remove('equations')
        micro_file = problem.conf.options.micro_filename
        conf = ProblemConf.from_file(micro_file, required, other,
                                     verbose=False, define_args=define_args)
        if output_dir is not None:
            conf.options.output_dir = output_dir
        options = Struct(output_filename_trunk=None)
        app = HomogenizationApp(conf, options, 'micro:',
                                n_micro=coor.shape[0])
        problem.homogen_app = app
        if hasattr(app.app_options, 'use_mpi') and app.app_options.use_mpi:
            multiproc, multiproc_mode = multi.get_multiproc(mpi=True)
            multi_mpi = multiproc if multiproc_mode == 'mpi' else None
        else:
            multi_mpi = None
        app.multi_mpi = multi_mpi
        if multi_mpi is not None:
            multi_mpi.master_send_task('init', (micro_file, coor.shape[0]))
    else:
        app = problem.homogen_app
        multi_mpi = app.multi_mpi
    if macro_data is not None:
        macro_data['macro_time_step'] = ts.step
    app.setup_macro_data(macro_data)
    if multi_mpi is not None:
        multi_mpi.master_send_task('calculate', (macro_data, ts, iteration))
    coefs, deps = app(ret_all=True, itime=ts.step, iiter=iteration)
    if type(coefs) is tuple:
        coefs = coefs[0]
    out = {}
    for key, val in six.iteritems(coefs.__dict__):
        if isinstance(val, list):
            out[key] = nm.array(val)
        elif isinstance(val, dict):
            for key2, val2 in six.iteritems(val):
                out[key+'_'+key2] = nm.array(val2)
    for key in six.iterkeys(out):
        shape = out[key].shape
        if len(shape) == 1:
            out[key] = out[key].reshape(shape + (1, 1))
        elif len(shape) == 2:
            out[key] = out[key].reshape(shape + (1,))
    output.prefix = oprefix
    return out