# compute temp/com

Hi,
few days ago I saw a post regarding shock simulation and comments by Ray Shan, oscar G,…i’m really interested to know that, is there any fix to compute temp/com like value spatialy averaged by using ave/spatial ? I checked the documentation and learn that temp/com compute global basis not per atom basis, so how can i get values spatially averaged.

like temperature, is it not so that such com’s transnational kinetic energy ( momentum mirror method in shock generation) also have effect on pressure and kinetic energy ?
How can I compute those after subtracting com velocity ?

Hi Paul,

few days ago I saw a post regarding shock simulation and comments by Ray
Shan, oscar G,..i'm really interested to know that, is there any fix to
compute temp/com like value spatialy averaged by using ave/spatial ? I
checked the documentation and learn that temp/com compute global basis not
per atom basis, so how can i get values spatially averaged.

You may define regions, apply a compute temp/com to each of these
regions, then use fix ave/spatial to obtain each region's averaged
temp with V_com removed.

like temperature, is it not so that such com's transnational kinetic energy
( momentum mirror method in shock generation) also have effect on pressure
and kinetic energy ?

Yes, P and KE are affected by the removal of V_com. You may calculate
P and KE for each regions after subtracting V_com, which I post
process.

Hi Paul,

few days ago I saw a post regarding shock simulation and comments by Ray
Shan, oscar G,…i’m really interested to know that, is there any fix to
compute temp/com like value spatialy averaged by using ave/spatial ? I
checked the documentation and learn that temp/com compute global basis not
per atom basis, so how can i get values spatially averaged.

You may define regions, apply a compute temp/com to each of these
regions, then use fix ave/spatial to obtain each region’s averaged
temp with V_com removed.

compute temp/com produce a global scalar (the temperature) and a global vector of length 6 (KE tensor) , then how can I use ave/spatial to average out spatially, where ave/spatial required a compute that output per-atom basis ?

like temperature, is it not so that such com’s transnational kinetic energy
( momentum mirror method in shock generation) also have effect on pressure
and kinetic energy ?

Yes, P and KE are affected by the removal of V_com. You may calculate
P and KE for each regions after subtracting V_com, which I post
process.

for KE if I set calculation as E= 3/2 KT, where this T is after removal of V_com and computed by temp/com then should I get the global KE ? How can i make it spatially averaged ?

could you give any clue, how can I post-process to get P, KE after removal of V_com ?

> few days ago I saw a post regarding shock simulation and comments by Ray
> Shan, oscar G,..i'm really interested to know that, is there any fix to
> compute temp/com like value spatialy averaged by using ave/spatial ? I
> checked the documentation and learn that temp/com compute global basis
> not
> per atom basis, so how can i get values spatially averaged.

You may define regions, apply a compute temp/com to each of these
regions, then use fix ave/spatial to obtain each region's averaged
temp with V_com removed.

compute temp/com produce a global scalar (the temperature) and a global
vector of length 6 (KE tensor) , then how can I use ave/spatial to average
out spatially, where ave/spatial required a compute that output per-atom
basis ?

by velocity command with style "set" and keyword "sum yes"? I am not
sure if this will work, but you can apply the above command to have
V_com removed from each per-atom velocity for each region.

> like temperature, is it not so that such com's transnational kinetic
> energy
> ( momentum mirror method in shock generation) also have effect on
> pressure
> and kinetic energy ?

Yes, P and KE are affected by the removal of V_com. You may calculate
P and KE for each regions after subtracting V_com, which I post
process.

for KE if I set calculation as E= 3/2 KT, where this T is after removal of
V_com and computed by temp/com then should I get the global KE ? How can i
make it spatially averaged ?

could you give any clue, how can I post-process to get P, KE after removal
of V_com ?

KE is the easy one: just subtract V_com from each per-atom V, then use
the energy-velocity relation.

