def track_to_s(impact_object, particles, s):
    """
    Tracks particles to s. 
    
    The initial time and starting conditions will be set automatically according to the particles.
    
    If successful, returns a ParticleGroup with the final particles.
    
    Otherwise, returns None
    
    """
   
    impact_object.initial_particles = particles
    if s is not None:
        impact_object.stop = s

    impact_object.run()

    if 'particles' in impact_object.output:
        return impact_object.output['particles']['final_particles']
    else:
        return None