<commit_before>class SlaveReplicaExchangeRunner(object):
    '''
    This class coordinates running replica exchange on the slaves.

    '''

    def __init__(self, step, max_steps):
        self._step = step
        self._max_steps = max_steps

    @classmethod
    def from_master(cls, master):
        '''
        Initialize a new slave from a master.

        Parameters
            master -- a MasterReplicaExchangeRunner to serve as a template
        Returns
            a SlaveReplicaExchangeRunner

        '''
        new_slave = cls(master.step, master.max_steps)
        return new_slave

    @property
    def step(self):
        return self._step

    @property
    def max_steps(self):
        return self._max_steps

    def run(self, communicator, system_runner):
        '''
        Continue running slave jobs until done.

        Parameters
            communicator -- a communicator object for talking to the master
            system_runner -- a system_runner object for actually running the simulations

        '''
        my_alpha = None

        while self._step <= self._max_steps:
            # update simulation conditions
            new_alpha = communicator.recieve_alpha_from_master()
            if not new_alpha == my_alpha:
                my_alpha = new_alpha
                system_runner.set_alpha(my_alpha)

            # do one round of simulation
            state = communicator.recieve_state_from_master()
            if self._step == 1:
                state = system_runner.minimize_then_run(state)
            else:
                state = system_runner.run(state)
            communicator.send_state_to_master(state)

            # compute energies
            states = communicator.recieve_states_for_energy_calc_from_master()
            energies = []
            for state in states:
                energy = system_runner.get_energy(state)
                energies.append(energy)
            communicator.send_energies_to_master(energies)
            self._step += 1<commit_msg>Slaves now update alpha of state before running.<commit_after>class SlaveReplicaExchangeRunner(object):
    '''
    This class coordinates running replica exchange on the slaves.

    '''

    def __init__(self, step, max_steps):
        self._step = step
        self._max_steps = max_steps

    @classmethod
    def from_master(cls, master):
        '''
        Initialize a new slave from a master.

        Parameters
            master -- a MasterReplicaExchangeRunner to serve as a template
        Returns
            a SlaveReplicaExchangeRunner

        '''
        new_slave = cls(master.step, master.max_steps)
        return new_slave

    @property
    def step(self):
        return self._step

    @property
    def max_steps(self):
        return self._max_steps

    def run(self, communicator, system_runner):
        '''
        Continue running slave jobs until done.

        Parameters
            communicator -- a communicator object for talking to the master
            system_runner -- a system_runner object for actually running the simulations

        '''
        my_alpha = None

        while self._step <= self._max_steps:
            # update simulation conditions
            new_alpha = communicator.recieve_alpha_from_master()
            state = communicator.recieve_state_from_master()
            if not new_alpha == my_alpha:
                my_alpha = new_alpha
                system_runner.set_alpha(my_alpha)
                state.alpha = my_alpha

            # do one round of simulation
            if self._step == 1:
                state = system_runner.minimize_then_run(state)
            else:
                state = system_runner.run(state)
            communicator.send_state_to_master(state)

            # compute energies
            states = communicator.recieve_states_for_energy_calc_from_master()
            energies = []
            for state in states:
                energy = system_runner.get_energy(state)
                energies.append(energy)
            communicator.send_energies_to_master(energies)
            self._step += 1
{'fraction_non_alphanumeric': 0.06316553727008713, 'fraction_numerical': 0.000968054211035818, 'mean_word_length': 1.908515130190007, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7216455', 'n_tokens_mistral': 1075, 'n_tokens_neox': 1037, 'n_words': 276}