parameters: (self, start, stop, step, tsteps, quiet=False)
return_statement: return opt_period
docstring: Tune the sorting period.
  
          Args:
              start (int): Start of tuning interval to scan (inclusive).
              stop (int): End of tuning interval to scan (inclusive).
              step (int): Spacing between tuning points.
              tsteps (int): Number of timesteps to run at each tuning point.
              quiet (bool): Quiet the individual run calls.
  
          Returns:
              int: The optimal sorting period from the scanned range.
  
          The optimal sorting period for the MPCD particles is determined from
          a sequence of short runs. The sorting period is first set to *start*.
          The TPS value is determined for a run of length *tsteps*. This run is
          repeated 3 times, and the median TPS of the runs is saved. The sorting
          period is then incremented by *step*, and the process is repeated until
          *stop* is reached. The period giving the fastest TPS is determined, and
          the sorter period is updated to this value. The results of the scan
          are also reported as output, and the fastest sorting period is also
          returned.
  
          Note:
              A short warmup run is **required** before calling :py:meth:`tune()`
              in order to ensure the runtime autotuners have found optimal
              kernel launch parameters.
  
          Examples::
  
              # warmup run
              hoomd.run(5000)
  
              # tune sorting period
              sorter.tune(start=5, stop=50, step=5, tsteps=1000)
docstring_summary: Tune the sorting period.
docstring_tokens: Tune the sorting period .
function: def tune(self, start, stop, step, tsteps, quiet=False):
          """ Tune the sorting period.
  
          Args:
              start (int): Start of tuning interval to scan (inclusive).
              stop (int): End of tuning interval to scan (inclusive).
              step (int): Spacing between tuning points.
              tsteps (int): Number of timesteps to run at each tuning point.
              quiet (bool): Quiet the individual run calls.
  
          Returns:
              int: The optimal sorting period from the scanned range.
  
          The optimal sorting period for the MPCD particles is determined from
          a sequence of short runs. The sorting period is first set to *start*.
          The TPS value is determined for a run of length *tsteps*. This run is
          repeated 3 times, and the median TPS of the runs is saved. The sorting
          period is then incremented by *step*, and the process is repeated until
          *stop* is reached. The period giving the fastest TPS is determined, and
          the sorter period is updated to this value. The results of the scan
          are also reported as output, and the fastest sorting period is also
          returned.
  
          Note:
              A short warmup run is **required** before calling :py:meth:`tune()`
              in order to ensure the runtime autotuners have found optimal
              kernel launch parameters.
  
          Examples::
  
              # warmup run
              hoomd.run(5000)
  
              # tune sorting period
              sorter.tune(start=5, stop=50, step=5, tsteps=1000)
  
          """
  
          # scan through range of sorting periods and log TPS
          periods = range(start, stop + 1, step)
          tps = []
          for p in periods:
              cur_tps = []
              self.set_period(period=p)
              for i in range(0, 3):
                  hoomd.run(tsteps, quiet=quiet)
                  cur_tps.append(hoomd.context.current.system.getLastTPS())
  
              # save the median tps
              cur_tps.sort()
              tps.append(cur_tps[1])
  
          # determine fastest period and set it on the sorter
          fastest = tps.index(max(tps))
          opt_period = periods[fastest]
          self.set_period(period=opt_period)
  
          # output results
          hoomd.context.current.device.cpp_msg.notice(
              2, '--- sort.tune() statistics\n')
          hoomd.context.current.device.cpp_msg.notice(
              2, 'Optimal period = {0}\n'.format(opt_period))
          hoomd.context.current.device.cpp_msg.notice(
              2, '        period = ' + str(periods) + '\n')
          hoomd.context.current.device.cpp_msg.notice(
              2, '          TPS  = ' + str(tps) + '\n')
  
          return opt_period
function_tokens: def tune ( self , start , stop , step , tsteps , quiet = False ) : # scan through range of sorting periods and log TPS periods = range ( start , stop + 1 , step ) tps = [ ] for p in periods : cur_tps = [ ] self . set_period ( period = p ) for i in range ( 0 , 3 ) : hoomd . run ( tsteps , quiet = quiet ) cur_tps . append ( hoomd . context . current . system . getLastTPS ( ) ) # save the median tps cur_tps . sort ( ) tps . append ( cur_tps [ 1 ] ) # determine fastest period and set it on the sorter fastest = tps . index ( max ( tps ) ) opt_period = periods [ fastest ] self . set_period ( period = opt_period ) # output results hoomd . context . current . device . cpp_msg . notice ( 2 , '--- sort.tune() statistics\n' ) hoomd . context . current . device . cpp_msg . notice ( 2 , 'Optimal period = {0}\n' . format ( opt_period ) ) hoomd . context . current . device . cpp_msg . notice ( 2 , '        period = ' + str ( periods ) + '\n' ) hoomd . context . current . device . cpp_msg . notice ( 2 , '          TPS  = ' + str ( tps ) + '\n' ) return opt_period