Electrostatics simulations

168 views
Skip to first unread message

Elsaid Younes

unread,
Aug 31, 2021, 3:01:32 PM8/31/21
to hoomd...@googlegroups.com
Dear all,

I am simulating electrostatics of a system, but I am confused which units I should use. I use:
nm for length.
KT for temperature.
I do not know what I may use for charge; what I understand from the documents is to devide the charge by coulomb on (4*pi*permittviy constant of vaccuum.*distance*energy)^1/2, I do not what are the distance nor energy?

Is that ok to use temperature as T while calculating the Debye parameter?

Best,
Elsaid

Erik Navarro

unread,
Aug 31, 2021, 3:21:19 PM8/31/21
to hoomd...@googlegroups.com
HI Elsaid, You need to pick three fundamental units. From there you can derive a coherent unit system. 

The way I always do it is by writing at the top of a blank page " I take 1 nm to be my unit of distance", "I take 1 amu to be my unit of mass ",  "I take 1 kJ/mol to be my unit of energy"

From there, start deriving all the other units  based on these equations: Units — HOOMD-blue 2.9.7 documentation.

As a check to make sure you understand the process, take the choices of units from above and see if you can derive the units of time and velocity. For time you should get picoseconds for time, and for velocity you should get nm/picosecond. 

Sorry if I'm explaining something you already know, I just remember struggling with this a bit when I first started doing molecular dynamics. 

-Erik N


--
You received this message because you are subscribed to the Google Groups "hoomd-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/CAO9cOeAUkHNRZMJWUyZCc2QHt7L%2Bj24gQOLujxvfRF4RHWwjHA%40mail.gmail.com.

Elsaid Younes

unread,
Aug 31, 2021, 3:53:21 PM8/31/21
to hoomd...@googlegroups.com
Dear Erik,

Thanks for your reply!
I followed your answer, but I do not know how to apply it to convert the charge from coulomb to compatible unit to HOOMD0-blue.

Best,
Elsaid

Erik Navarro

unread,
Aug 31, 2021, 4:20:29 PM8/31/21
to hoomd...@googlegroups.com
Hi Elsaid, sounds like you're very close !

Take the equation you proposed before : (4*pi*permittviy constant of vaccuum.*distance*energy)^1/2

And plug in your units of distance and energy (which you chose). This will give you your unit of charge. 

-Erik N

Erik Navarro

unread,
Aug 31, 2021, 4:22:21 PM8/31/21
to hoomd...@googlegroups.com
Hi Elsaid, it's possible you're getting hung up on dimensional analysis. 

I like to use wolframalpha for this sort of thing. See the example below:

Erik Navarro

unread,
Aug 31, 2021, 4:22:51 PM8/31/21
to hoomd...@googlegroups.com

Elsaid Younes

unread,
Aug 31, 2021, 7:12:29 PM8/31/21
to hoomd...@googlegroups.com
Hi Erik,

Thanks for your time!
say my charge 10 coulombs and in order to convert into hoomd compatible unit, I should divide 10 by sqrt(4Pi*electric constant*1nm*1kj) right?
Then the vacuum permittivity constant equal to 8.85418782 × 10-12 m-3 kg-1 s4 A2, we have to convert these units into (nm-3 kg-1 picosecond4 A2) so we have to take this value times 10^-21 right?
the diameter of the charge which it is a sphere has no effect? why energy is 1 kj?

Best,
Elsaid

Erik Navarro

unread,
Aug 31, 2021, 7:15:16 PM8/31/21
to hoomd...@googlegroups.com
Hi Elsaid, 

Energy is very likely not 1 kJ in your system. 

I was just giving an example of how you can use wolfram to the dimensional analysis for you. 

Elsaid Younes

unread,
Sep 1, 2021, 1:58:21 AM9/1/21
to hoomd...@googlegroups.com
Hi Erik,

How can I know energy? What is D (1nm)?

Best,
Elsaid

Erik Navarro

