[lammps-users] Suggestion for pair_style hybrid/overlay

Hello Steve,

With pair_style hybrid/overlay, multiple pair styles can be used at them same time for a specific pair of atom types.
But I found this style doesn't allow multiple mappings for the same sub-style. In piar_hybrid_overlay.cpp, around
line 68, the comments there say no mapping will be done if the sub-style has been mapped already before. This means
I cannot call more than once the pair_coeff command with different arguments.

However, I think in some situations this can be useful or convenient. For example, I may want to call twice of the
pair_coeff * * morse with different argument "alpha" values. Because the 'alpha' is in the exponent this cannot be
replaced by a single call (by superposing a new function is created). Another example is, if superposing of same
sub-style is allowed in the input script I can create a sub-style serving as a background potential then superpose
other or the same sub-styles on top of that base potential with different arguments. This can be convenient.
Finally, to allow superposition of arbitrary sub-styles being applied arbitrary times will maximize the flexibility of
this command.

Looking forward to your opinions!

Ting Li (KULeuven)

Hello Steve,

With pair_style hybrid/overlay, multiple pair styles can be used at them
same time for a specific pair of atom types.
But I found this style doesn't allow multiple mappings for the same
sub-style. In piar_hybrid_overlay.cpp, around
line 68, the comments there say no mapping will be done if the sub-style
has been mapped already before. This means

yes, and that is needed because the name of the pair sub style
is used to identify which pair_coeff command belongs to which
pair sub style.

I cannot call more than once the pair_coeff command with different
arguments.

that is not correct. you can set different pair coefficients
for each pair of atom types if you want to.

However, I think in some situations this can be useful or convenient.
For example, I may want to call twice of the
pair_coeff * * morse with different argument "alpha" values. Because the
'alpha' is in the exponent this cannot be

am i getting this right? you want to apply *two* morse potential
interactions _on top of each other_ to *all* pairs of particle types?
that sounds fairly strange and unusual to me.

replaced by a single call (by superposing a new function is created).
Another example is, if superposing of same
sub-style is allowed in the input script I can create a sub-style
serving as a background potential then superpose
other or the same sub-styles on top of that base potential with
different arguments. This can be convenient.
Finally, to allow superposition of arbitrary sub-styles being applied
arbitrary times will maximize the flexibility of
this command.

Looking forward to your opinions!

if you think it is useful, just go ahead and implement it!
this is the freedom of open source. you have the source
and the freedom. but you will have to overcome the problem,
that the name of the pair substyle is used to map the
parameters/coefficients to the substyle.

good luck,
    axel.

Thank you for the answers, Axel!

The example I gave is indeed a little unusual. I just wanted to show by superposing
same pair_styles one can create new potential function types if that is allowed by
pair_style hybrid/overlay. I didn't really want to use morse for all pairs twice but
in some simulations this seems useful and convenient. And I don't see why this
should not be implemented.

I'm not requiring but suggesting:) Or if there is some other place where users could
submit feature requests?

I cannot call more than once the pair_coeff command with different
arguments.
   

that is not correct. you can set different pair coefficients
for each pair of atom types if you want to.

I don't understand this. How could I modify pair coefficients after I have set them once?
Note we have "pair_style hybrid/overlay" IN USE. Without it or even with "pair_style hybrid"
we have no problem call 'pair_coeff' multiple times, this way we could modify the set
pair coefficients. But if "pair_style hybrid/overlay" is used, to call 'pair_coeff' more than once
on the same sub-style will simply lead to an error! It's forbidden. I hope I've made the point clearer.

No doubt about your saying "if you think it is useful, just go ahead and implement it! "

To Steve: according to this page: LAMMPS Molecular Dynamics Simulator , I think suggestions
should go to the developers directly other than to the user mailing list.

Ting Li(KUL)

Note we have "pair_style hybrid/overlay" IN USE. Without it or even with
"pair_style hybrid" we have no problem call 'pair_coeff' multiple times,
this way we could
modify the set pair coefficients. But if "pair_style hybrid/overlay" is used,
to call 'pair_coeff' more than once
on the same sub-style will simply lead to an error! It's forbidden. I hope
I've made the point clearer.

thanks. yes, you did. it didn't transpire at all from your previous
description, since that already seems to have included some
kind of idea of a workaround.

the problem you are referring to, it is a bit of a tricky one
from the perspective of implementing it, and it is not obvious
to me how to address it.

No doubt about your saying "if you think it is useful, just go ahead and
implement it! "

To Steve: according to this page: LAMMPS Molecular Dynamics Simulator ,
I think suggestions
should go to the developers directly other than to the user mailing list.

