Wide fluctuations of pressure in npt

fields and outputs like temperature, energy, etc, but in NPT simulation I do not get logical results, as, the fluctuations of the pressure, which is set to 1 atm, are from about -400 to 400 atmosphere! I used the following command for fix NPT with 1 timestep in real unit:

Adding to what Axel said, 400atm is actually pretty good. I regularly have fluctuations of several 1000s of bars with solids.
The point is, you need *far* larger systems to get stable pressure than for stable temperatures. I would estimate 100x more atoms for the same relative error. As far as I know, there is no barostat that is numerically stable and still represents the theoretical behaviour of the NPT as "constant pressure, large fluctuations in volume".

What you can do is use fix ave/time with settings like "1 1 1 ave window $(15*tnpt)", tnpt being the time constant of your barostat in timesteps. This should after some time give you the "true" ensemble value, which should be very close to what you specified as the setpoint.

Depending on what you want to do with the trajectories, other barostats might be "better", but they will give you different probability distributions. Keep that in mind.
And whatever you do, don't use fix_nh's drag options. As I had to discover, that doesn't just dampen the cell PDEs, the results will be flat out wrong.

Sebastian