unread,
Sep 1, 2021, 2:36:32 PM9/1/21
to hoomd...@googlegroups.com


Elsaid, you need to pick the energy and distance units. 

Please do not look too deeply into the wolfram link, I was merely using it as an example of how wolfram can help you do dimensional analysis. I put in random distance and energy units just to show you that wolfram would automatically convert the result to a charge (coulomb). 

If you are asking which units to pick, then I can't really help you because that will be specific to your system.

Maybe someone can chime in who knows of some resources that could help in this.

Good luck! 

-Erik N 




Michael Howard

unread,
Sep 1, 2021, 3:11:31 PM9/1/21
to hoomd-users
You should choose the system of units that makes most of your parameters close to order 1:

- For mass, try m = the smallest mass of a particle / atom in your system.

- For length, try d = the smallest diameter of a particle / atom in your system.

- For energy, try epsilon = the thermal energy (= kT at some reference temperature T, e.g., room temperature) or 1 kJ/mol.

Once you make these choices, all other units follow from these choices. For example:

- The unit of time is sqrt(m d^2/epsilon)

- The unit of charge is sqrt(4 pi epsilon_0 d epsilon), where epsilon_0 is the permittivity of vacuum.

To represent your model in these units, take the actual values and divide by the unit that you have chosen. These are the parameters that you will input to hoomd.

Regards,
Mike

Elsaid Younes

unread,
Sep 1, 2021, 4:37:33 PM9/1/21
to hoomd...@googlegroups.com
 Hi,

I have for example two types of particles A and B with diameters 4 and 150, so 'd' in 
sqrt(4 pi epsilon_0 d epsilon) 
will be dependent on particle type?

Best,
Elsaid

Joshua Anderson

unread,
Sep 1, 2021, 5:04:41 PM9/1/21
to hoomd...@googlegroups.com
Elsaid,

There is no `d` in Coulomb's constant: https://en.wikipedia.org/wiki/Electrostatics

Physical constants are universal properties and do not depend on particle types: https://en.wikipedia.org/wiki/Physical_constant

