facing issues while using force and move commands in lammps


I am a PhD student at UC Merced and I have started learning LAMMPS for doing some MD simulations. I want to calculate the coefficient of friction for MoS2.(4-layers were taken for the simulation)

Description of my model:

Datafile creation:

LAMMPS data file created from VNL: Compatible with atom-style atomic

total number of atoms: 600

Box size: 15.802 X 27.3699 X 40.0

During optimization and MD calculation, x- and y- directions are taken as periodic and z- direction as non- periodic.

MD parameters and fixes used:

Units: real

Time step: 0.1

Bottom layer is fixed using setforce 0.0 0.0 0.0

Fix nvt is applied only on the middle two layers and set to temp 300k

Force is applied only on the top layer in the downward direction using different fixes.

Top layer is sliding in the +x direction using move linear 0.0001 NULL NULL


For the top layer, there is always vibration in z direction. Even after running for a longer time steps the vibration is same.

While my COM is reaching more than 15.0117 angstrom in the x direction its becoming negative.Although, when I am looking at the figure I can see that its continuously moving in the positive x direction. If COM needs to give unwrapped coordinate, why am I getting these negative values or what exactly I should use to get rid of the problem.

For applying pressure/ force in the negative z direction I have use different options,

  1. Applies average force on all the atoms in the top layer without making the layer as rigid.

  2. Made the layer as rigid and then applied addforce command.

  3. Applied average force command to only the Mo atoms in the top layer
    In all the cases when I am printing out the Z-direction force for top layer and all x, y and z direction force for the middle layer I did not able to see the amount of force or pressure (not even close to what I have applied). Probably, I am doing something wrong but could not able to figure it out. I want to know how I can verify that the force I am applying to the top layer is actually applied or not.

Part of my code:

fix 10 ugp setforce 0 0 NULL
fix 11 ugp rigid single torque * off off off
fix 12 ugp addforce 0 0 -0.6
fix 5 lgp setforce 0.0 0.0 0.0
fix up ugp move linear 0.0001 NULL NULL units box
compute 6 lgp com
compute 7 ugp com
compute 8 ugp property/atom fx fy fz
compute 9 mgp property/atom fx fy fz
compute xforce ugp reduce sum c_8[1]
compute yforce ugp reduce sum c_8[2]
compute zforce ugp reduce sum c_8[3]
compute xforcel mgp reduce sum c_9[1]
compute yforcel mgp reduce sum c_9[2]
compute zforcel mgp reduce sum c_9[3]
compute midtemp mgp temp
compute uptemp ugp temp
thermo 100
thermo_style custom step c_midtemp pe c_7[3] c_7[1] c_xforce c_yforce c_zforce c_xforcel c_yforcel c_zforcel

among 4 layers, top layer is ugp, middle two layers are mgp and bottom layer is lgp.

Please let me know If I need to supply any more info regarding my problem.



A system with 4 layers is not sufficient – you need much more layers to be confident. What is usually done in this kind of friction coefficient simulations is:

1). Apply compression only and measure the normal load. A series of different compressions give you a series of normal loads.
2). With each normal load structure, hold the compression layer fixed along the traverse directions and move linearly along one direction that is normal to the “normal load”. Measure the force along moving and perpendicular directions.
3). With forces and normal loads you can get friction coefficients.


Thank you Prof. Ray for the suggestion.