Velocity of certain region

As Steve suggested,
Define a variable of atom style

variable v_z atom contt*x

Then use the velocity command to your group say “upper”

velocity upper set v_z 0.0 0.0 [units box sum yes]

The [] elements might be needed as per your requirements.

Thanks,

Thanks for the suggestions. I got an error " variable name for velocity does not exist" for the following code.

---------- Initialize Simulation ---------------------

units metal
dimension 3
boundary p p s
atom_style atomic

---------- Create Atoms ---------------------

lattice custom 4.35 origin 0.0 0.0 0.0 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1 &
basis 0.0 0.0 0.0 &
basis 0.5 0.0 0.5 &
basis 0.0 0.5 0.5 &
basis 0.5 0.5 0.0 &
basis 0.25 0.25 0.25 &
basis 0.75 0.25 0.75 &
basis 0.25 0.75 0.75 &
basis 0.75 0.75 0.25 &
a1 1.0 0.0 0.0 &
a2 0.0 1.0 0.0 &
a3 0.0 0.0 1.0
region box block -8.7 8.7 -8.7 8.7 -8.7 8.7
region box1 block -8.7 8.7 -8.7 8.7 -8.7 0
region box2 block -8.7 8.7 -8.7 8.7 0 8.7
create_box 2 box
create_atoms 1 box &
basis 1 1 &
basis 2 1 &
basis 3 1 &
basis 4 1 &
basis 5 2 &
basis 6 2 &
basis 7 2 &
basis 8 2
mass 1 28.08
mass 2 12.01
group 1 region box1
group 2 region box2

---------- Define Interatomic Potential ---------------------

pair_style tersoff
pair_coeff * * SiC.tersoff Si C

---------- Define Settings ---------------------

thermo_style custom step temp pe etotal press vol
thermo 10

compute 1 all temp
compute 2 all ke/atom
compute 3 all pe/atom
compute 4 all stress/atom NULL
compute 5 all pressure thermo_temp

fix 1 all nvt temp 300.0 300.0 1.0
dump 1 all xyz 100 riaz.xyz
run 2
variable v_vz atom z*0.01
velocity 1 set 0.0 0.0 v_vz
run 20

I could not figure out why this happening. Can anyone pls help. Thanks.

Your following part has issue:
"
variable v_vz atom z*0.01
velocity 1 set 0.0 0.0 v_vz

"
Just redefine variable as “vz” not v_vz
Also please refer to variable command in manual for better understanding of ‘v_’ use.

Thanks

Hello,

I got an error mentioning " expected floating point parameter in input script …/velocity.cpp " for the following commands.

“fix 1 all nvt temp 300.0 300.0 1.0
dump 1 all xyz 100 riaz.xyz
run 2
variable v atom z*0.01
velocity 1 set 0.0 0.0 v
run 20”

I think the velocity is already set as a floating point parameter as I am multiplying the z position of each atom with 0.01 to set the velocity. Can anyone please suggest whats the issue. Thanks.

Hello,
I got an error mentioning " expected floating point parameter in input
script ...../velocity.cpp " for the following commands.

"fix 1 all nvt temp 300.0 300.0 1.0
dump 1 all xyz 100 riaz.xyz
run 2
variable v atom z*0.01
velocity 1 set 0.0 0.0 v
run 20"

I think the velocity is already set as a floating point parameter as I am
multiplying the z position of each atom with 0.01 to set the velocity. Can
anyone please suggest whats the issue. Thanks.

this line has to be the culprit.

velocity 1 set 0.0 0.0 v

variable references in such a context usually require a v_ prefix. try:

velocity 1 set 0.0 0.0 v_v

and check very carefully with the documentation.

axel.