How to Pack/Place Lipids in Blender using Python script?
An animation of the lipid molecules can be generated using the rigid body collisions. 





The steps to reproduce this animation are:


Use the particle system to place the molecules initially.


Add a flat surface to place the molecules on.


Use the particle system to place the molecules on the surface in a regular grid. Using a regular grid will prevent the molecules from intersecting each other.



Setup the display to use the lipid geometry for rendering.




Convert the particle system into individual objects.


Press the convert button for the particle system modifier.


Convert the lipid molecules into rigid bodies.


Select the first lipid molecule in the scene.
Add the rigid body physics to the object.





Select all lipid objects.
Deselect, then select the first lipid molecule again.
In the left hand panel of the 3D viewer, select the Physics tab, and click on 'Copy from Active'. This will copy the physics setting to all of the lipid molecules.



Add a mesh to act as a container for all of the lipid molecules.


Add geometry. The geometry should be larger than the initial placement of the lipids. The height of the container should be slightly larger than the height of the lipids. The top and bottom of the container will help keep the lipids from moving up or down.





Set the container as an animated rigid body. So the interior of the container keeps the lipids in place, the 'Shape' needs to be set to 'Mesh'.



Change the direction of gravity to point towards one of the container walls. This cause all of the lipids to pack in a horizontal direction.


Animate the container with noise. This will make the molecules randomly move about.


Insert a keyframe at the start of the timeline. 





Modify the animation graphs with noise. This will cause the walls of the container to move around and bounce into the lipids. This will cause the lipids to bounce around during the animation.



Animate the result!




The finished blend file is located at blend-exchange file