i don't think it matters. the main issue is that you have to make
a convincing argument for somebody investing time and effort
into something that - at first - sounded very obscure and unusual.
the advantage of sending this kind of request openly is that you
can get feedback from others and can make a *better* case.

cheers,
    axel.

I don't fully understand. You should be able to use the pair
coeff command multiple times for the same sub-style (e.g. morse)
to specify coeffs for different pairs of atom types. You cannot
do this multiple times (all with morse) for the same I,J pair.

If the latter is what you want to do, then I it does seem like an
odd potential for the interaction of the same 2 atoms (2 Morse
potentials with different alphas added together). It probably would
be possible to enable this, but it would also be hard to detect
when the user did it as an error, which seems more likely.

Steve

Thanks again!
At least I've pointed out the limitation of this command which is not well documented yet.
Maybe it's good to add it the the restrictions section in the manual and let it be.

As a conclusion: Do not overlay the same sub pair_style more than once while pair_style hybrid/overlay
is used; Overriding potential arguments is NOT possible.

Ting Li (KUL)

Thanks, Steve!

Yes, indeed what I want/hope is to apply the same sub-style multiple times
for the same pair. And I agree that it's easy to make mistake if it is allowed and
one doesn't know what he is doing. But I'm talking about the flexibility of this
command not how to use it correctly. I think that's the responsibility of the users.

In the first email of this thread, I've given some reasoning. I would like to make it
more clear again.

First, I cannot override potential parameters in the same way as
when pair_style hybrid is used. This can be useful. e.g. I have many different bond
types in a model. Most of the bonds have one type, just a few of them has different
types and the atoms IDs in these bonds are discontinuous. This is not a rare case.
The most convenient way is to first set a default bond type for all bonds and then
override the specified bond types with different coeffs. This way only the bond
types need to be specified differently require a explicit line in the input script.
If overriding is not allowed, more lines are needed in the input script in order to
have them defined, because those atom IDs are not continuous. How many lines
are needed depends on how discrete they are. And worse, if I miss one of them
lammps will complain not all the pair has type specified.

The 2nd possible benefit is to build new potential functions based on the available ones.
e.g. if a bi-exponential potential function is needed I can simply make it by superposing
two Buckingham potentials with different A and rho parameters and C=0. This way
maximize the flexibility of the potentials implemented in lammps and people can really
create new potential as wish, because many basic function forms has been already implemented
such as cosine function, exponential function, power function. In principle, if we could
superpose these basic functions as many times as we like, we could mimic any function
without the need of further development. I can see this possibility from hybrid/overlay
but the limitation I pointed out in this thread is the only obstacle to do so.

In my simulations, I'm in fact playing with pair_style dpd. On top of the basic implementation
I would like to add different conservative potentials, not just use the linear one defined
in pair_style dpd. Similar thing has been done in some of the DPD simulations. What I did is
I omit the original conservative force in pair_style dpd by setting A=0, then the friction and
random force remain. Afterward I would like to add some other potential like morse for the
conservative term for the SAME IJ pair of course. But I was stopped by the error we are talking
about.

As I've said, I didn't want you to help me to solve my very personal problems.
The problem I met just made me think it could make lammps more powerful if the problem
can get solved. I and other users can also benefit from this fix.

I don't know if what I've said make any sense to you. If not, please just ignore it.

Ting Li (KUL)

First, I cannot override potential parameters in the same way as
when pair_style hybrid is used. This can be useful. e.g. I have many
different bond
types in a model. Most of the bonds have one type, just a few of them has
different
types and the atoms IDs in these bonds are discontinuous. This is not a rare
case.
The most convenient way is to first set a default bond type for all bonds
and then
override the specified bond types with different coeffs. This way only the
bond
types need to be specified differently require a explicit line in the input
script.
If overriding is not allowed, more lines are needed in the input script in
order to
have them defined, because those atom IDs are not continuous. How many lines
are needed depends on how discrete they are. And worse, if I miss one of
them
lammps will complain not all the pair has type specified.

this can be easily alleviated by writing a small script that generates
these lines of the input for you and then you can use the include
command to include this generated script into your normal script.

The 2nd possible benefit is to build new potential functions based on the
available ones.
e.g. if a bi-exponential potential function is needed I can simply make it
by superposing
two Buckingham potentials with different A and rho parameters and C=0. This
way
maximize the flexibility of the potentials implemented in lammps and people
can really
create new potential as wish, because many basic function forms has been
already implemented
such as cosine function, exponential function, power function. In principle,
if we could
superpose these basic functions as many times as we like, we could mimic any
function
without the need of further development. I can see this possibility from
hybrid/overlay
but the limitation I pointed out in this thread is the only obstacle to do
so.

