code: def add(self, particle=None, **kwargs):   
          
          if particle is not None:
              if isinstance(particle, Particle):
                  if (self.gravity == "tree" or self.collision == "tree") and self.root_size <=0.:
                      raise ValueError("The tree code for gravity and/or collision detection has been selected. However, the simulation box has not been configured yet. You cannot add particles until the the simulation box has a finite size.")
  
                  clibrebound.reb_add(byref(self), particle)
              elif isinstance(particle, list):
                  for p in particle:
                      self.add(p, **kwargs)
              elif isinstance(particle,str):
                  if self.python_unit_l == 0 or self.python_unit_m == 0 or self.python_unit_t == 0:
                      self.units = ('AU', 'yr2pi', 'Msun')
                  self.add(horizons.getParticle(particle, **kwargs), hash=particle)
                  units_convert_particle(self.particles[-1], 'km', 's', 'kg', hash_to_unit(self.python_unit_l), hash_to_unit(self.python_unit_t), hash_to_unit(self.python_unit_m))
              else: 
                  raise ValueError("Argument passed to add() not supported.")
          else: 
              self.add(Particle(simulation=self, **kwargs))
          if hasattr(self, '_widgets'):
              self._display_heartbeat(pointer(self))
docs: Adds a particle to REBOUND. Accepts one of the following:
  
          1) A single Particle structure.
          2) The particle's mass and a set of cartesian coordinates: m,x,y,z,vx,vy,vz.
          3) The primary as a Particle structure, the particle's mass and a set of orbital elements: primary,m,a,anom,e,omega,inv,Omega,MEAN (see :class:`.Orbit` for the definition of orbital elements).
          4) A name of an object (uses NASA Horizons to look up coordinates)
          5) A list of particles or names.