Free energy of insertion

Thank you very much for your suggestions. I still want to try the method described in the following work (widom insertion).

although other suggestions and free energy perturbation techniques are incorporated in lammps, I will try them later.

I am going to go with axel suggestion that is compile lammps as library and use custom C++ code for insertion and calculation of (deltU).

I also have other option: To use a python code inside a lammps script since I can access the co-ordinates by atom style variable and pass it in the python code

Out of these two (c++ and python from input script) which one would be faster or is it hard to say ?