def update_ensemble_setting(settings):
    """
    Copies ensemble setting (either 'boltzmann' or 'tsallis') from
    'replica' replica section in config dicts to the nonbonded section

    If no ensemble is set in the 'replica' section, 'boltzmann' is
    assumed.

    :param settings: settings specified in 'replica' section of
                     a config file
    :type settings: dict

    :returns: updated settings
    :rtype: dict of dicts
    """
    rps = settings['replica']
    if not 'ensemble' in rps or rps['ensemble'] == 'boltzmann':
        settings['nonbonded_prior'].update(ensemble='boltzmann')
    elif rps['ensemble'] == 'tsallis':
        settings['nonbonded_prior'].update(ensemble='tsallis')
    else:
        msg = 'ensemble has to be either not present in cfg file,'+\
               ' or set to \'tsallis\' or \'boltzmann\''
        raise ValueError(msg)

    return settings