You are on page 1of 4

HowTo's LIGGGHTS 1.

) LOOP CONTROL by velocity


variablerunstepsequal1000 #cycles/loop variabletresholdequal0.001 #abortcondition variablevcmxequalvcm(all,x) #v_x variablevcmyequalvcm(all,y) #v_y variablevcmzequalvcm(all,z) #v_z variablevcmmagequalsqrt(v_vcmx*v_vcmx+v_vcmy*v_vcmy+v_vcmz*v_vcmz) labelloop #jumphereuntilconditionreached print">Checkingvelocity..." if${vcmmag}<${treshold}then"jumpin.lmpendloop"#jumpout print">vcm${vcmmag},threshold${treshold},continuingrun" run${runsteps}postno #runNcycles jumpin.lmploop #jumpbacktotop(labelloop) labelendloop #jumppointforendloop

2.) INSERT Particles from previus state You need: adapted restart2data.cpp, copy & compile in <liggghts-folder>/tools/, symlink in /usr/bin to make it systemwide available convertscript.sh a restartfile from the first simulation-process, from the state you want to insert Usage: edit convertscript.sh to match your number of insert-steps (for ..1 2 3 N) and filename (restart.equil) run ./convertscript.sh you will get N files liggghts.data_N with loadable particle positions and velocities in your liggghts input script use:
read_datadata/data_liggghts.data_1add#firstinsert run40000uptoevery5512& "read_datadata/liggghts.data_*add"#folowinginsert

3.) Different parameter for ball-wall and ball-ball contacts The usage is:
peratomtype<constant_for_atom_type1><constant_for_atom_type2> peratomtypepair<Number_of_pairs>& <constantfor11><constantfor12>& <constantfor21><constantfor22>

In this example we will define 2 'atom types' for wall-ball and ball-ball contacts
fixm1allproperty/globalpoissonsRatioperatomtype${poiss1}${poiss2} fixm2allproperty/globalcoefficientFrictionperatomtypepair2& ${fric11}${fric12}& ${fric21}${fric22}

Make sure your simulation-region box defines the correct number of used atomtypes:
region create_box regblockx0x1y0y1z0z1unitsbox 2reg

4.) Multiple runs with different parameters First you have to define the simulation parameters
variableauniverse& 012& 345& 678 variableffuniverse& 0.470.50.53& 0.470.50.53& 0.470.50.53 variablefrfuniverse& 0.00.00.0& 0.20.20.2& 0.40.40.4

You can than access these variables by ${ff} and ${frf}


fixm4allproperty/globalcoefficientFrictionperatomtypepair1${ff} fixm5allproperty/globalcoefficientRollingFrictionperatomtypepair1 ${frf}

The dump command should look like this:


shellmkdirpost_$a dump dmpallcustom40000post_$a/dump_*.liggghtsidtypetypexyz& ixiyizvxvyvzfxfyfzomegaxomegayomegazradius

At the end of your script write


next clear jump afffrf in.lmp #iterateovervariants #delatealloldsimulationresults #jumptotop

To start a multi-variant simulation run liggghts this way:


mpirunnpXliggghtspartitionYxZinin.lmp

where Y=#variants, Z=#cores per variant 5.) dump forces on walls First you have to activate stressanalysis for the geometry:
fixcad1allmesh/gran/stressanalysislid.stl10.0010.0.0.0.0.0. fixwallallwall/gran/hertz/history30mesh/gran1cad1

Then you can access these wallforce-information by f_cad1[<component>]


variablefw1equalf_cad1[1] variablefw2equalf_cad1[2] variablefw3equalf_cad1[3]

Where component 1..3 are the forces in x,y,z direction and 4..6 are the moments To write these variables into a dumpfile every timestep you can use the fix-print command:
variabletequalstep*dt fixoutallprint1"$t,${fw1},${fw2},${fw3}"fileforces.csvscreenno& title"t,fwx,fwy,fwz"

6.) calculate massflow First you have to define one or more measurement regions (region can be a box, a zylinder or a parralelepiped, see liggghts manual for details)
region1block0.1500.3500.1500.3500.91.0unitsbox region2block0.1500.3500.1500.3500.80.9unitsbox region3block0.1500.3500.1500.3500.70.8unitsbox region4block0.1500.3500.1500.3500.60.7unitsbox region5block0.1500.3500.1500.3500.50.6unitsbox region6block0.1500.3500.1500.3500.40.5unitsbox region7block0.1500.3500.1500.3500.30.4unitsbox region8block0.1500.3500.1500.3500.20.3unitsbox region9block0.1500.3500.1500.3500.10.2unitsbox region10block0.1500.3500.1500.3500.00.1unitsbox #helpvariables variableAthequal0.2*0.2 #(x*y) variableboxvolequal0.2*0.2*0.1 #(x*y*z) You

can now calculate the mass-flow for each region I m_region=A*v*p with p=m/Vregion

variableI1equalvcm(all,z,1)*mass(all,1)/${boxvol}*${Ath}*3.6 variableI2equalvcm(all,z,2)*mass(all,2)/${boxvol}*${Ath}*3.6 variableI3equalvcm(all,z,3)*mass(all,3)/${boxvol}*${Ath}*3.6 variableI4equalvcm(all,z,4)*mass(all,4)/${boxvol}*${Ath}*3.6 variableI5equalvcm(all,z,5)*mass(all,5)/${boxvol}*${Ath}*3.6 variableI6equalvcm(all,z,6)*mass(all,6)/${boxvol}*${Ath}*3.6 variableI7equalvcm(all,z,7)*mass(all,7)/${boxvol}*${Ath}*3.6 variableI8equalvcm(all,z,8)*mass(all,8)/${boxvol}*${Ath}*3.6 variableI9equalvcm(all,z,9)*mass(all,9)/${boxvol}*${Ath}*3.6 variableI10equalvcm(all,z,10)*mass(all,10)/${boxvol}*${Ath}*3.6

To dump these variables to a comma separated file use the fix print command
fixout4allprint1& "$t,${I1},${I2},${I3},${I4},${I5},${I6},${I7},${I8},${I9},${I10}"& fileI.csvscreenno& title"t,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10"

7.) color particles by region In this example we use the same regions as in 6.) First you have to add a new property per atom:
fixcolorallproperty/atomColorscalaryesnono0#defaultvalue=0 run0#importanttoapplythenewproperty

Second you can access this new property (where Color is the name of the property) with:
setregion<regionID>property/atomColor<anynumber>

And dump it to the particle dumpfile with the dump custom cmd (f_<ID of the fix>:
dumpdmpallcustom100post/dump_*.liggghtsidtypexyzvxvyvz& radiusmassf_color

To apply the new colour every n-th Timestep you have to use the runevery cmd:
run200000every100& "setregion1property/atomColor1"& "setregion2property/atomColor2"& "setregion3property/atomColor3"& "setregion4property/atomColor4"& "setregion5property/atomColor5"& "setregion6property/atomColor6"& "setregion7property/atomColor7"& "setregion8property/atomColor8"& "setregion9property/atomColor9"& "setregion10property/atomColor10"

You might also like