Keep in mind that I have turned on the bump and displacement setting. The problem is that with this procedure the material changes the shape of the object but the mesh is not altered. As a result, the particle system previously applied touches the mesh but not the displaced material.
I have already seen this post: Make particles follow true (material) displacement
It says that you require an addon and that my material is an UV coordinates material. But it is not well explained how to do it. Moreover I would like to do it completely with python, and I am not sure I can do it in this way.
PS I also tried to check "Use Modifier Stack" in particle settings. It does not work.