Restrictions on name of new styles

Hello,

I’ve noticed that if I use create a new angle style containing a forward slash in it’s name, as done for angle style cosine/squared, for example, the angle style is not recognized, and the following error is seen:

ERROR: Angle coeff for hybrid has invalid style (…/angle_hybrid.cpp:260)

If I merely replace my custom angle style with cosine/squared in the input file, no error is thrown. If I name my angle style without a forward slash or underscore, no error is seen either. I am currently attempting to use the following:

#ifdef ANGLE_CLASS
AngleStyle(3spn2/stacking,Angle3spn2Stacking)
#else

If I replace it with

#ifdef ANGLE_CLASS
AngleStyle(stacking,Angle3spn2Stacking)
#else

I see no error. Does LAMMPS have extra restrictions that I am not aware of? Or do I need to make another change to the code?

Thank you in advanced for your assistance,

Dan

Hello,

I've noticed that if I use create a new angle style containing a forward
slash in it's name, as done for angle style cosine/squared, for example, the
angle style is not recognized, and the following error is seen:

ERROR: Angle coeff for hybrid has invalid style (../angle_hybrid.cpp:260)

If I merely replace my custom angle style with cosine/squared in the input
file, no error is thrown. If I name my angle style without a forward slash
or underscore, no error is seen either. I am currently attempting to use
the following:

#ifdef ANGLE_CLASS
AngleStyle(3spn2/stacking,Angle3spn2Stacking)
#else
...

If I replace it with
#ifdef ANGLE_CLASS
AngleStyle(stacking,Angle3spn2Stacking)
#else
...

I see no error. Does LAMMPS have extra restrictions that I am not aware of?
Or do I need to make another change to the code?

not sure if you are running into a "feature" of LAMMPS or rather of
the C preprocessor, but my guess is that the issue is not dependent on
the forward slash but rather on the name starting with a number. try
using a letter as the first character of your style name.

axel.

Thank you for the response, Axel. The issue was indeed the style starting with a number.

Dan

Thank you for the response, Axel. The issue was indeed the style starting
with a number.

lucky guess, i guess... :wink: