Pair_style error

I’m reading a .data file in which the pair_style isn’t defined. So I manually wrote “Pair_style lj/cut/coul/long” before pair-coefficients inside the .data file. It gives me this error:
“ERROR: Unknown identifier in data file: pair_style lj/cut/coul/long (src/read_data.cpp:727)
Last command: read_data layer.data”

The pair_style command should be used in the lammps input file (the one you specified by standard input or -i switch; see 4.1. Basics of running LAMMPS — LAMMPS documentation) instead of data file. Also see 4.1. Basics of running LAMMPS — LAMMPS documentation for list of attributes that can be specified in the data file.

This is the version where pair_style is used inside the lammps input file:

Initialize simulation

units real
dimension 3
boundary p p p
atom_style full

Information of pair of atoms

pair_style lj/cut/coul/long

Read data file

read_data layer.data

Define simulation parameters

timestep 0.001
thermo 1000
thermo_style custom step temp press pe ke etotal
dump 1000 all custom my_dump_file.dump id type x y z
run 0

Define NVT ensemble

fix 1 all nvt temp 300.0 300.0 100.0

Run simulation

run 10000

and the error it gives is:
ERROR: Illegal pair_style command (src/KSPACE/pair_lj_cut_coul_long.cpp:595)
Last command: pair_style lj/cut/coul/long

Please check the documentation pair_style lj/cut/coul/cut command — LAMMPS documentation. Namely you need to specify additional arguments (cutoff) after pair_style lj/cut/coul/long.

Also check out kspace_style kspace_style command — LAMMPS documentation which is required when using long-range coulomb pair styles.

It worked. Thanks a lot