P is only a little more complicated. A volume V being pressed by a
piston has P*V work being done to the system. Using the work-energy
principle, you can estimate P from per-atom velocities, while these
velocities also have V_com subtracted. You can estimate P for each
region, given V for each region is defined.

Cheers,
Ray

few days ago I saw a post regarding shock simulation and comments by Ray
Shan, oscar G,…i’m really interested to know that, is there any fix to
compute temp/com like value spatialy averaged by using ave/spatial ? I
checked the documentation and learn that temp/com compute global basis
not
per atom basis, so how can i get values spatially averaged.

You may define regions, apply a compute temp/com to each of these
regions, then use fix ave/spatial to obtain each region’s averaged
temp with V_com removed.

compute temp/com produce a global scalar (the temperature) and a global
vector of length 6 (KE tensor) , then how can I use ave/spatial to average
out spatially, where ave/spatial required a compute that output per-atom
basis ?

by velocity command with style “set” and keyword “sum yes”? I am not
sure if this will work, but you can apply the above command to have
V_com removed from each per-atom velocity for each region.

which command you are suggesting to compute per atom velocity after subtracting V_com ?
Do you suggest to use different style and keyword for that ? please mention which one ?
yes i am using “set” & “sum” to set com velocity , and temp/com to get global temperature.

like temperature, is it not so that such com’s transnational kinetic
energy
( momentum mirror method in shock generation) also have effect on
pressure
and kinetic energy ?

Yes, P and KE are affected by the removal of V_com. You may calculate
P and KE for each regions after subtracting V_com, which I post
process.

for KE if I set calculation as E= 3/2 KT, where this T is after removal of
V_com and computed by temp/com then should I get the global KE ? How can i
make it spatially averaged ?

could you give any clue, how can I post-process to get P, KE after removal
of V_com ?

KE is the easy one: just subtract V_com from each per-atom V, then use
the energy-velocity relation.

P is only a little more complicated. A volume V being pressed by a
piston has P*V work being done to the system. Using the work-energy
principle, you can estimate P from per-atom velocities, while these
velocities also have V_com subtracted. You can estimate P for each
region, given V for each region is defined.

I’m trying to look with this.

Thanks for feedback.

by velocity command with style "set" and keyword "sum yes"? I am not
sure if this will work, but you can apply the above command to have
V_com removed from each per-atom velocity for each region.

which command you are suggesting to compute per atom velocity after
subtracting V_com ?

i don't understand the fuss about "computing" velocities. velocities
are required per atom properties and thus are immediately available
for atom style variables. nothing needs to be computed since you
cannot do MD without them.

axel.

by velocity command with style “set” and keyword “sum yes”? I am not
sure if this will work, but you can apply the above command to have
V_com removed from each per-atom velocity for each region.

which command you are suggesting to compute per atom velocity after
subtracting V_com ?

i don’t understand the fuss about “computing” velocities. velocities
are required per atom properties and thus are immediately available
for atom style variables. nothing needs to be computed since you
cannot do MD without them.

i’m setting additional velocity in each atom by velocity command with style “set” and keyword “sum yes” to move my system towards a particular direction ( for shock generation ) i.e. towards the mirror (fix wall/reflect) ; now my sample have some transnational kinetic energy of center-of-mass. So if I apply atom style variable vx, vy or vz, certainly it will compute per-atom velocity but some component due to the com velocity will be there included. Now I need to have the per-atom velocity after subtracting the c-o-m vel component. How can I get this per atom velocity ?

Thanks

Swain Paul

>> by velocity command with style "set" and keyword "sum yes"? I am not
>> sure if this will work, but you can apply the above command to have
>> V_com removed from each per-atom velocity for each region.
>
> which command you are suggesting to compute per atom velocity after
> subtracting V_com ?

i don't understand the fuss about "computing" velocities. velocities
are required per atom properties and thus are immediately available
for atom style variables. nothing needs to be computed since you
cannot do MD without them.

