65 lines
1.9 KiB
Plaintext
65 lines
1.9 KiB
Plaintext
|
|
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
|