nodes: 0, module; 1, function_definition; 2, function_name:particles; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, comment:"""
          Access the variational particles corresponding to this set of variational equations.
  
          The function returns a list of particles which are sorted in the same way as those in 
          sim.particles
  
          The particles are pointers and thus can be modified. 
  
          If there are N real particles, this function will also return a list of N particles (all of which are 
          variational particles). 
          """; 14, assignment; 15, assignment; 16, comparison_operator:self.testparticle>=0; 17, block; 18, else_clause; 19, assignment; 20, assignment; 21, identifier:ps; 22, identifier:sim; 23, attribute; 24, identifier:ps; 25, list; 26, attribute; 27, integer:0; 28, expression_statement; 29, block; 30, identifier:ParticleList; 31, binary_operator:Particle*N; 32, identifier:ps; 33, call; 34, attribute; 35, identifier:contents; 36, identifier:self; 37, identifier:testparticle; 38, assignment; 39, expression_statement; 40, identifier:Particle; 41, identifier:N; 42, attribute; 43, argument_list; 44, identifier:self; 45, identifier:_sim; 46, identifier:N; 47, integer:1; 48, assignment; 49, identifier:ParticleList; 50, identifier:from_address; 51, binary_operator:ctypes.addressof(sim._particles.contents)+self.index*ctypes.sizeof(Particle); 52, identifier:N; 53, binary_operator:sim.N-sim.N_var; 54, call; 55, binary_operator:self.index*ctypes.sizeof(Particle); 56, attribute; 57, attribute; 58, attribute; 59, argument_list; 60, attribute; 61, call; 62, identifier:sim; 63, identifier:N; 64, identifier:sim; 65, identifier:N_var; 66, identifier:ctypes; 67, identifier:addressof; 68, attribute; 69, identifier:self; 70, identifier:index; 71, attribute; 72, argument_list; 73, attribute; 74, identifier:contents; 75, identifier:ctypes; 76, identifier:sizeof; 77, identifier:Particle; 78, identifier:sim; 79, identifier:_particles
code: def particles(self):
          """
          Access the variational particles corresponding to this set of variational equations.
  
          The function returns a list of particles which are sorted in the same way as those in 
          sim.particles
  
          The particles are pointers and thus can be modified. 
  
          If there are N real particles, this function will also return a list of N particles (all of which are 
          variational particles). 
          """
          sim = self._sim.contents
          ps = []
          if self.testparticle>=0:
              N = 1
          else:
              N = sim.N-sim.N_var 
          
          ParticleList = Particle*N
          ps = ParticleList.from_address(ctypes.addressof(sim._particles.contents)+self.index*ctypes.sizeof(Particle))
          return ps