Second virial coefficient calculation of a Trimer using Mayer-Sampling

Here, we reproduce the virial coefficient of a trimer at the Boyle temperature as reported Table 1 of the following manuscript for \(L=0.4\sigma\)

https://dx.doi.org/10.1063/1.4918557

[1]:
params={"beta": 1./0.815, "rwca": 2.**(1./6.)}

script="""
MonteCarlo
Configuration cubic_side_length 1e100 particle_type0 /feasst/particle/trimer_0.4L.fstprt \
    add_particles_of_type0 2 cutoff0_1 {rwca} cutoff1_1 {rwca} \
    group0 first first_particle_index 0
Potential Model LennardJonesForceShift
RefPotential Model HardSphere sigma0 1 sigma1 0
ThermoParams beta {beta}
MayerSampling
TrialTranslate new_only true reference_index 0 tunable_param 1 group first
TrialRotate new_only true reference_index 0 tunable_param 40
set_variable trials_per 1e4
CriteriaWriter trials_per_write trials_per output_file b2.txt
Log trials_per_write trials_per output_file tmp/trib.txt
Movie trials_per_write trials_per output_file tmp/trib.xyz
Run num_trials 1e6
""".format(**params)

with open('script1.txt', 'w') as file: file.write(script)
import subprocess
syscode = subprocess.call("../../../build/bin/fst < script1.txt > script1.log", shell=True, executable='/bin/bash')
with open('script1.log', 'r') as file: print(file.read(), '\n', 'exit:', syscode)
# Usage: ./fst < file.txt
FEASST version 0.25.6
MonteCarlo
Configuration add_particles_of_type0 2 cubic_side_length 1e100 cutoff0_1 1.122462048309373 cutoff1_1 1.122462048309373 first_particle_index 0 group0 first particle_type0 /home/user/feasst/particle/trimer_0.4L.fstprt
Potential Model LennardJonesForceShift
RefPotential Model HardSphere sigma0 1 sigma1 0
ThermoParams beta 1.2269938650306749
MayerSampling
TrialTranslate group first new_only true reference_index 0 tunable_param 1
TrialRotate new_only true reference_index 0 tunable_param 40
CriteriaWriter output_file b2.txt trials_per_write 1e4
Log output_file tmp/trib.txt trials_per_write 1e4
Movie output_file tmp/trib.xyz trials_per_write 1e4
Run num_trials 1e6
# initializing random number generator with seed: 1734453542

 exit: 0
[3]:
import math
import numpy as np
with open("b2.txt") as f:
    firstline = f.readline().rstrip()
    #print(firstline)
    b2=eval(firstline)
    #b2={"second_virial_ratio": -0.0166853, "second_virial_ratio_block_stdev": 0.0159632}
    print(b2)
# print(mayer.mayer().str())
    assert np.abs(b2['second_virial_ratio']) < 4*b2['second_virial_ratio_block_stdev']
{'second_virial_ratio': -0.022655, 'second_virial_ratio_block_stdev': 0.015516}

Did this tutorial work as expected? Did you find any inconsistencies or have any comments? Please contact us. Any feedback is appreciated!