Variable & non-periodic NPT

Dear LAMMPS users ,

I have a system that is non-periodic at Z direction .
Now I want to do NPT simulation on my system with Px = Py= Pz
like this :

Fix 1 all npt temp 300.0 300.0 100.0 x {PZ} {PZ} 1000.0 y {PZ} {PZ} 1000.0

but LAMMPS gives this error : Compute used in variable thermo keyword between runs is not current

I used :

run 0
variable PZ equal pzz
run 100

before fix command but again i get the same error !

Can you please let me know how i can solve this problem ?

Best ,
Saeed.

See the bottom of the variable doc page for info
about how to insure variables and thermo keywords (Paz in your case)
are current on the time steps they are used. It has to do
with whether your run 0 invoked the compute that calculates
Paz, e.g. with thermo output from your run 0.

Steve

Dear Steve ,

Thanks for your reply .
Actually I tried all of the possibilities but I couldn’t solve this problem .
I just want to have pressure at Z direction after first run and then I want to do NPT simulation with that amount of pressure ( pzz) !
but LAMMPS gives me this error : Compute used in variable thermo keyword between runs is not current

Best,
Saeed.

Are you outputting pzz with thermo output from the run 0?
If so, please post as simple as possible an input script that
triggers the error.

Steve

Are you outputting pzz with thermo output from the run 0?
If so, please post as simple as possible an input script that
triggers the error.

​steve,

this is normal behavior for quite a while now. to access such properties,
they have to be run through fix ave/time to be available in between run.​

that said, i fail to see a good reason to access such a property, that is
known to fluctuate wildly in condensed systems, from an initial
configuration as a reference pressure for an NPT run.
this doesn't make much sense. at best, you would want to have a well
equilibrated system and then use the value that has been averaged over a
sufficiently large period of time.
but even then, one usually uses fix npt to impose a known pressure
condition on a system and not infer it from a known volume and fixed
geometry. it would be simpler to just keep that volume.​

​axel.​

Hi .

This is a simple script of my input file :

units real
dimension 3
boundary p p f
atom_style full
bond_style harmonic
angle_style harmonic

pair_style …


timestep 1.0
fix NVT water nvt temp 300.0 300.0 100.0
run 100000

unfix NVT

I strongly agree with Axel that using an instantaneous value of pressure as your value of choice in NPT is a very bad idea since the pressure can fluctuate very much.

The error you get is due to the fact that the value of the pressure, pzz, must be calculated with fix ave/time that timestep to be accessible between runs (since you are using it in a command).

Anders

Dear Anders ,

Thanks for your reply .
I also agree with both of you about the fluctuation of pressure but If I use " boundary p p f " and also if i do NVT simulation before NPT for a long time to get equilibrated system I think at that time i can count on pressure amount at Z direction !
Finally I could extract pzz between to run by this way :

fix NVT water nvt temp 300.0 300.0 100.0
run 100000

unfix NVT

Even in equilibrium, the pressure fluctuates. You should, if you really want to use it, do as Axel said and average it over a long time.

Please plot pressure as a function of time (every timestep) and see for yourself. You might get surprised :smiley:

Anders

If I use ave/time between two runs for having a exact amount of pressure is there any way to use it’s output for next run ?
I mean how can i use fix ave/time output in next run ?

If you have your fix ave/time called averagePressureZ, you can (if last run ended so that the fix just calculated a value, I.e. multiple of nfreq) access the output with

f_averagePressureZ

See the docs for fix ave/time (all the way down on the page.

Correct me if I’m wrong axel!

Anders

this is normal behavior for quite a while now. to access such properties, they have to be run through >fix ave/time to be available in between run.​