i'm setting additional velocity in each atom by velocity command with style
"set" and keyword "sum yes" to move my system towards a particular direction
( for shock generation ) i.e. towards the mirror (fix wall/reflect) ; now my
sample have some transnational kinetic energy of center-of-mass. So if I
apply atom style variable vx, vy or vz, certainly it will compute per-atom
velocity but some component due to the com velocity will be there included.
Now I need to have the per-atom velocity after subtracting the c-o-m vel
component. How can I get this per atom velocity ?

exactly how you described it. subtract the COM velocity and then you have it.

axel.

by velocity command with style “set” and keyword “sum yes”? I am not
sure if this will work, but you can apply the above command to have
V_com removed from each per-atom velocity for each region.

which command you are suggesting to compute per atom velocity after
subtracting V_com ?

i don’t understand the fuss about “computing” velocities. velocities
are required per atom properties and thus are immediately available
for atom style variables. nothing needs to be computed since you
cannot do MD without them.

i’m setting additional velocity in each atom by velocity command with style
“set” and keyword “sum yes” to move my system towards a particular direction
( for shock generation ) i.e. towards the mirror (fix wall/reflect) ; now my
sample have some transnational kinetic energy of center-of-mass. So if I
apply atom style variable vx, vy or vz, certainly it will compute per-atom
velocity but some component due to the com velocity will be there included.
Now I need to have the per-atom velocity after subtracting the c-o-m vel
component. How can I get this per atom velocity ?

exactly how you described it. subtract the COM velocity and then you have it.

I have computed “temp” using “thermo_style” and simultaneously I have computed “temp/com”, to see the difference between vel and vel after subtracting v_com, I get result 5100K and 58K for a given instantaneous timestep. So surely the v_com have effect on those variables which I need to have, isn’t it ?
Once I get the vel after subtracting v_com, i can post process to get the required variables like KE, pressure etc.
Am I missing something ?

>
>
>>
>>
>> >> by velocity command with style "set" and keyword "sum yes"? I am
>> >> not
>> >> sure if this will work, but you can apply the above command to have
>> >> V_com removed from each per-atom velocity for each region.
>> >
>> > which command you are suggesting to compute per atom velocity after
>> > subtracting V_com ?
>>
>> i don't understand the fuss about "computing" velocities. velocities
>> are required per atom properties and thus are immediately available
>> for atom style variables. nothing needs to be computed since you
>> cannot do MD without them.
>
>
> i'm setting additional velocity in each atom by velocity command with
> style
> "set" and keyword "sum yes" to move my system towards a particular
> direction
> ( for shock generation ) i.e. towards the mirror (fix wall/reflect) ;
> now my
> sample have some transnational kinetic energy of center-of-mass. So if
> I
> apply atom style variable vx, vy or vz, certainly it will compute
> per-atom
> velocity but some component due to the com velocity will be there
> included.
> Now I need to have the per-atom velocity after subtracting the c-o-m vel
> component. How can I get this per atom velocity ?

exactly how you described it. subtract the COM velocity and then you have
it.

I have computed "temp" using "thermo_style" and simultaneously I have
computed "temp/com", to see the difference between vel and vel after
subtracting v_com, I get result 5100K and 58K for a given instantaneous
timestep. So surely the v_com have effect on those variables which I need to
have, isn't it ?

sure. but why do you need to compute the temperature to access the velocities?

Once I get the vel after subtracting v_com, i can post process to get the
required variables like KE, pressure etc.
Am I missing something ?

obviously. i don't understand what you are asking. all the information
you are asking for is readily available. what is so difficult in doing
something like this?

axel.

by velocity command with style “set” and keyword “sum yes”? I am
not
sure if this will work, but you can apply the above command to have
V_com removed from each per-atom velocity for each region.

which command you are suggesting to compute per atom velocity after
subtracting V_com ?

