def reset(self, new_region_size=None, do_calc_size=True, new_damping=None,<EOL>new_max_mem=None):
if new_region_size is not None:<EOL><INDENT>self.region_size = new_region_size<EOL><DEDENT>if new_max_mem != None:<EOL><INDENT>self.max_mem = new_max_mem<EOL><DEDENT>if do_calc_size:<EOL><INDENT>self.region_size = calc_particle_group_region_size(self.state,<EOL>region_size=self.region_size, max_mem=self.max_mem)<EOL><DEDENT>self.stats = []<EOL>self.particle_groups = separate_particles_into_groups(self.state,<EOL>self.region_size, doshift='<STR_LIT>')<EOL>if new_damping is not None:<EOL><INDENT>self._kwargs.update({'<STR_LIT>':new_damping})<EOL><DEDENT>if self.save_J:<EOL><INDENT>if len(self.particle_groups) > <NUM_LIT>:<EOL><INDENT>CLOG.warn('<STR_LIT>')<EOL><DEDENT>self._tempfiles = []<EOL>self._has_saved_J = []<EOL>for a in range(len(self.particle_groups)):<EOL><INDENT>for _ in ['<STR_LIT>','<STR_LIT>']:<EOL><INDENT>self._tempfiles.append(tempfile.TemporaryFile(dir=os.getcwd()))<EOL><DEDENT>self._has_saved_J.append(False)<EOL><DEDENT><DEDENT>
Resets the particle groups and optionally the region size and damping.

Parameters
----------
    new_region_size : : Int or 3-element list-like of ints, optional
        The region size for sub-blocking particles. Default is 40
    do_calc_size : Bool, optional
        If True, calculates the region size internally based on
        the maximum allowed memory. Default is True
    new_damping : Float or None, optional
        The new damping of the optimizer. Set to None to leave
        as the default for LMParticles. Default is None.
    new_max_mem : Numeric, optional
        The maximum allowed memory for J to occupy. Default is 1e9