using box/relax for stress controlled simulation

Dear lammps-users,

I was trying to use box/relax for a stress controlled simulation to plot a stress vs. strain graph.
Relevant portions of an example code obtained from net which I slightly modified to try it is given below:

EQUILIBRATION

reset_timestep 0
timestep 0.001
velocity all create 300 12345 mom yes rot no
fix 1 all npt temp 300 300 1 iso 0 0 1 drag 1

Set thermo output

thermo 1000
thermo_style custom step lx ly lz press pxx pyy pzz pe temp

Run for at least 10 picosecond (assuming 1 fs timestep)

run 20000

DEFORMATION

reset_timestep 0

unfix 1
fix 1 all npt temp 300 300 1
fix 5 all box/relax x -500000.0

But the output I’m getting is as follows:

Step strain Temp Lx Ly Lz Pxx Pyy Pzz KinEng PotEng Press
0 0 300 40.5 40.5 40.5 -0.24469902 -0.25346541 -0.25067256 155.0734 -13440 2496.1233
1000 0 168.65049 40.5 40.602193 40.595382 -0.10963441 0.014468109 0.0042342368 87.177345 -13362.765 303.10689
2000 0 177.6 40.5 40.623444 40.606138 -0.079555206 0.058389843 0.04493502 91.803451 -13355.691 -79.232189
3000 0 182.86494 40.5 40.610783 40.609092 -0.14740168 -0.033881565 -0.0094942456 94.524957 -13346.524 635.92497
4000 0 193.44845 40.5 40.62943 40.614304 -0.14092794 0.0087068184 -0.0044679811 99.995692 -13340.115 455.63035
5000 0 205.23509 40.5 40.637377 40.627875 -0.13473825 -0.0053897561 0.010621785 106.08834 -13334.444 431.6874

Here the strain is constantly zero and box is not expanding as it should. Also, even after the whole simulation I’m not getting the required applied pressure…
Is there anything wrong in the code?

Thanks
Regards

Fix box/relax is only for use during an energy minimization,
not dynamics. So I don't understand what you are trying
to by defining it with fix npt (which is only for dynamics).

Steve