1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
units lj
lattice fcc 0.8442
boundary f f f
region ball sphere 0.0 0.0 0.0 5.0
region box block -10 10 -10 10 -10 10
region half block -10 0 -10 10 -10 10
# add molecule ids so we can use chunk/atom
fix 0 all property/atom mol ghost yes
create_box 2 box
create_atoms 1 region ball
pair_style lj/cut 4.0
pair_coeff * * 1.0 1.0
mass * 1.0
set group all mol 1
# label half the sphere with a different type for better visualization
set region half type 2
# use a dynamic group (may require a patch to fix addtorque with older versions of LAMMPS)
group ball dynamic all region ball
neigh_modify delay 2 every 1 check yes
minimize 0.0 0.0 1000 10000
reset_timestep 0
velocity all create 1.2 12351235
fix 1 all nve
fix 2 all wall/reflect xlo EDGE xhi EDGE ylo EDGE yhi EDGE zlo EDGE zhi EDGE
compute 1 all chunk/atom molecule
compute 2 ball omega/chunk 1
compute 3 ball inertia/chunk 1
# compute rotational kinetic energy: 1/2 * I * omega**2
variable r_ke_x equal c_2[1][1]*c_2[1][1]*c_3[1][1]*0.5
variable r_ke_y equal c_2[1][2]*c_2[1][2]*c_3[1][2]*0.5
variable r_ke_z equal c_2[1][3]*c_2[1][3]*c_3[1][3]*0.5
# output moments of inertia for x,y,z and angular velocity as well as rotational kinertic energy
thermo_style custom step ke pe c_3[1][1] c_3[1][2] c_3[1][3] c_2[1][1] c_2[1][2] c_2[1][3] v_r_ke_x v_r_ke_y v_r_ke_z
thermo 500
# dump 1 all atom 100 dump.lammpstrj
# dump 2 all movie 10 ball.mp4 type mass
# equilibration w/o torque added
run 1000 post no
# start spinning the ball. rotation around z should increase and Erot_z should grow
fix 4 ball addtorque 0.0 0.0 200.0
run 10000 upto post no
# continue without adding more torque. rotation continues at fixed speed
unfix 4
run 5000
|