Using pair gran and pair hybrid

Greetings,

I have been trying to implement van der Waals adhesion between
granular particles. I have done this by simply changing the force
calculation in pair_colloid to suit my needs. However, when I try to
use pair gran/hooke/history with my new potential I run into a
problem. Input as follows:

#initializing pairwise interactions
pair_style gran/hooke/history 418879 NULL 149.8 NULL 0.05 0
pair_coeff * *
pair_style hybrid/overlay colloid 1.5
pair_coeff 1 1 colloid 7e-10 4.0e-4 1.0 1.0 1.5

The problem I run into is that the only force that seems to show up in
my simulation, is the last one I declare, i.e. adhesion in this case,
granular in the reverse. I have also tried the hybrid rather than
hybrid overlay. I have tried declaring both in the pair_style hybrid
and hybrid/overlay, which creates an error for invalid pair_style. I
would greatly appreciate it, if someone could give me an example of an
input script, which successfully uses both granular and some other
potential. For example, Lammps documentation claims a hybrid between
Coulombic and granular interactions is possible.

Greetings,

I have been trying to implement van der Waals adhesion between
granular particles. I have done this by simply changing the force
calculation in pair_colloid to suit my needs. However, when I try to
use pair gran/hooke/history with my new potential I run into a
problem. Input as follows:

#initializing pairwise interactions
pair_style gran/hooke/history 418879 NULL 149.8 NULL 0.05 0
pair_coeff * *
pair_style hybrid/overlay colloid 1.5
pair_coeff 1 1 colloid 7e-10 4.0e-4 1.0 1.0 1.5

The problem I run into is that the only force that seems to show up in
my simulation, is the last one I declare, i.e. adhesion in this case,
granular in the reverse. I have also tried the hybrid rather than
hybrid overlay. I have tried declaring both in the pair_style hybrid
and hybrid/overlay, which creates an error for invalid pair_style. I
would greatly appreciate it, if someone could give me an example of an
input script, which successfully uses both granular and some other
potential. For example, Lammps documentation claims a hybrid between
Coulombic and granular interactions is possible.

you problem is simple. you are not using the hybrid/overlay
pair_style correctly. your declaration of pair_style hybrid/overlay
wipes out the previous pair_style definition. you have to name
_all_ pair styles that you want to combine with pair style hybrid
or hybrid/overlay on the same command line.

please re-read the documentation of the hybrid pair styles
with this knowledge and you'll understand and be able to
set up what you want.

cheers,
    axel.

Axel,

As I said in the post, doing so creates an error "invalid pair_style"
at command:

pair_style hybrid/overlay gran/hooke/history 418879 NULL 149.8 NULL
0.05 0 colloid 1.5

Axel,

As I said in the post, doing so creates an error "invalid pair_style"
at command:

pair_style hybrid/overlay gran/hooke/history 418879 NULL 149.8 NULL
0.05 0 colloid 1.5

this has to work. this is the only way it is supposed to work.
if it doesn't, there has to be a bug in the hybrid pair style.

let me check it out real quick.

axel.

eric,

Axel,

As I said in the post, doing so creates an error "invalid pair_style"
at command:

pair_style hybrid/overlay gran/hooke/history 418879 NULL 149.8 NULL
0.05 0 colloid 1.5

this has to work. this is the only way it is supposed to work.
if it doesn't, there has to be a bug in the hybrid pair style.

let me check it out real quick.

ok. you *did* encounter a bug. the issue is that the hybrid
pair styles syntax is difficult to parse. the code assumes
that non-numeric word is a pair style. there are some exceptions
programmed, but they don't take care of NULL options.

so right now, you *can* use hybrid and hybrid/overlay
as documented only when all arguments are numbers.
to make it accept NULL as a valid argument to a
pair style and try not to parse it as a pair style itself,
you need to modify pair_hybrid.cpp around lines 210
to 260 as follows. then it should work for your case, too.

axel.

diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp
index c23d694..e7d2027 100644
--- a/src/pair_hybrid.cpp
+++ b/src/pair_hybrid.cpp
@@ -209,7 +209,7 @@ void PairHybrid::settings(int narg, char **arg)
     if (strcmp(arg[i],"buck/coul") == 0) i += 2;
     if (strcmp(arg[i],"reax/c") == 0) i++;
     i++;
- while (i < narg && !isalpha(arg[i][0])) i++;
+ while (i < narg && (!isalpha(arg[i][0]) || strcmp(arg[i],"NULL")
== 0)) i++;
     nstyles++;
   }

@@ -247,7 +247,7 @@ void PairHybrid::settings(int narg, char **arg)
     if (strcmp(arg[i],"buck/coul") == 0) i += 2;
     if (strcmp(arg[i],"reax/c") == 0) i++;
     i++;
- while (i < narg && !isalpha(arg[i][0])) i++;
+ while (i < narg && (!isalpha(arg[i][0]) || strcmp(arg[i],"NULL")
== 0)) i++;
     styles[nstyles]->settings(i-istyle-1,&arg[istyle+1]);
     nstyles++;
   }

This was due to a recent change in the granular
pair styles to use the NULL arg as an option. It
does need to be checked for in hybrid, as Axel says.

I'll post a patch.

Steve

Patched this - thanks

Steve