Thermostatting only a portion of a LAMMPS simulation box is straightforward, but is done in a way which isn’t at all intuitive to me. In fairness, both the manual and mailing list archives make the approach relatively clear. Having said that, I rather suspect that it might be something that most people have to see to believe.
Let’s say we have a tetragonal simulation box, a = b < c, α = β = γ = 90°, and we want to set up a temperature gradient along the long side. We can do this by heating one part of the box to a temperature TH, and cooling another part to TC. For the sake of a simple example, we’ll do this with simple velocity rescaling. The relevant LAMMPS command is
Of course, we need to limit the effect of these fixes to particular regions. Let’s assume a box of a = 20, b = 20, c = 100, with a “hot region” from (0, 0, 0) to (10, 20, 20), and a “cold region” from (50, 0, 0) to (60, 20, 20). Placing the cold region in the middle of the box allows us to make all three boundaries periodic.
fix temp/rescale
. The following commands adjust the temperature by velocity rescaling every 10 timesteps, to TH = 3.0 and TC = 1.5. The remaining parameters, window
and scale
are explained on the linked manual page.
fix hot_rescale all temp/rescale 10 3.0 3.0 0.0001 1.0
fix cold_rescale all temp/rescale 10 1.5 1.5 0.0001 1.0
Of course, we need to limit the effect of these fixes to particular regions. Let’s assume a box of a = 20, b = 20, c = 100, with a “hot region” from (0, 0, 0) to (10, 20, 20), and a “cold region” from (50, 0, 0) to (60, 20, 20). Placing the cold region in the middle of the box allows us to make all three boundaries periodic.
We first have to define the regions to be thermostatted using the
We define
Finally, we must modify our thermostatting fixes to only adjust the temperature in the two defined regions. This is done by using a
region
command:
region hot block 0 10 0 20 0 20 units box
region cold block 50 60 0 20 0 20 units box
We define
computes
which calculate the temperature of our regions:
compute hot_temp all temp/region hot
compute cold_temp all temp/region cold
Finally, we must modify our thermostatting fixes to only adjust the temperature in the two defined regions. This is done by using a
fix_modify
command to change the way each of the thermostat fixes calculates the current temperature:
fix_modify hot_rescale temp hot_temp
fix_modify cold_rescale temp cold_temp
And that’s all there is to it. Don’t believe me? Try it!
Source: https://goo.gl/6YfQPt
No comments:
Post a Comment