# [lammps-users] thermostating different region

Dear lammps users,

I am having a problem in thermostating two different regions with two different temperatures. I am using the following code

units real
boundary p p p
region 1 block xlo xhi ylo yhi zlo zhi
region 2 block xlo1 hxi1 ylo1 yhi1 zlo1 zhi1

group myatom type 1 2 5 6
group myatom1 type 3 4 5 6

velocity myatom create 140.0 23482341 mom yes rot yes dist gaussian

velocity myatom1 create 420.0 23482341 mom yes rot yes dist gaussian

timestep 1.0
run_style verlet
fix 1 all nve

compute 1 myatom temp/region 1
fix 2 myatom temp/rescale 1 140.0 140.0 0.04 1
fix_modify 2 temp 1

compute 2 myatom1 temp/region 2
fix 3 myatom1 temp/rescale 1 420.0 420.0 0.04 1
fix_modify 3 temp 2

If I calculate the temperature of atom type
5 and 6 from their velocities I should get 140.0K in region1 and 420.0K in region2. But I am not getting that. Could anybody help me out where I am going wrong?

kind regards

Dear lammps users,

I am having a problem in thermostating two different regions with two
different temperatures. I am using the following code

units real
boundary p p p
region 1 block xlo xhi ylo yhi zlo zhi
region 2 block xlo1 hxi1 ylo1 yhi1 zlo1 zhi1

group myatom type 1 2 5 6
group myatom1 type 3 4 5 6

velocity myatom create 140.0 23482341 mom yes rot yes dist gaussian

velocity myatom1 create 420.0 23482341 mom yes rot yes dist gaussian

timestep 1.0
run_style verlet
fix 1 all nve

compute 1 myatom temp/region 1
fix 2 myatom temp/rescale 1 140.0 140.0 0.04 1
fix_modify 2 temp 1

compute 2 myatom1 temp/region 2
fix 3 myatom1 temp/rescale 1 420.0 420.0 0.04 1
fix_modify 3 temp 2

If I calculate the temperature of atom type
5 and 6 from their velocities I should get 140.0K in region1 and 420.0K in
region2. But I am not getting that. Could anybody help me out where I am
going wrong?

you are rescaling multiple atom types at the same time,
so only the temperature of the _total_ group of atoms in
the region is scaled to the desired value. since you are
using scaling, equipartitioning of the kinetic energy
between different atoms in those groups is not given.

axel.

More precisely, it looks like you are initializing
some atoms twice, b/c atoms of type 5,6 are
in both groups. So it may be that you are
starting some atoms far from the desired T
(420 vs 140) and thus are having problems.

Can you make the atoms in the different regions
of different types?

Steve

Dear Steve and Axel,

Whatever you have commented are true. I agree. But I have tried in the following way also

region 1 block xlo xhi ylo yhi zlo zhi
region 2 block xlo1 xhi1 ylo1 yhi1 zlo1 zhi1

group atom1 type 1 2
group atom2 type 3 4
group atom3 type 5 6

# intially group atom3 is in region1 and #then it moves to the other region also #whereas group atom1 and atom2 remain #in region 1 and region 2 repectively with #small vibration around eq. position. like #zelite atoms

velocity atom1 create 140.0 23482341 mom yes rot yes dist gaussian

velocity atom2 create 420.0 23482341 mom yes rot yes dist gaussian

velocity atom3 create 140.0 23482341 mom yes rot yes dist gaussian

compute 1 atom3 temp/region 1
fix 1 atom3 nvt 140.0 140.0 100.0
fix_modify 1 temp 1

compute 2 atom3 temp/region 2
fix 2 atom3 nvt 420.0 420.0 100.0
fix_modify 2 temp 2

I used this code and then calculated temperature from the velocities of group atom3. I should have got 140K in region 1 and 420K in region 2. I did not. The group atom3 is moving throughout the simulation and the other groups are just some vibrating solid framework like zeolite. So my idea is to get different temperature of group atom3 in the two different regions. And I dont bother whatever temperature the other group of atoms are feeling. Any comments are appreciated.

kind regards

group atom3. I should have got 140K in region 1 and 420K in region 2. I did
not. The group atom3 is moving throughout the simulation and the other

so what _did_ you get?

groups are just some vibrating solid framework like zeolite. So my idea is
to get different temperature of group atom3 in the two different regions.

i don't understand this. what you describe doesn't make any sense to me.
if the particles can move around freely, why should they have two
(tightly!) fixed temperatures. how many particles of type atom3 are
there anyways? have you considered instantaneos temperatures can
fluctuate a lot, if there are only a small number of particles?

And I dont bother whatever temperature the other group of atoms are feeling.

without posting a complete input so that one can reproduce
all your input fragments dont' make much sense.

axel.

We can ignore atom1 and atom2 groups in your script lines below,
since atom3 is the only relevant one for Temp. It looks
like you are initializing all atom3 atoms to 140K, in both
regions. Is that the initial (time 0) temp you get
for both compute 1 and 2? They you are doing Nose/Hoover
at 420 on atoms that are initially at 140. That will
lead to big oscillations but should eventually settle
down to 420. Note that if you have atoms moving
rapidly in/out of 2 regions then it is hard to thermostat
them only within the region. If the 2 regions
are close together, that will further complicate things.

Steve