Lammps Error: Illegal pair_style hdnnp

Hi Lammps Community :slight_smile:
Im trying to do energy minimization of a ternary alloy and the potential i have been using is hdnnp(high dimensional neural network potential). This is just a small task to check the proper working and get familiar with hdnnp. Later on I will be conducting MD simulations on it.
I am using LAMMPS 64-bit 23Jun2022-MPI version on my windows. I have hdnnp support enabled (I could see that when in type <lmp -h> in command prompt and under pair style hdnnp is there). Also all the required files like input data file and scaling file , weight file are placed in one directory.
Although it worked perfectly fine on one fine day , the next day Iam facing an error . Iam attaching the input script file .


The error goes like this —>
LAMMPS (23 Jun 2022 - Update 4)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98)
using 1 OpenMP thread(s) per MPI task
Loaded 1 plugins from C:\Users\salun\AppData\Local\LAMMPS 64-bit 23Jun2022-MPI\plugins
clear
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98)
using 1 OpenMP thread(s) per MPI task
Loaded 1 plugins from C:\Users\salun\AppData\Local\LAMMPS 64-bit 23Jun2022-MPI\plugins
units metal
boundary p p p
atom_style atomic
box tilt large
read_data “data.nn”
Reading data file …
orthogonal box = (0 0 0) to (12.184254 12.184254 12.184254)
1 by 1 by 1 MPI processor grid
reading atoms …
108 atoms
read_data CPU = 0.006 seconds
mass 1 24.305
mass 2 26.9815385
mass 3 28.0855
variable nnpDir string “E:\Al-Mg-Si-HDNNP\small cluster no vac\hdnnp-data”
pair_style hdnnp 10.6 dir {nnpDir} showew no resetew yes maxew 100000000 cflength 1.8897261258369282 cfenergy 0.03674932247495664 pair_style hdnnp 10.6 dir E:\Al-Mg-Si-HDNNP\small cluster no vac\hdnnp-data showew no resetew yes maxew 100000000 cflength 1.8897261258369282 cfenergy 0.03674932247495664 ERROR: Illegal pair_style command (src/ML-HDNNP/pair_hdnnp.cpp:178) Last command: pair_style hdnnp 10.6 dir {nnpDir} showew no resetew yes maxew 100000000 cflength 1.8897261258369282 cfenergy 0.03674932247495664

The error “Illegal pair style command” does not mean that the pair style is not present. For that you would get a message of the format:

ERROR: Unrecognized pair style 'hdnnp' is part of the ML-HDNNP package which is not enabled in this LAMMPS binary. (src/force.cpp:275)

Instead, this usually means that you have too many or too few arguments or syntax errors or similar.

As far as I can tell, the problem is here:

It is almost always a bad idea to use directory or file names with blanks in them.
In this case, the variable is correctly defined, but then, when it is used as ${hdnnpDir}, the “protective” quotes are no longer there and thus LAMMPS sees 4 “words” instead of 1.

You should be able to work around this by adding an additional pair of quotation marks to the variable definition like this:

variable nnpDir string “'E:\Al-Mg-Si-HDNNP\small cluster no vac\hdnnp-data'”

Which will then expand into the path still wrapped in the single quotes (since the double quotes are stripped off when defining the variable).

Now its working fine ! . Thank you very much for helping out @akohlmey