Release 0.3.5: first introduction of OpenCL and GPU computation.

In this release I’ve introduced OpenCL and GPU in the development of PyParticles, and the firsts result are very well , try by yourself the galaxy demo.

The acceleration respect the the simulation based only on numpy is impressive.


If you want you can try also the fountain demo were I’ve introduced OpenCL in the drag computation, and the result is very encouraging and now you can simulate easily up to 700K particles or 1M particles.

As second point I’ve fixed the VSYNC problem, but only under windows.

New version 0.3.4 and VSYNC

For this version I’ve rewritten the logging system, now id more flexible and fast, test it with the solar system demo, I’ve also added the FPS counter and I’ve also improved the documentation.


The galaxy demo above will be available with the next release (0.3.5) stay on-line:

For the next version I’ve started to works with OpneCL and PyOpenCL

Disable VSYNC

Some video card has enabled the vsync, at the moment this option slow down the simulation in PyParticles if you use OpenGl, so if you want the maximal velocity you must disable this option:

Under Linux

with NVidia binary driver you must start the Nvidia server settings [command: nvidia-settings], select OpenGL Settings and uncheck Sync to VBlank

  • For a generic user and AMD card, try to watch this video:

Under Windows for NVidia and ATI users, follow the instruction at the link bellow: 

Version 0.3.3, better rendering and electromagnetism

In this release I’ve written a faster rendering function that use in a more logical way OpenGl , so that’s possible to draw tons of particles in a very fast way. For showing this characterises  try the demo fountain that simulate a model of 250’000 particles (or watch the video above).

As second I’ve added the electromagnetic files force, and I’ve improved the electromagnetism support, so now you can simulate also some electromagnetic system like cathodic tube or valves. Watch the demo elmag_field that simulate positive and negative charged particles in an electromagnetic filed (type v for plotting the vector fields).

And the last new is the possibility to plot the vector field, if required.

New release 0.3.2

In this release I’ve added the damping force, that’s useful in a lot of simulations.

And I’ve finally fixed and improved the documentation, in particular I’ve written a chapter dedicated to the testing procedures, for me this point is very important because it show practically the reliability of pyparticles. At the moment the implemented tests are 3, but in the future I hope to add also some other procedure.

If you have some suggestion for testing PyPaticles don’t hesitate to contact me.

New release PyParticles 0.3.1

With this release PyParticles become compatible with python 3.3, it need some other test but all mains functionalities works correctly. At the moment the main goal is to have an application that works either with python 2.7 and 3.3.

The second and very important point of this release are the testing, so I’ve finally written a pair of test procedures for comparing an analytical solution with the simulated solution.
For the moment the two tests are a falling object in a dragged fluid and the harmonic oscillator, and in both cases the result of the simulation is correct or, for be more precise, it follow the analytical solution with a very good approximation, so I can think that the procedures implemented in PyParticles are reliable.

In the following I report the absolute error for the harmonic oscillator (click for enlarge):

Version 0.3.0: Introduce the constraints for a more flexible simulation.

With PyParticle version 0.3.0 I’ve added the possibility to inset constraints in the particles system. The constraints are used to force the positions of some particles or for set up the interactions between the particles so we can build some complex and detailed models. In my example (see the video above) I’m simulating a vibrating string with the drag of the air under a constant gravity, and the result is very interesting.

In this version I’ve also improved the OpenGl rendering by using the display lists and I’ve also added a bubble demo, based on a ‘fantasious’ force.

For understanding the potential of the constraints watch this video, where I’ve developed a vibrating string in a very simple manner.

Visit the github page: and follow the project.

Download here: PyParticles

New version 0.2.1

The development is continuing.

Whit this new version I’ve added some interesting featured, first of all I’ve added the possibility to measures some quantity like the potential energy or the kinetic energy in the particles system, try to watch the springs or the solar system demo, I’ve also added the Lennard Jones potential as a force model for simulating the particles system, that’s very useful for simulating the gases.

For the visualization I’ve written some new features in the OpenGl animation, and now you can change easily the particle rendering model, and if you want you can turn ON or turn OFF the lighting, plus a little help (push the key h).

The next main goal is performing the simulation via OcTree.

Download here

Py Particles

PyParticles is an opensource particles simulation tool box entirely written in python.

It support the most popular integrations methods  and the most relevant forces model. It also offer a nice looking OpneGL interface or at your preference a Matplotlib based GUI.

PyParticles as a forces models  implements Gravity, spring, constant force and electrostatic and the user defined vector field force.

As a integrations method it includes Euler, Midpoint, Runge Kutta, Störmer Verlet and Leap frog.

With PyParticles you can freely combine every force model with all integration method in an easier as possible manner, for example you can change the integration method by switching a single line of code:

For example with this single line of code we can say to PyParticle to use the Runge Kutta method for simulating the model.
solver = rks.RungeKuttaSolver( grav , pset , dt )

Visit the project page on GitHub


The two following screenshots represents a simulation of the solar system and a set of 1000 random particles: