Plotting potential between two particles

Hello I am trying to plot potential vs distance plot for silicon and other particle but lammps giving me
Pair style does not support pair_write (src/pair.cpp:1781)
Last command: pair_write 1 2 500 r 0.1 3.0 table.txt LJ

How should i plot PE vs r plot then?

Here i am pasting my script file:

units metal
dimension 3
boundary p p p
atom_style atomic

variable a equal 5.431
variable t equal 2200.0

lattice custom $a &
a1 1.0 0.0 0.0 &
a2 0.0 1.0 0.0 &
a3 0.0 0.0 1.0 &
basis 0.5 0.5 0.0 &
basis 0.0 0.5 0.5 &
basis 0.5 0.0 0.5 &
basis 0.25 0.25 0.25 &
basis 0.25 0.75 0.75 &
basis 0.75 0.25 0.75 &
basis 0.75 0.75 0.25

region box block 0 4 0 4 0 4

create_box 2 box
create_atoms 1 box
create_atoms 2 random 1 423412 box

mass 1 28.06
mass 2 28.06

velocity all create $t 12345

group si type 1
group pr type 2

pair_style hybrid lj/cut 2.5 sw
pair_coeff * * sw Si.sw Si NULL
pair_coeff 1 2 lj/cut 1.0 2.0951 2.351670237
pair_modify shift yes
pair_coeff 2 2 lj/cut 1.0 1.0 2.5

pair_write 1 2 500 r 0.1 3.0 table.txt LJ

neighbor 0.3 bin
neigh_modify every 1 delay 0 check yes

minimize 1.0e-6 1.0e-8 1000 1000
timestep 0.001
thermo 10
thermo_style custom step temp ke pe etotal density vol press

fix 1 all nvt temp $t $t 1.0

dump id all atom 100 SiBath.dump
run_style verlet

run 5000

Hi @pankaj,

your script does not work because you are calling pair_write with the hybrid style which does not support it. As stated in the documentation:
The pair_write command can only be used for pairwise additive interactions for which a Pair::single() function can be and has been implemented. which is not the case for the hybrid style (it cannot call Pair::single() for substyles as far as I know).

A minimal working example script like this will give you what you expect:

units metal

region box block 0 4 0 4 0 4

create_box 1 box

pair_style lj/cut 2.5
pair_coeff 1 1 1.0 2.0951 2.351670237
pair_modify shift yes

pair_write 1 1 500 r 0.1 3.0 table.txt LJ

because only your LJ potentials applies between you type 1 and 2 atoms.

3 Likes

thank you for this answer it helped a lot.