making monomer only calculations

37 views
Skip to first unread message

Janos Daru

unread,
Apr 15, 2025, 11:25:35 AMApr 15
to MBX-users
Dear Developers,

I want to perform periodic MBX calculations, switching off all terms beyond 1-body terms, hopefully without the overhead from the unnecessary electrostatics, dispersion, and 2/3-body terms. Can this be set up via the present input structure?

Many thanks in anticipation,

János Daru 

Philip Zhu

unread,
Apr 15, 2025, 11:56:08 AMApr 15
to MBX-users
Hi János

If I understanding correctly, you want to calculate the sum of all individual, isolated monomer energies. Then you need to unwrap your coordinates first, then you can 


option 1. prepare an “.nrg” files for each monomer (you can search for example format in examples/ folder, and there’s script to convert xyz to nrg files in scripts/ folder), and use “singlepoint” to calculate the monomer energies. You need to write another script to add them up. 

option 2. prepare an “nrg” file for the entire system, after it is unwrapped. then you can use “mb_decomp” with flag options of setting max order to 1. Then it will calculate all monomer energies. In this way you don’t need to prepare nrg file for every monomer.

Since you don’t want any interactions of molecules with it’s own periodic images, if i understand correctly, all calculations will not be using periodic boxes (which is the default in singlepoint/mb_decomp, while you can change this via mbs.json file).

Both singlepoint and mb_decomp are  in bin/ folder if you compile without mpi (see Readme). 

Ethan Bull-Vulpe

unread,
Apr 15, 2025, 11:09:42 PMApr 15
to MBX-users
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
Reply all
Reply to author
Forward
0 new messages