Hi,

I am interested in performing a thermodynamic integration approach to study interfacial systems. The approach I desire is to scale the interphase interactions from fully interacting potentials to completely non-interacting - while not modifying intraphase interactions. For a short-range pair style, fix adapt is capable of scaling the desired interphase interactions. However, it appears that the long-range electrostatics can only be scaled globally with fix adapt rather than in a pairwise fashion.

A prior post to the mailing list inquired about this same functionality:

https://lammps.sandia.gov/threads/msg49101.html

and the conventional wisdom was dispensed that kspace contributions are not pairwise.

Recently, I came across the compute group/group command and saw that it has the capability of calculating k-space contributions between two specified groups of atoms. Can the compute group/group command be reduced down to the case where each ‘group’ is just a single atom, providing the pairwise k-space energy and force between an ij pair? If so, could this be a route to scaling specific interatomic interactions utilizing long-range potentials that could be worked into fix adapt?

Best,

Garrett

Garrett,

Kspace contributions are based on the pairwise Coulomb potential and can be written as a pairwise double sum. However, to *greatly* increase computational efficiency, the pairwise double sum in PPPM or Ewald is converted into a single sum over atoms.

There is no reason why you can’t recover pairwise Kspace interactions, it will just be really expensive. So you could absolutely use compute group/group to compute a single pair-wise Kspace interaction, or write your own Kspace style to work with fix adapt in a pairwise fashion, but it could be orders of magnitude more expensive than a regular Kspace calculation.

Stan

garrett,

there may now be a different option to consider for your problem.

for some other project we have just implemented a new hybrid pair style variant, hybrid/scaled, which allows to scale the pairwise contributions by arbitrary factors and also have these factors be changed over the course of a simulation through a variable, if desired.

with that you could now construct a setup, where you do the regular long-range coulomb interaction and then subtract an “undamped” coulomb by overlaying a coul/cut pair style with a negative scale factor, which could only be applied to selected atom types.

axel.

Hi Axel and Stan,

Thank you for your responses.

Stan, I see your point that while the group/group approach for treating the long-range interactions is technically possible, it becomes very computationally expensive.

Axel, I think that the hybrid/scaled pair style variant is a great feature to add to LAMMPS. I am still uncertain if hybrid/scaled will address my desire to scale specific long-range electrostatic interactions. I downloaded the LAMMPS development source code from GitHub on 4/21/2021 and compiled to try out the hybrid/scaled pair style variant. As a sanity check, I tried specifying two equivalent pair styles, lj/cut/coul/long, with equal but oppositely signed scale factors. As expected, the log file showed zeros for E_vdwl and E_coul. However, E_long was non-zero and was equivalent to the value produced when running the simulation with the standard implementation of lj/cut/coul/long. I assume this is because hybrid/scaled only works on pairwise interactions and does not scale any long-range interactions. In your message to me, you suggested that I try out lj/cut/coul/long with a subtractive coul/cut via hybrid/scaled. I attempted this but received an error message stating “Coulomb styles of pair hybrid sub-styles do not match”.

you need to use pair style coul/cut/global

to be compatible with any long-range coulomb style, the cutoff coulomb style must support only a single global cutoff which must be identical with the coulomb cutoff for the real space coulomb cutoff of the long-range style. this is to enforce consistency in common cases, so we need a workaround for this very uncommon case. if needed, this “global” style can be extended to have a real and a fake global cutoff so that the cutoff can be chosen independently from the long-range cutoff, but I didn’t want to implement this additional complication unless absolutely necessary.

Is there the possibility that hybrid/scaled will be capable of scaling long-range interactions in the future? Or is this functionality unlikely to be implemented due to computational efficiency issues like those that Stan mentioned?

you cannot have the subset scaling in the long-range part since this is essentially an everything-with-evertything kind of computation.

