Dear Axel and lammps users,

I want to measure the diffusion coefficient of a K+ ion in a water box. My approach is to connect a spring to the ion and pull “the other side of the spring” with a constant velocity. I use fix smd in the following way:

fix pull K smd cvel 250.0 -0.00003 tether 10.0 NULL NULL 0.0

Actually, when I monitor the f_pull[7] which is the accumulated PMF, I do not get what I expect. I expect it to increase as the ion moves forward, but it fluctuates around 0. I will appreciate it if you give me a key to find the problem.

Thanks.

########## input script ##########

variable JobName string ion6

log ${JobName}.lammps

shell rm log.lammps

dimension 3

boundary p p p

units real

neighbor 2 bin

neigh_modify delay 2 every 1 check yes

atom_style full

bond_style harmonic

angle_style charmm

pair_style lj/charmm/coul/long 12 14

pair_modify mix arithmetic

kspace_style pppm 1.0e-6

read_data wt.data

set type 2 charge -0.830

set type 1 charge 0.415

group wt type 1 2

group K type 3

pair_coeff 1 1 0.0 0.0

pair_coeff 2 2 0.102 3.188

pair_coeff 1 2 0.0 1.7753

pair_coeff 3 3 0.0 0.0

pair_coeff 1 3 0.0 0.0

pair_coeff 2 3 0.20943 3.014

balance 1.0 shift xyz 50 1.0

minimize 1.0e-4 1.0e-6 100 1000

velocity all create 300.0 12345678 dist gaussian

compute Temp all temp/com

fix 1 all nvt temp 300.0 300.0 100.0

fix_modify 1 temp Temp

fix 2 wt shake 1e-6 100 0 b 1 a 1

fix 3 K recenter INIT INIT INIT units box

thermo 1000

thermo_style custom elapsed cpu pe ke c_Temp

timestep 1

restart 10000 {JobName}.restart1 {JobName}.restart2

run 10000

unfix 3

fix pull K smd cvel 250.0 -0.00003 tether 10.0 NULL NULL 0.0

variable t equal step

variable fx equal f_pull[1]

variable fy equal f_pull[2]

variable fz equal f_pull[3]

variable F equal f_pull[4]

variable r0 equal f_pull[5]

variable r equal f_pull[6]

variable PMF equal f_pull[7]

variable xk equal xcm(K,x)

fix PMF all print 1000 “t {xk} {fx} {F} {r0} {r} ${PMF}” file PMF_{JobName}.txt

run 10000000