Hi János,
Our understanding is that you want to calculate these contributions separately
* The 1-body contribution
* All other contributions.
If you just want to perform some single point calculations, you can do as is suggested above.
However, for your use case of the path-integral simulations, it probably makes more sense use the interface of the `System` class to extract the contributions you want in C++ code.
The `System` class (src/bblock/system.cpp) has functions to get each contribution to the energy:
* Get1B
* Get2B
* Get3B
* GetDispersion
* GetElectrostatics
Each of these functions takes in an argument called `do_grads`. If you pass `true`, then the internal gradient object of the `System` class will be updated with the gradients for that energy contribution.
The gradients can then be retrieved with `GetRealGrads`, which will return the gradients associated with all the energy contributions whose functions you called, not just the most recent contribution.
So, in order to calculate only the 1-body contribution for each bead, we recommend:
1) Construct a System class instance for each bead and call `Get1B(true)`, then `GetRealGrads()`. This will get you the 1-body contribution.
Then, to calculate the other contributions for the centroid:
2) Construct another System class instance for the centroid and call all the other energy contribution functions, and then `GetRealGrads()`. This will get you the 2+-body contribution.
Since you are working with i-pi, you can use the MBX/i-pi interface as a reference, which is located in `plugins/i-pi/src/main/driver.cpp`. At line 221, the energy function is called, which could be replaced with the functions for just the contributions that you want.
Let us know if you are able to get something working.
-The MBX Team