### Eric Frizzell 07152022
### in.spinning_clean


## Preliminaries
units 	si
atom_style 	granular

# the product of the processors must equal P, the number of processors used when running the file: mpirun -np 1 ...
processors 	1 1 1

# boundary conditions
boundary 	p f fm

#LIGGGHTS-Public shouuld produce the same answers for any newton flag setting, besides round off err
newton 	off

communicate 	single vel yes

hard_particles no

## Declare domain
region	reg block -2.0 2.0 -1.0 10.0 0.0 20.0 units box

create_box	 1 reg

neighbor	 0.0625 bin

neigh_modify delay 0

## Material Property variables
variable restiv equal 0.8
variable static_fric equal 0.3
variable rolling_fric equal 0.8 
variable visc_damp equal 0.2
variable k_c equal 0
variable r_p equal 0.00125
## Material properties
fix            m1 all property/global youngsModulus peratomtype 5e6
fix            m2 all property/global poissonsRatio peratomtype 0.3
fix	       m3 all property/global coefficientRestitution peratomtypepair 1 ${restiv}
fix            m4 all property/global coefficientFriction peratomtypepair 1 ${static_fric}
fix            m5 all property/global characteristicVelocity scalar .01
fix            m6 all property/global cohesionEnergyDensity peratomtypepair 1 ${k_c}
fix	       m7 all property/global coefficientRollingFriction peratomtypepair 1 ${rolling_fric}
fix	       m8 all property/global coefficientRollingViscousDamping peratomtypepair 1 ${visc_damp}

## Pair style
pair_style	gran model hertz tangential history cohesion sjkr rolling_friction epsd
pair_coeff	* * 

# timestep
timestep	0.00001
# integration
fix		1 all nve/sphere

# Earth gravity
fix		2 all gravity 9.81 vector 0.0 0.0 -1.0  

## Thermo settings
thermo_style 	custom step atoms ke vol
# thermo output
thermo		1000
thermo_modify	lost ignore norm no

# floor
fix		wall_z1 all wall/gran model hertz tangential history cohesion sjkr rolling_friction epsd primitive type 1 zplane 0 		# floor

create_atoms 1 single 0.0 0.0 0.501

group p1 id 1


fix ts_check all check/timestep/gran 100 0.1 0.1

# define output

## compute the array of overlaps, which will contain p-id 1, p-id 2, and their overlap [m]
compute deltas all pair/gran/local id delta

# define output
dump dmp all custom 5000 post/dump_*.post id type x y z vx vy vz radius fx fy fz mass omegax omegay omegaz tqx tqy tqz
dump dmp_local all local 5000 post_computes/dump_computes*.post c_deltas[1] c_deltas[2] c_deltas[4]

reset_timestep 0

# allow particle to settle on the floor
run	5000

velocity all set 0.0 0.0 0.0

#set the particle spinning
set group p1 omegaz 1.0

run 5000000

undump dmp