Hi all,
I have a data-file containing coordinate-temperature pairs, and would like to scale the temperature of my simulation box based on these values, creating a temperature profile. Since fix langevin can take Tstart in as an atom style variable, I would like to try to create the temperature profile using an atom style variable, which would contain the temperature as a function of the x- and y-coordinates. However, to read in the temperature data, I have been using the python interface, and have not been able to connect this and creating the atom style variable.
Is there a way to have an atom style variable determined by a python function (i.e. variable myvar atom myfunc(x, y))? Or is there another simpler way to achieve the temperature profile that I have not considered using pre-existing Lammps features? I am using Lammps version 17 Apr 2024.
Thanks for your help
1 Like
No. Not when myfunc() is a python function. But anything analytical can be represented with an atom style variable. The following will, for example, create a cylindrical temperature profile around the center of the box between 100 at the edges and 400 temperature units in the center
variable xfrac atom (2.0*(x-xlo)/lx)-1.0
variable yfrac atom (2.0*(y-ylo)/ly)-1.0
variable temp atom 400.0-150.0*(v_xfrac*v_xfrac+v_yfrac*v_yfrac)
What functional form does that profile have to have? You can use a thermostat with a temperature bias as explained here: 8.2.4. Thermostats β LAMMPS documentation
The temperature profile consists of interpolated data from a COMSOL simulation. Unfortunately I do not have its analytical form, which is why I would like to query the temperature based on atom position.
Then I see two possible ways to address your problem (there may be more, but this is what I can think of right now):