I think I may have already pointed this out but just in case I didn’t: please keep in mind that for the level of accuracy that you can expect from the kind of calculation you intend to do, the difference between using a real-space only coulomb (possibly with one of the smooth damping schemes) and a full long-range coulomb treatment is likely causing a smaller error. considering the computational cost of implementing partitioning in reciprocal space, you can increase the cutoff quite substantially until you have the same computational cost and on top of that calculations without long-range coulomb have much better strong parallel scaling, so you can also compensate the cost quite well by running with more CPUs. while the “partitioned kspace” chunks could be run concurrently as well, they would have to be run on different MPI sub-communicators due to their extensive requirement for communication and limited parallel scaling of the parallel 3d FFTs.

I skimmed over the pair_hybrid.rst file but did not see any explicit warning about the long-range portion not being scaled via the hybrid/scaled scale factor – that might be helpful to include for other users. Even without the ability to scale pairwise long-range interactions, the hybrid/scaled pair style variant is definitely still helpful, so thank you for contributing this feature.

Axel.

Hi Axel and Stan,

Thank you for your responses.

Stan, I see your point that while the group/group approach for treating the long-range interactions is technically possible, it becomes very computationally expensive.

Axel, I think that the hybrid/scaled pair style variant is a great feature to add to LAMMPS. I am still uncertain if hybrid/scaled will address my desire to scale specific long-range electrostatic interactions. I downloaded the LAMMPS development source code from GitHub on 4/21/2021 and compiled to try out the hybrid/scaled pair style variant. As a sanity check, I tried specifying two equivalent pair styles, lj/cut/coul/long, with equal but oppositely signed scale factors. As expected, the log file showed zeros for E_vdwl and E_coul. However, E_long was non-zero and was equivalent to the value produced when running the simulation with the standard implementation of lj/cut/coul/long. I assume this is because hybrid/scaled only works on pairwise interactions and does not scale any long-range interactions. In your message to me, you suggested that I try out lj/cut/coul/long with a subtractive coul/cut via hybrid/scaled. I attempted this but received an error message stating “Coulomb styles of pair hybrid sub-styles do not match”.

Is there the possibility that hybrid/scaled will be capable of scaling long-range interactions in the future? Or is this functionality unlikely to be implemented due to computational efficiency issues like those that Stan mentioned? I skimmed over the pair_hybrid.rst file but did not see any explicit warning about the long-range portion not being scaled via the hybrid/scaled scale factor – that might be helpful to include for other users. Even without the ability to scale pairwise long-range interactions, the hybrid/scaled pair style variant is definitely still helpful, so thank you for contributing this feature.

Here is the input script I was using for testing:

I won’t have the time to look into this in detail for a while. I didn’t test your specific type of scenario, so I cannot say whether this is a logic issue or an implementation problem or a principal problem with the scaling.

axel.

Hi Axel,

Thank you for the rapid response!

I agree with you that the differences between real-space only, real-space + damping, and full long-range treatments for the electrostatics on the final computed value from the thermodynamic integration will likely/hopefully be small. I’m also considering increasing the real-space cutoff incrementally for different iterations to perform a sensitivity analysis and extrapolate to infinite cutoff distance.

I do not quite understand the results I am obtaining from coul/cut/global. Using the testing input script I previously mentioned as a template, here are the run 0 results for various pair style combinations:

(1) pair_style hybrid/scaled 1.0 lj/cut/coul/long 15.0 -1.0 lj/cut/coul/long 15.0

(2) pair_style hybrid/scaled 1.0 lj/cut/coul/long 15.0 -1.0 coul/long 15.0

(3) pair_style hybrid/scaled 1.0 lj/cut/coul/long 15.0 -1.0 coul/cut/global 15.0

(4) pair_style lj/cut/coul/long 15.0

PotEng E_vdwl E_coul E_long

(1) -39705.875 0 0 -39705.875

(2) -40249.025 -543.14929 0 -39705.875

(3) -489538.35 -543.14929 -449289.33 -39705.875

(4) -87049.531 -543.14929 -46800.507 -39705.875

I do not understand why for coul/cut/global (3) the E_coul absolute value is so large; even in comparison to the sum of the real-space and k-space contributions for the standard lj/cut/coul/long (4). Perhaps I have a misconception of what coul/cut/global is supposed to do or perhaps I utilized the command incorrectly? To be explicit, here is the input I used to compute (3):