Hello LAMMPS users, (version: 7Aug19)

I am comparing the temperature specified as a parameter for fix gcmc to the run average of the temperature calculated using compute_temp. I thought the average would approach the specified temperature, but it does not. The deviation increases with decreasing atom count.

From what I can tell all inserted atoms are assigned velocities from a gaussian distribution corresponding to the specified temperature.

The compute_temp then uses the velocities to compute the temperature by

Ke = 3(N-1)kT, where the -1 is due to the 3 less degrees of freedom from zero linear momentum. I tried to normalize by N instead of N-1 but, there is still deviation.

Should the temperatures not be the same?

Thank you in advance,

Best

Bjorn

Test case:

# Control variables

variable MU equal -4.0

variable TEMP equal 2.0

variable TRANS_MAX equal 1.0

variable NTRANS equal 40

variable NEXCH equal 40

variable EQRUN equal 10000

variable PRODRUN equal 40000

variable NEVERY_THERMO equal 1

variable NFREQ_THERMO equal 1000

# Setup

pair_style lj/cut 3.0

region box block 0 5 0 5 0 5

create_box 1 box

pair_coeff 1 1 1.0 1.0

mass 1 1.0

group g_gcmc type 1

fix gcmc g_gcmc gcmc 1 {NTRANS} {NEXCH} 1 29494 {TEMP} {MU} ${TRANS_MAX}

run ${EQRUN}

unfix gcmc

reset_timestep 0

variable T equal c_gcmc_temp

variable T2 equal v_T^2

variable T_block2 equal f_block[1]^2

variable T_ave equal f_block_ave[1]

variable T_ave_var equal f_block2_ave[1]-v_T_ave^2

variable T_ave_std equal sqrt((v_T_ave_var>0)*v_T_ave_var)

variable N equal count(g_gcmc)

variable N2 equal v_N^2

variable N_block2 equal f_block[2]^2

variable N_ave equal f_block_ave[2]

variable N_ave_var equal f_block2_ave[2]-v_N_ave^2

variable N_ave_std equal sqrt((v_N_ave_var>0)*v_N_ave_var)

variable trans_accept equal f_gcmc[2]/f_gcmc[1]

variable insert_accept equal f_gcmc[4]/f_gcmc[3]

variable delete_accept equal f_gcmc[6]/f_gcmc[5]

compute gcmc_temp g_gcmc temp

compute_modify gcmc_temp dynamic yes

# Averages and error estimates (10 blocks)

fix block all ave/time {NEVERY_THERMO} (v_PRODRUN/10/v_NEVERY_THERMO) (v_PRODRUN/10) v_T v_N fix block_ave all ave/time (v_PRODRUN/10) 10 {PRODRUN} f_block[1] f_block[2] fix block2_ave all ave/time (v_PRODRUN/10) 10 ${PRODRUN} v_T_block2 v_N_block2

fix gcmc g_gcmc gcmc 1 {NTRANS} {NEXCH} 1 29494 {TEMP} {MU} ${TRANS_MAX}

thermo_style custom step v_T v_N

thermo ${NFREQ_THERMO}

run ${PRODRUN}

print “-----------------------------------------”

print “Run Summary”

print “-----------------------------------------”

print “N_ave: {N_ave} +- {N_ave_std}”

print “T_ave: {T_ave} +- {T_ave_std}”

print “trans_accept: {trans_accept}"
print "insert_accept: {insert_accept}”

print “delete_accept: ${delete_accept}”

print “-----------------------------------------”