Dear Developers,
I am working on a problem where we would like to compute the free energy to create cavities in materials/complex fluids.
A simple approach would seem to consist of adding psuedo (Lennard Jones atoms with a cut-off of negligible initial diameter and slowly scale them up during the simulation, where they are included in the force and potential evaluations, but are not part of the time step integrating group. Note that the ti fix in lammp will not do the job, because it assumes a linear dependence in the perturbation parameter (lambda) (which is sigma in my case)
So far, making holes is easy, BUT my difficulty is extracting the derivative of the corresponding potential with respect to the particle diameter from lammps - lets call it dvds (step 4 below). Mathematically the problem is simple, but implementing it in LAMMPS seems tricky to
say the least.
My idea for extracting the derivative was to:
[1] modify ComputePairLocal::compute_pairs
to compute dvds in the similar way that it calculates the energy and pair force through the pair_lj_cut class (and declare the compute_pair_local as a friend of the pair_lj_cut class so its private members can be accessed)
[2] add an additional array *dvbuf to the buffers - double *dbuf,*ebuf,*fbuf; to accumulate the result
[3] only accumulate to dvbuf atom for pairs where one atom is a pseduo atom
[4] extract the relevant data in the pair_cut_lj class - in particular the private members lj1[i][j], lj2[i][j], lj2[i][j], lj4[i][j] and similar quantities
If I could access these members I could with a few lines compute the terms to be added to dvbuf
I have compiled and run steps [1] to [3] - all seems fine.
BUT step [4] is a head-banger. I believe I am confused regarding access of data from a private member of a class to a member of a different class.
Any suggestions ?
Thanks & Best Regards,
Donal
Dr Donal MacKernan
University College Dublin