strange thing with "Dihedral charmm is incompatible with Pair style"

Dear Lammps developers and users:

I have two questions related to error message “Dihedral charmm is incompatible with Pair style”.

I started by simulating molecule A, which has dihedrals defined as follows:
dihedral_style charmm
dihedral_coeff 1 -0.1 2 0 0.0

While Lammps does not allow “pair_type lj/cut” when “charmm” style dihedrals are present, such a pair_style is allowed when the weight coeff. is zero as in this case. Indeed, when I use such a pair_style, Lammps runs well.

Then I moved to simulate a mixture of molecules A and B. In molecule B, there are OPLS type dihedrals. So, I changed my script to
dihedral_style hybrid opls charmm
dihedral_coeff 1 opls 1.50 -0.50 3.00 0.0
dihedral_coeff 2 charmm -0.1 2 0 0.0

I tried to use “pair_style lj/cut”. However, this time Lammps reports an error “Dihedral charmm is incompatible with Pair style”.

I have the following questions:

  1. Why does Lammps (Version 6 Dec 2012) report an error in the second simulation?

  2. The above error does not appear if I use Version 22 August 2012. Why? Comparing the dihedral_charmm.cpp (in which the above error was triggered) of these two versions of Lammps shows that this file was identical in these two versions.

Thank you very much.

Nick

Dear Lammps developers and users:

I have two questions related to error message "Dihedral charmm is
incompatible with Pair style".

I started by simulating molecule A, which has dihedrals defined as follows:
dihedral_style charmm
dihedral_coeff 1 -0.1 2 0 0.0
While Lammps does not allow "pair_type lj/cut" when "charmm" style dihedrals
are present, such a pair_style is allowed when the weight coeff. is zero as
in this case. Indeed, when I use such a pair_style, Lammps runs well.

Then I moved to simulate a mixture of molecules A and B. In molecule B,
there are OPLS type dihedrals. So, I changed my script to
dihedral_style hybrid opls charmm
dihedral_coeff 1 opls 1.50 -0.50 3.00 0.0
dihedral_coeff 2 charmm -0.1 2 0 0.0
I tried to use "pair_style lj/cut". However, this time Lammps reports an
error "Dihedral charmm is incompatible with Pair style".

I have the following questions:
1. Why does Lammps (Version 6 Dec 2012) report an error in the second
simulation?

you ran out of luck (or rather, your malloc gave you chunk of recycled memory)

2. The above error does not appear if I use Version 22 August 2012. Why?

you got lucky and malloc gave you a fresh chunk of memory.

Comparing the dihedral_charmm.cpp (in which the above error was triggered)
of these two versions of Lammps shows that this file was identical in these
two versions.

yes. the code in both cases does not check for charmm compatibility in
a way that takes using a hybrid dihedral style into account. the
attached patch does it better. there are still some pathological cases
that cannot be handled without a massive rewrite, but since they mean
somebody doing something rather pointless and stupid, it is not worth
fixing those, too.

axel.

lammps-charm-dihedral-check.diff.gz (751 Bytes)

There are now several alternatives to dihedral_style charmm or opls.
(Especially if you are using a weight of zero.)
Check out "fourier"
http://lammps.sandia.gov/doc/dihedral_fourier.html

(If you tried "fourier" earlier and ran into trouble, then try again.
I remember there was a mistake in the documentation at that web page,
but it looks like it's been fixed now. If you try fourier then let us
know if you run into trouble. If it helps there is an example of it's
usage online at:
http://www.moltemplate.org/examples/membrane+protein/1beadProtSci2010.lt
Scroll down to the bottom. That example uses "dihedral_style hybrid
fourier" not "dihedral_style fourier".)

Cheers
Andrew

Dear Axel and Andrew:

Thank you for responding to my inquiry. Your time is very much appreciated.

I prefer the “fourier” style as it does not require patching the code. I tested it and it gives exactly the same results with the “charmm” style and runs well on 6 Dec 2012 Lammps.

A minor note is that the online documentation for Fourier style dihedral “might” not be correct. Specifically, the example given at

[http://lammps.sandia.gov/doc/dihedral_fourier.html](http://lammps.sandia.gov/doc/dihedral_fourier.html) 

says:

dihedral_style fourier
dihedral_coeff 3 -0.846200 3 0.0 7.578800 1 0 0.138000 2 -180.0 

The second line “probably” should be replaced by

dihedral_coeff 1 3 -0.846200 3 0.0 7.578800 1 0 0.138000 2 -180.0 

where the added "1" indicates the dihedral type ID is "1". 

With best regards,

Nick