# Particle packing by insertion and successive growing of particles

#--------------------------Input Parameters---------------------------------------------------------

include in.DEM

#------------------General Settings for Granular Systems--------------------------------------------

atom_style      granular
atom_modify     map array
#boundary        f f f
boundary        p p f
newton          off
echo            both

communicate     single vel yes

units           si
processors      1 1 *


#---------------------Region/Simulationbox Definition and ReadIn Particle Data----------------------

region          reg block 0. ${domainWidth} 0. ${domainDepth} 0. ${domainHeight} units box
create_box      3 reg

neighbor        0.002 bin
neigh_modify    delay 0


#---------------------Material Properties-----------------------------------------------------------

fix         m1 all property/global youngsModulus peratomtype ${youngsMod} ${youngsMod} ${youngsMod} #[Pa]
fix         m2 all property/global poissonsRatio peratomtype ${poissionsRat} ${poissionsRat} ${poissionsRat}
fix         m3 all property/global coefficientRestitution peratomtypepair 3 ${coeffRest} ${coeffRest} ${coeffRest}  ${coeffRest} ${coeffRest} ${coeffRest}  ${coeffRest} ${coeffRest} ${coeffRest}
fix         m4 all property/global coefficientFriction peratomtypepair 3 ${coeffFricPP} ${coeffFricPW1} ${coeffFricPW2}  ${coeffFricPW1} ${coeffFricPW1} ${coeffFricPW2}  ${coeffFricPW2} ${coeffFricPW2} ${coeffFricPW2}
fix 	    m5 all property/global coefficientRollingFriction peratomtypepair 3 ${coeffFricRoll} ${coeffFricRoll} ${coeffFricRoll}  ${coeffFricRoll} ${coeffFricRoll} ${coeffFricRoll}  ${coeffFricRoll} ${coeffFricRoll} ${coeffFricRoll}

#----------------------------Pair Style-------------------------------------------------------------

pair_style  gran model hertz tangential history #Hertzian without cohesion
pair_coeff  * *

#-----------------------------Time Step--------------------------------------------------------------

timestep	${timeStep}

#-------------------------------Walls----------------------------------------------------------------

fix     zwalls1 all wall/gran model hertz tangential history primitive type 3 zplane 0.0
fix     zwalls2 all wall/gran model hertz tangential history primitive type 3 zplane ${domainHeight}
#fix     zwalls3 all wall/gran model hertz tangential history primitive type 3 xplane 0.0
#fix     zwalls4 all wall/gran model hertz tangential history primitive type 2 xplane ${domainWidth}
#fix     zwalls5 all wall/gran model hertz tangential history primitive type 3 yplane 0.0
#fix     zwalls6 all wall/gran model hertz tangential history primitive type 3 yplane ${domainDepth}

#-------------------------------Gravity--------------------------------------------------------------

fix     gravi all gravity 9.81 vector 0.0 0.0 -1.0


#--------------------Particle Distributions and Insertion--------------------------------------------

fix         pts1 all particletemplate/sphere       15485863 atom_type 1 density constant ${particlesDensity} radius constant ${particlesRadius}
fix         pdd1 all particledistribution/discrete 86028121 1 pts1 1.0

fix         ins all insert/pack seed 67867967 distributiontemplate pdd1 &
            vel constant 0. 0. -3. insert_every once overlapcheck yes &
            all_in yes particles_in_region ${numParticles} region reg


#-------------Apply NVE Integration to all Particles that are Inserted as Single Particles------------

fix         integr all nve/sphere

#--------------------Output Settings, include Total Thermal Energy------------------------------------

compute         rke all erotate/sphere
thermo_style    custom step atoms ke c_rke vol
thermo          4000
thermo_modify   lost ignore norm no
compute_modify  thermo_temp dynamic yes

#--------------------------Insert the First Particles--------------------------------------------------

run             1
dump            dmp all custom 4000 post/dump.liggghts_init id type x y z vx vy vz fx fy fz omegax omegay omegaz radius 


#---------------------Settle Inserted Particles-------------------------------------------------------

fix     momZ  all momentum 1 linear 1 1 0 #zeros the momentum in x and y

run             200000

write_restart   post/restart/liggghts.restart