i don’t understand the fuss about “computing” velocities. velocities
are required per atom properties and thus are immediately available
for atom style variables. nothing needs to be computed since you
cannot do MD without them.

i’m setting additional velocity in each atom by velocity command with
style
“set” and keyword “sum yes” to move my system towards a particular
direction
( for shock generation ) i.e. towards the mirror (fix wall/reflect) ;
now my
sample have some transnational kinetic energy of center-of-mass. So if
I
apply atom style variable vx, vy or vz, certainly it will compute
per-atom
velocity but some component due to the com velocity will be there
included.
Now I need to have the per-atom velocity after subtracting the c-o-m vel
component. How can I get this per atom velocity ?

exactly how you described it. subtract the COM velocity and then you have
it.

I have computed “temp” using “thermo_style” and simultaneously I have
computed “temp/com”, to see the difference between vel and vel after
subtracting v_com, I get result 5100K and 58K for a given instantaneous
timestep. So surely the v_com have effect on those variables which I need to
have, isn’t it ?

sure. but why do you need to compute the temperature to access the velocities?

not like that I need T, P, KE etc per atom basis to do ave/spatial further. For that I need to have per atom velocity after that I formulate all the required variables. This temp/com is just to get global temperature after subtracting v_com, not to get velocity using this.

Once I get the vel after subtracting v_com, i can post process to get the
required variables like KE, pressure etc.
Am I missing something ?

obviously. i don’t understand what you are asking. all the information
you are asking for is readily available. what is so difficult in doing
something like this?

is v_cm = center of mass of my group or vcm = center of mass velocity ? what this gmask(mygroup) ?

by velocity command with style “set” and keyword “sum yes”? I am
not
sure if this will work, but you can apply the above command to have
V_com removed from each per-atom velocity for each region.

which command you are suggesting to compute per atom velocity after
subtracting V_com ?

i don’t understand the fuss about “computing” velocities. velocities
are required per atom properties and thus are immediately available
for atom style variables. nothing needs to be computed since you
cannot do MD without them.

i’m setting additional velocity in each atom by velocity command with
style
“set” and keyword “sum yes” to move my system towards a particular
direction
( for shock generation ) i.e. towards the mirror (fix wall/reflect) ;
now my
sample have some transnational kinetic energy of center-of-mass. So if
I
apply atom style variable vx, vy or vz, certainly it will compute
per-atom
velocity but some component due to the com velocity will be there
included.
Now I need to have the per-atom velocity after subtracting the c-o-m vel
component. How can I get this per atom velocity ?

exactly how you described it. subtract the COM velocity and then you have
it.

I have computed “temp” using “thermo_style” and simultaneously I have
computed “temp/com”, to see the difference between vel and vel after
subtracting v_com, I get result 5100K and 58K for a given instantaneous
timestep. So surely the v_com have effect on those variables which I need to
have, isn’t it ?

sure. but why do you need to compute the temperature to access the velocities?

not like that I need T, P, KE etc per atom basis to do ave/spatial further. For that I need to have per atom velocity after that I formulate all the required variables. This temp/com is just to get global temperature after subtracting v_com, not to get velocity using this.

Once I get the vel after subtracting v_com, i can post process to get the
required variables like KE, pressure etc.
Am I missing something ?

obviously. i don’t understand what you are asking. all the information
you are asking for is readily available. what is so difficult in doing
something like this?

is v_cm = center of mass of my group or vcm = center of mass velocity ? what this gmask(mygroup) ?

sorry I got gmask as a special variable, documented in lammps manual. But if vcm = velocity of center of mass, how can I get ?

it always helps to have a look at the documentation. you can start here:

http://lammps.sandia.gov/doc/variable.html

You can define an atom-style variable that calculates
the KE (i.e. temperature) of each atom, and subtracts
off the COM velocity in the calculation, by using the
variable group commands. You can then use fix ave/spatial
with that variable.

Steve