how to visualize nvt thermostat

Dear lammps-users,

my question is quite basilar, actually, but I couldn't sort it out by reading the manual.

I'm running an equilibration with a nvt fix and I want to visualize, among other variables, even the thermostat (and thermostat velocity) values.

By reading the manual (the 'fix nvt' section) i understood that such variables should be stored in an internal vector which can be recalled with f_ID[i], so that "thermo_style custom f_ID[i]" should solve my problem.

What I couldn't understand is which is the vector elements I need.
In the manual is written that
"The vector stores internal Nose/Hoover thermostat and barostat variables. The number and meaning of the vector values depends on which fix is used and the settings for keywords tchain and pchain, which specify the number of Nose/Hoover chains for the thermostat and barostat. If no thermostatting is done, then tchain is 0. If no barostatting is done, then pchain is 0. [...]
The order of values in the global vector and their meaning is as follows.[...]
• eta[tchain] = particle thermostat displacements (unitless)
• eta_dot[tchain] = particle thermostat velocities (1/time units)
• omega[ndof] = barostat displacements (unitless)
• omega_dot[ndof] = barostat velocities (1/time units)

And also
"The keyword defaults are tchain = 3, pchain=3..."

From what I got, I should have tchain=3 (does it means there are 3 thermostats?) and pchain=0 (I'm not performing any barostatting). Are eta[tchain] and eta_dot[tchain] the variables I want (so f_ID[1] and f_ID[2])? I have clearly misunderstood something...

Sorry for my confusion, I hope to have been clear enough. Thanks in advance for any help and enlightment on this matter,

A. Giuntoli

I agree, it is a bit confusing. There is a lot of info stored
internally by the NH thermo/baro-stats, and the
fix tries to give you access to all of it. The variables
in the list like eta[tchain], mean that is a vector of
length tchain. So if tchain = 3, then n = 1,2,3 gives

you access to its elements. And n = 4,5,6 are the 3

elements of eta_dot, since it comes next, etc.

Aidan can explain the details better than me.

If you can read C, you can look at the compute_vector()
method in src/fix_nh.cpp and see the long list of

things it outputs. All the code is about converting

N = the index you specify (minus 1) into an index
into a specific vector and specific element within
the vector.


The reason why you are confused is because the NH thermostat/barostat is powerful and complicated. To understand it properly you have to a) look at the code and b) read the citations on which the code is based. The purpose of the LAMMPS doc page is to use it, not to understand it. I could tell you to look at elements i1 and i2 for the position and velocity of the first thermostat degree of freedom, which is probably what you are after. But what good would that do you? You would not have any idea what you were looking at, e.g. what units are used. I suggest you first read the cited paper by Tuckerman. Then look at the code. After that, the definition of tchain will be obvious. Generally, I like to print out all the variables that are available and figure out which ones I really care about afterwards. If you run the default nvt thermostat, tchain = 3, so you can access f_1[1],…,f_1[12]. If you set tchain=1, you will recover the original NH thermostat of Hoover. In this case, i1 = 1, and i2 = 2. Don’t expect the units to be the same as those in Hoover’s paper.