I had moderate success in writing a LAMMPS compute style that calculates
the chemical potential of a system via Widom sampling, but I've hit a
major snag that I suspect doesn't have a good solution.
My idea was to create another LAMMPS instance with no particular
parameters, then read in all the box data, atom positions, etc. via a
restart file. I can then run the sampling on that system without changing
the original LAMMPS instance at all. It works perfectly (if slowly, but
such is the nature of insertion-deletion averaging) for pair styles, such
as lj/cut, that write out all relevant pair coefficients to the restart
file, but fails for styles, such as eam, that do not.
It does not work, of course, to simply copy the LAMMPS instance; the
default copy constructors are shallow copies, so it has the net effect of
making both instances point to the same position/force/etc. data, which is
no good. Writing a deep copy constructor for every class would work, but
be a big project and a maintenance nightmare, I would expect.
I appreciate any insight others may have. There is of course the MC
package's "fix gcmc" which might work for fluids, but that's more a way to
do GCMD than a way to calculate the chemical potential. Thank you!
Karl D. Hammond
University of Tennessee, Knoxville
"You can never know everything, and part of what you know is always
wrong. A portion of wisdom lies in knowing that. A portion of courage
lies in going on anyway."
"Nothing ever goes as you expect. Expect nothing, and you will not be