HOOMD computes electrostatic energy as V = q_i * q_j / r^2 (https://hoomd-blue.readthedocs.io/en/latest/module-md-long_range-pppm.html#hoomd.md.long_range.pppm.make_pppm_coulomb_forces).

With this formulation, the 4 * pi * \epsilon_0 that normally appears in the denominator has been factored into the units of the charge values q_i and q_j: V = (Q_i / sqrt(4 * pi * \epsilon_0) * (Q_j / sqrt(4 * pi * \epsilon_0) / r^2
where q_i = (Q_i / sqrt(4 * pi * \epsilon_0)

I hope this explanation makes sense to you. Now, can we please move on from asking the same questions over and over for months?
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan
> To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/CAO9cOeD1t-jV4ZvLBZkBOmPOVg2ThieEZhLk3Cs3QOLSMcm5iA%40mail.gmail.com.

Elsaid Younes

unread,
Sep 1, 2021, 6:12:15 PM9/1/21
to hoomd...@googlegroups.com
Hi,

My last question was on Mike's answer
The 'd' was in 

-  sqrt(4 pi epsilon_0 d epsilon)
Which the charge in coulomb would be divided on it, to make it compatible with hoomd.


Best,
Elsaid

Eric Irrgang

unread,
Sep 2, 2021, 6:09:40 AM9/2/21
to hoomd...@googlegroups.com
Thank you, Josh! I think "q_i = (Q_i / sqrt(4 * pi * \epsilon_0)" is the key takeaway.

A small clarification: it is the force (not the energy) that goes as r^-2 (but this doesn't change anything else about the conversation)

Eric Irrgang

unread,
Sep 2, 2021, 6:25:32 AM9/2/21
to hoomd...@googlegroups.com
Elsaid:
In Mike's answer, 'd' and 'epsilon' represent fundamental units of length and energy that you have chosen. https://hoomd-blue.readthedocs.io/en/latest/units.html just uses the words "length" and "energy".

Elsaid Younes

unread,
Sep 2, 2021, 1:20:14 PM9/2/21
to hoomd...@googlegroups.com
Hi,

Is +1C = 2997924579597146.0 HOOMD-blue unit of charge on (nm kg picosecond) scale?

Best,
Elsaid 

On Thu, Sep 2, 2021 at 12:25 PM Eric Irrgang <erici...@gmail.com> wrote:
Elsaid:
In Mike's answer, 'd' and 'epsilon' represent fundamental units of length and energy that you have chosen. https://hoomd-blue.readthedocs.io/en/latest/units.html just uses the words "length" and "energy".

--
You received this message because you are subscribed to the Google Groups "hoomd-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.

Michael Howard

unread,
Sep 2, 2021, 2:12:58 PM9/2/21
to hoomd-users
Elsaid,

I did not check if that value is correct, but it would be a terrible choice of system of units because it violates the general rule I told you:

You should choose the system of units that makes most of your parameters close to order 1.

3e15 is not order 1.

I share Josh's frustration that it feels like we are answering the same questions for you, but I will give an example below. Beyond this, and for probably the third or fourth time, I encourage you to do some type of tutorial or course on simulations before you try to ask questions here. We cannot teach you fundamental concepts of your research.

The example is KCl modeled crudely by a restricted primitive model. We'll say both ions have roughly the same diameter of 4 Angstrom and same mass of 40 g/mol, and the temperature is 298 K. If I used SI system, I would have length d = 1 meter, mass m = 1 kg, and energy epsilon = 1 J, but this would mean that the ion diameter is 4e-10 m, mass is 6.64e-26 kg, etc. These parameters are numerically terrible, so we will choose a better system of units based on the problem:

length d = diameter of ion = 4 Angstrom = 4e-10 m,
mass m = mass of ion = 40 g/mol
energy epsilon = kT = 4.11e-21 J = 2.47 kJ/mol

I gave you the formula for the unit of charge used in HOOMD (which absorbs the factor of 4 pi in the Coulomb potential, as Josh said), so you can compute it as:

charge q = sqrt(4 pi epsilon_0 d m) = sqrt(4*pi*(8.85e-12 C^2/J m)*(4e-10 m)*(4.11e-12 J)) = 1.35e-20 C

The diameter d(+), mass(+), and charge of K+ in this system of units are obtained by unit conversion:

d(+) = 4 Angstrom*(1 d/4 Angstrom) = 1.0 d
m(+) = 40 g/mol*(1 m/40 g/mol) = 1.0 m
q(+) = 1e*(1.60e-19 C/e)*(1 q/1.35e-20 C) = 11.85 q

This system of units is not unique: you could also take d = 1 nm, m = 1 g/mol, and epsilon = 1 kJ/mol (for example), and you would also get a pretty good scaling of your parameters. Other units, like time, can be computed in the same way as charge, and they will depend on what mapping you take.

Hopefully I didn't make any typos in this, ymmv.

Regards,
Mike

Elsaid Younes

unread,
Sep 9, 2021, 3:39:30 PM9/9/21
to hoomd...@googlegroups.com
Hi,

The unit of charge used in HOOMD: 
the charge in coulomb/ sqrt(4*pi*epsilon_0*length*epsilon)
If that is right, how is the charge depends on the temperature?
Where, sqrt(4*pi*epsilon_0*length*epsilon) = 1.3531906573239383e-20, 1.3757078546014194e-20 and 1.46231347042453e-20 for temperatures 298, 308 and 348 respectively?

Best,
Elsaid

Eric Irrgang

unread,
Sep 9, 2021, 4:49:24 PM9/9/21
to hoomd...@googlegroups.com


> On Sep 9, 2021, at 10:39 PM, Elsaid Younes <elk...@gmail.com> wrote:
>
> Hi,
>
> The unit of charge used in HOOMD:
> the charge in coulomb/ sqrt(4*pi*epsilon_0*length*epsilon)
> If that is right, how is the charge depends on the temperature?
> Where, sqrt(4*pi*epsilon_0*length*epsilon)

The charge does not depend on temperature.

Let me try one more time to explain.

1. Quantities in HOOMD are dimensionless (using "reduced units" as described in the docs).

2. Temperature is linked to the dimension (and units) of energy by the Boltzmann constant. kT has the dimension of energy (so an estimate or reference value of kT can help in choosing appropriate units for energy). You should vary your temperature only after choosing a consistent set of reduced units: https://hoomd-blue.readthedocs.io/en/stable/units.html#temperature-thermal-energy.

3. Dimensions (and units) of charge, length, and energy are linked by "permittivity". The previous answers and https://hoomd-blue.readthedocs.io/en/stable/units.html#charge fully describe the form of (dimensionless) reduced charge units used by HOOMD.

If there are remaining questions, I don't believe they are HOOMD questions.

I suggest reviewing https://en.wikipedia.org/wiki/Dimensional_analysis and googling "reduced units" or "reduced units molecular dynamics".

Best,
Eric

Elsaid Younes

unread,
Sep 10, 2021, 12:05:53 PM9/10/21
to hoomd...@googlegroups.com
Hi,

According to your documents:
" The units of charge are:
(4πε0DE)1/2. Divide a given charge by this quantity to convert it into an input value for HOOMD-blue."

The unit of charge used in HOOMD-blue for 1C charged ion of 4 Angstrom diameter is 1/(4πε0DE)1/2 with units A^-1*s^-1 = 7.389941650776647e+19.

But the units of (4πε0DE)1/2 is A.s =C.

Hopefully, that shows why I am confused!


Best,
Elsaid

--
You received this message because you are subscribed to the Google Groups "hoomd-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.

Michael Howard

unread,
Sep 10, 2021, 12:49:48 PM9/10/21
to hoomd-users
Did you work through the example I gave you? There was a typo in the charge formula but the substituted values and units were correct (fixed here):

charge q = sqrt(4 pi epsilon_0 d epsilon) = sqrt(4*pi*(8.85e-12 C^2/J m)*(4e-10 m)*(4.11e-12 J)) = 1.35e-20 C

using length d = 4 Angstrom and energy epsilon = kT @ T=298 K = 4.11e-12 J. This has units of charge (C), which is what we expect. I also showed you how to do the conversion of cation charge q(+) = +1 e in this unit system:

q(+) = 1e*(1.60e-19 C/e)*(1 q/1.35e-20 C) = 11.85 q

Regards,
Mike

Elsaid Younes

unread,
Sep 14, 2021, 2:01:33 PM9/14/21
to hoomd...@googlegroups.com
Dear all,

When I analyze the data from my simulation to calculate r.d.f. it gives me the following:
image.png

But the diameter of the particle is 150.

Best,
Elsaid

Eric Irrgang

unread,
Sep 15, 2021, 6:07:05 AM9/15/21
to hoomd...@googlegroups.com
It is not clear whether this question relates to the previous questions in this thread. I believe the current thread has been resolved.

If you have an example of a radial distribution function for a particular potential that you are having trouble reproducing, please ask a question in a new thread citing the previous work, and the script with which you attempted to reproduce.

If you don't have an example of prior work for the potential you are simulating, please ask a question in a new thread. Provide the script you use, explain the result you expect (and why), and explain how the results you obtain are different than the results you expect.

Congratulations, though. At first glance, this looks like a reasonable RDF for a small molecular dynamics simulation, if you are interpreting "diameter" to be two times the approximate equilibrium radius.

Best,
Eric

> On Sep 14, 2021, at 9:01 PM, Elsaid Younes <elk...@gmail.com> wrote:
>
> Dear all,
>
> When I analyze the data from my simulation to calculate r.d.f. it gives me the following:
> To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/CAO9cOeCzwdjzeVaR8vHm7Koz9CA5syKg-P1gN5rZ_tv82RnzAw%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages