Example: Measuring the friction coefficient using NEMD

Download MD_friction.run

#!/bin/sh

# This example measures the friction coefficient between two diamond slabs.
#
# The top slab (B) is being pressed onto slab A by a -Z force while being pulled in the +X direction
# with a velocity of 200 m/s. The normal force used in this test is very high (5 nN per atom in B,
# corresponding to a pressure around 20 GPa) to make the friction coefficient measurably nonzero.

"$AMSBIN/ams" << eor
# Set the RNG seed to make results reproducible for regression testing, delete this line for real simulations
RNGSeed 1354700531 -1828372117 1981811283 531897225 -1777170443 -138867001 572543905 -1932870903

Task MolecularDynamics
MolecularDynamics
    NSteps 10000
    TimeStep 2
    Trajectory
        SamplingFreq 10
        WriteEngineGradients Yes
        WriteVelocities No
        WriteCharges No
        WriteBonds No
        WriteMolecules No
    End
    InitialVelocities
        Temperature 300
    End
    Thermostat
        Type NHC
        Temperature 300
        Tau 100
        Region free
    End
    ApplyVelocity
        Velocity 0.002 0 0
        Components XY
        Region B
    End
    ApplyForce
        Force 0.0 0.0 -160e-9 [Newton]
        Region B
    End
End
System
    Atoms
        C 1.32194823 1.26633023 1.67762819 region=A,free
        C 1.32194823 1.26633023 9.42762819 region=B,free
        C 1.32194823 3.79899068 1.67762819 region=A,free
        C 1.32194823 3.79899068 9.42762819 region=B,free
        C 3.9658447 1.26633023 1.67762819 region=A,free
        C 3.9658447 1.26633023 9.42762819 region=B,free
        C 3.9658447 3.79899068 1.67762819 region=A,free
        C 3.9658447 3.79899068 9.42762819 region=B,free
        C 0.0 1.26633023 0.78253111 region=A,free
        C 0.0 1.26633023 8.532531110000001 region=B,free
        C 0.0 3.79899068 0.78253111 region=A,free
        C 0.0 3.79899068 8.532531110000001 region=B,free
        C 2.64389647 1.26633023 0.78253111 region=A,free
        C 2.64389647 1.26633023 8.532531110000001 region=B,free
        C 2.64389647 3.79899068 0.78253111 region=A,free
        C 2.64389647 3.79899068 8.532531110000001 region=B,free
        C 0.0 0.0 3.48183649 region=A,free
        C 0.0 0.0 11.23183649 region=B,free
        C 0.0 2.53266045 3.48183649 region=A,free
        C 0.0 2.53266045 11.23183649 region=B,free
        C 2.64389647 0.0 3.48183649 region=A,free
        C 2.64389647 0.0 11.23183649 region=B,free
        C 2.64389647 2.53266045 3.48183649 region=A,free
        C 2.64389647 2.53266045 11.23183649 region=B,free
        C 1.32194823 0.0 6.07181582 region=A,free
        C 1.32194823 0.0 13.82181582 region=B,free
        C 1.32194823 2.53266045 6.07181582 region=A,free
        C 1.32194823 2.53266045 13.82181582 region=B,free
        C 3.9658447 0.0 6.07181582 region=A,free
        C 3.9658447 0.0 13.82181582 region=B,free
        C 3.9658447 2.53266045 6.07181582 region=A,free
        C 3.9658447 2.53266045 13.82181582 region=B,free
        C 1.32194823 1.26633023 5.28928471 region=A,free
        C 1.32194823 1.26633023 13.03928471 region=B,free
        C 1.32194823 3.79899068 5.28928471 region=A,free
        C 1.32194823 3.79899068 13.03928471 region=B,free
        C 3.9658447 1.26633023 5.28928471 region=A,free
        C 3.9658447 1.26633023 13.03928471 region=B,free
        C 3.9658447 3.79899068 5.28928471 region=A,free
        C 3.9658447 3.79899068 13.03928471 region=B,free
        C 0.0 1.26633023 4.39418763 region=A,free
        C 0.0 1.26633023 12.14418763 region=B,free
        C 0.0 3.79899068 4.39418763 region=A,free
        C 0.0 3.79899068 12.14418763 region=B,free
        C 2.64389647 1.26633023 4.39418763 region=A,free
        C 2.64389647 1.26633023 12.14418763 region=B,free
        C 2.64389647 3.79899068 4.39418763 region=A,free
        C 2.64389647 3.79899068 12.14418763 region=B,free
        C 0.0 0.0 0.0 region=A,fixed
        C 0.0 0.0 7.75 region=B,free
        C 0.0 2.53266045 0.0 region=A,fixed
        C 0.0 2.53266045 7.75 region=B,free
        C 2.64389647 0.0 0.0 region=A,fixed
        C 2.64389647 0.0 7.75 region=B,free
        C 2.64389647 2.53266045 0.0 region=A,fixed
        C 2.64389647 2.53266045 7.75 region=B,free
        C 1.32194823 0.0 2.58997933 region=A,free
        C 1.32194823 0.0 10.33997933 region=B,free
        C 1.32194823 2.53266045 2.58997933 region=A,free
        C 1.32194823 2.53266045 10.33997933 region=B,free
        C 3.9658447 0.0 2.58997933 region=A,free
        C 3.9658447 0.0 10.33997933 region=B,free
        C 3.9658447 2.53266045 2.58997933 region=A,free
        C 3.9658447 2.53266045 10.33997933 region=B,free
    End
    Lattice
        5.28779292 0.0 0.0
        0.0 5.06532092 0.0
    End
    BondOrders
         1 9 1.0
         1 13 1.0
         2 10 1.0
         2 14 1.0
         3 11 1.0
         3 15 1.0
         4 12 1.0
         4 16 1.0
         5 9 1.0 1 0
         5 13 1.0
         6 10 1.0 1 0
         6 14 1.0
         7 11 1.0 1 0
         7 15 1.0
         8 12 1.0 1 0
         8 16 1.0
         33 25 1.0
         33 27 1.0
         33 41 1.0
         33 45 1.0
         34 26 1.0
         34 28 1.0
         34 42 1.0
         34 46 1.0
         35 25 1.0 0 1
         35 27 1.0
         35 43 1.0
         35 47 1.0
         36 26 1.0 0 1
         36 28 1.0
         36 44 1.0
         36 48 1.0
         37 29 1.0
         37 31 1.0
         37 41 1.0 1 0
         37 45 1.0
         38 30 1.0
         38 32 1.0
         38 42 1.0 1 0
         38 46 1.0
         39 29 1.0 0 1
         39 31 1.0
         39 43 1.0 1 0
         39 47 1.0
         40 30 1.0 0 1
         40 32 1.0
         40 44 1.0 1 0
         40 48 1.0
         41 17 1.0
         41 19 1.0
         42 18 1.0
         42 20 1.0
         43 17 1.0 0 1
         43 19 1.0
         44 18 1.0 0 1
         44 20 1.0
         45 21 1.0
         45 23 1.0
         46 22 1.0
         46 24 1.0
         47 21 1.0 0 1
         47 23 1.0
         48 22 1.0 0 1
         48 24 1.0
         49 9 1.0
         49 11 1.0 0 -1
         50 10 1.0
         50 12 1.0 0 -1
         51 9 1.0
         51 11 1.0
         52 10 1.0
         52 12 1.0
         53 13 1.0
         53 15 1.0 0 -1
         54 14 1.0
         54 16 1.0 0 -1
         55 13 1.0
         55 15 1.0
         56 14 1.0
         56 16 1.0
         57 1 1.0
         57 3 1.0 0 -1
         57 17 1.0
         57 21 1.0
         58 2 1.0
         58 4 1.0 0 -1
         58 18 1.0
         58 22 1.0
         59 1 1.0
         59 3 1.0
         59 19 1.0
         59 23 1.0
         60 2 1.0
         60 4 1.0
         60 20 1.0
         60 24 1.0
         61 5 1.0
         61 7 1.0 0 -1
         61 17 1.0 1 0
         61 21 1.0
         62 6 1.0
         62 8 1.0 0 -1
         62 18 1.0 1 0
         62 22 1.0
         63 5 1.0
         63 7 1.0
         63 19 1.0 1 0
         63 23 1.0
         64 6 1.0
         64 8 1.0
         64 20 1.0 1 0
         64 24 1.0
    End
End
Constraints
    FixedRegion fixed
End

Engine ForceField
EndEngine
eor

"$AMSBIN/amspython" "${TEST_DIRECTORY:-.}/friction_coeff.py" --block 200 ams.results/
echo "END OF TEST"