the better solution to this kind of problem is to use a tabulated potential.
there is also the benefit of better performance of having just one force
evaluation per pair of atoms instead of multiples.

cheers,
     axel.

Yeah, there are always alternative ways. Just as Axel provided.
However, I cannot see why those solutions are better than just allowing multiple mapping
for one IJ pair.

The 1st solution will take more steps in order to make the usable input file. Not straightforward.
Very inconvenient if you want to assign different function types to different pairs. Then the
separation pattern of the common bonds will change, leading to modification of the script repeatly.

For the 2nd solution, tabulated potentials are not as good as analytic ones. If a potential can be
described by analytic function, to prevent using tabulated potential is always good. The accuracy
of tabulated potential if predefined, depending on the interval in distance and the interpolation
methods used in the simulation program. Tabulated potential has both boundary and numerical
stability issues, which should be well handled. Besides of these drawbacks, users have to prepare
the tabulated data in required format or generate the data from analytic function if that function
is not available in the simulation software. Therefore, tabulated potential can never be a good reason
not to implement analytic functions if possible.

Both solution you mentioned have been considered and even implemented LONG time ago, earlier
than the tabulated potentials (intra-mol) has been introduced into lammps. Scripting in DOS, bash
python, sed ,awk is not a problem for me. Thanks for the help in this direction!

What I don't understand is why a much simpler solution is not acceptable. To my knowledge,
it's relative easy to allow multiple mapping by modifying the source, because the multiple
mapping framework is already there (in pair_hybrid_overlay.cpp).

Workaround is not real solution. And in most time, if we have to find out workaround we have
to think the design and remove the issues or obstacles totally.I think I have made my point
clear enough. If it is worth of being implemented, it's a choice of the author.

best,
Ting Li (KUL)

Comments below.

Steve

Thanks, Steve!

Yes, indeed what I want/hope is to apply the same sub-style multiple times
for the same pair. And I agree that it's easy to make mistake if it is
allowed and
one doesn't know what he is doing. But I'm talking about the flexibility of
this
command not how to use it correctly. I think that's the responsibility of
the users.

In the first email of this thread, I've given some reasoning. I would like
to make it
more clear again.

First, I cannot override potential parameters in the same way as
when pair_style hybrid is used. This can be useful. e.g. I have many
different bond
types in a model. Most of the bonds have one type, just a few of them has
different
types and the atoms IDs in these bonds are discontinuous. This is not a rare
case.
The most convenient way is to first set a default bond type for all bonds
and then
override the specified bond types with different coeffs. This way only the
bond
types need to be specified differently require a explicit line in the input
script.
If overriding is not allowed, more lines are needed in the input script in
order to
have them defined, because those atom IDs are not continuous. How many lines
are needed depends on how discrete they are. And worse, if I miss one of
them
lammps will complain not all the pair has type specified.

I don't understand the issue for bond potentials. There is a bond_style
hybrid if you want to have different bond styles assigned to different
bond_types. For all the bonds of a single type, you can only have
one set of coeffs for a particular style. I don't see how it would
make sense to have 2 different harmonic bonds, each with a R0 and K
assigned to the same pair of atoms.

The 2nd possible benefit is to build new potential functions based on the
available ones.
e.g. if a bi-exponential potential function is needed I can simply make it
by superposing
two Buckingham potentials with different A and rho parameters and C=0. This
way
maximize the flexibility of the potentials implemented in lammps and people
can really
create new potential as wish, because many basic function forms has been
already implemented
such as cosine function, exponential function, power function. In principle,
if we could
superpose these basic functions as many times as we like, we could mimic any
function
without the need of further development. I can see this possibility from
hybrid/overlay
but the limitation I pointed out in this thread is the only obstacle to do
so.

Using 2 superposed buck potentials on the same pair of atom types
is a current limitation. I can see how it would be useful.

In my simulations, I'm in fact playing with pair_style dpd. On top of the
basic implementation
I would like to add different conservative potentials, not just use the
linear one defined
in pair_style dpd. Similar thing has been done in some of the DPD
simulations. What I did is
I omit the original conservative force in pair_style dpd by setting A=0,
then the friction and
random force remain. Afterward I would like to add some other potential like
morse for the
conservative term for the SAME IJ pair of course. But I was stopped by the
error we are talking
about.

With pair hybrid/overlay, you can add a Morse and DPD potential
on the same I,J pair of atoms (and on all pairs of atoms of the same 2 types).
That is what it is designed to do. You
just can't add 2 Morse potentials on the same I,J pair, similar to
your Buck example above.

Thank you for the help!

Ting Li (KUL)