# Using tabulated potentials in gromacs

**URL:** <https://gromacs.bioexcel.eu/t/using-tabulated-potentials-in-gromacs/1753>\
**Category:** User discussions\
**Tags:** forcefield\
**Created:** [March 15, 2021, 3:13pm UTC](https://gromacs.bioexcel.eu/t/using-tabulated-potentials-in-gromacs/1753 "2021-03-15T15:13:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![megamence](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@megamence](https://gromacs.bioexcel.eu/u/megamence)\
**Post date:** [March 15, 2021, 3:13pm UTC](https://gromacs.bioexcel.eu/t/using-tabulated-potentials-in-gromacs/1753/1 "2021-03-15T15:13:22Z")

</div>

GROMACS version: 2020.5  
GROMACS modification: No

I am running a coarse-grained simulation using iterative Boltzmann Inversion in GROMACS. For this simulation, I am using a custom potential which is  
V = -kT\*log(g®)  
where g® is the rdf of the all-atom simulation. i do not have g® in a symbolic form, but in the form of tuples, (r, g®). In order for me to use this custom potential V, I believe I would need to use tabulated potentials in GROMACS.

I look at this piece of [documentation](https://manual.gromacs.org/documentation/current/reference-manual/special/tabulated-interaction-functions.html), and I see that if I generate a cubic splines between my points in (r,g®), I can make my tabulated potentials.

My question is, how do I make such custom tabulated potentials? Most of the files I see are for LJ potentials, but what if I have a custom potential of the form I have mentioned above?

---

<div class="post-metadata">

**Author:** ![alevilla](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/alevilla/32/439_2.png) [@alevilla](https://gromacs.bioexcel.eu/u/alevilla)\
**Post date:** [March 16, 2021, 10:14am UTC](https://gromacs.bioexcel.eu/t/using-tabulated-potentials-in-gromacs/1753/2 "2021-03-16T10:14:40Z")

</div>

Hi,  
Please note that to use tabulated potential you have to use GROMACS 2018 (the options is not active from 2019 and it will probably come back in the future)  
As described in the documentation [Tabulated interaction functions — GROMACS 2021.1 documentation](https://manual.gromacs.org/current/reference-manual/special/tabulated-interaction-functions.html?highlight=tabulated%20potential)

The potential function is defined as

V(rij) = (qiqj/4πϵ0) \* f(rij) + C6 \* g(rij) + C12\* h(rij)

where C6, C12 and the charges are read from the topology.  
To generate the tabulated potential for your potential  
I suggest is to assign a value of 1 to C6 and C12 (in the topology), then you can set g(rij) = 0 for any rij, thus you have  
h(rij) = V  
It is always good to run a small test to check that the potential is implemented correct.

I hope it helps. You can also have a look to previuos posts on “tabulated potential” [Search results for 'tabulated potential' - GROMACS forums](https://gromacs.bioexcel.eu/search?q=tabulated%20potential)

Alessandra

---

<div class="post-metadata">

**Author:** ![megamence](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@megamence](https://gromacs.bioexcel.eu/u/megamence)\
**Post date:** [March 16, 2021, 12:59pm UTC](https://gromacs.bioexcel.eu/t/using-tabulated-potentials-in-gromacs/1753/3 "2021-03-16T12:59:46Z")

</div>

@alevilla thank you for your response! So that is exactly what I have done. What I am wondering about is, what should my value of k (Boltzmann’s constant) be? Plugging in 1.38e-23 seems incorrect. How do the units work? For example, in the 6-9 LJ fluid, they simply plug in 1/r^9 in the C12 column. 1/r^9 has units of 1/(nm)^9, but the units of C12 is 4epsilon_sigma^12 has units of kJ/mol_(nm)^12

---

<div class="post-metadata">

**Author:** ![alevilla](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/alevilla/32/439_2.png) [@alevilla](https://gromacs.bioexcel.eu/u/alevilla)\
**Post date:** [March 16, 2021, 1:09pm UTC](https://gromacs.bioexcel.eu/t/using-tabulated-potentials-in-gromacs/1753/4 "2021-03-16T13:09:27Z")

</div>

Hi  
here you find the units and definition used in GROMACS [Definitions and Units — GROMACS 2021.1 documentation](https://manual.gromacs.org/current/reference-manual/definitions.html?highlight=unit)  
\Alessandra

---

<div class="post-metadata">

**Author:** ![megamence](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@megamence](https://gromacs.bioexcel.eu/u/megamence)\
**Post date:** [March 16, 2021, 1:12pm UTC](https://gromacs.bioexcel.eu/t/using-tabulated-potentials-in-gromacs/1753/5 "2021-03-16T13:12:56Z")

</div>

@alevilla wow, I see. Thank you!
