# Obtain the coordinate of fix wall

Hi,

I am using a moving wall written as follows:

variable ramp equal ramp(0,10)
fix 1 all wall/lj126 xlo v_ramp 1.0 1.0 1.122462

The wall compresses the atoms. I want to output the density as a
function of time and this would mean that I will need the new
coordinate of the wall. I tried using variables but I get an error,
"cannot use ramp in variable formula between runs". How do I get the
coordinates of the fix wall or how do I get the value of ramp?

Thanks,

Jan-Michael

Hi,

I am using a moving wall written as follows:

variable ramp equal ramp(0,10)
fix 1 all wall/lj126 xlo v_ramp 1.0 1.0 1.122462

The wall compresses the atoms. I want to output the density as a
function of time and this would mean that I will need the new
coordinate of the wall. I tried using variables but I get an error,
"cannot use ramp in variable formula between runs". How do I get the
coordinates of the fix wall or how do I get the value of ramp?

Can't you output the wall position to a file during the run using fix print?

Similarly you could compute volume and density directly using proper
computes and equal style variables.

Cheers,
Axel

Can't you output the wall position to a file during the run using fix print?

I was hoping that this was the case but the manual says that fix wall
can only output scalar energy and force vector. I also looked at
fix_wall.cpp and fix_wall.h and it has only compute_scalar() and
compute_vector() methods. I am looking at july 2011 version of lammps,

Similarly you could compute volume and density directly using proper

computes and equal style variables.
How do I this when I don't know the location of the wall? (box size is constant)

Can't you output the wall position to a file during the run using fix print?

I was hoping that this was the case but the manual says that fix wall
can only output scalar energy and force vector. I also looked at
fix_wall.cpp and fix_wall.h and it has only compute_scalar() and
compute_vector() methods. I am looking at july 2011 version of lammps,

But during the run you should have access to v_ramp or not?

Axel

Now this is where I am confused. I should have access with v_ramp in
thermo_style custom, right? Then, how can I use it in a variable? What
is the syntax? fix print \${ramp} does not work and gives me "Cannot
use ramp in variable formula between runs" error.

Now this is where I am confused. I should have access with v_ramp in
thermo_style custom, right? Then, how can I use it in a variable? What
is the syntax? fix print \${ramp} does not work and gives me "Cannot
use ramp in variable formula between runs" error.

there must be something wrong with either your input or your lammps binary.
when i modify in.melt as follows, it works just fine for me.

axel.

units lj
atom_style atomic
boundary p p m

lattice fcc 0.8442
region cube block 0 10 0 10 0 10
region box block -2 10 0 10 0 20
create_box 1 box
create_atoms 1 region cube
mass 1 1.0

velocity all create 3.0 87287

pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5

neighbor 0.3 bin
neigh_modify every 20 delay 0 check no

fix 1 all nve

variable ramp equal ramp(12,10)
variable step equal step
fix 2 all wall/reflect zlo EDGE
fix 3 all wall/lj126 zhi v_ramp 1.0 1.0 1.122462
fix 4 all print 10 "wall position \{step\} {ramp}"
thermo 10
thermo_style custom step elapsed ke pe press temp vol v_ramp

dump id all atom 50 dump.melt

run 250

Thanks Axel,

I needed the quotation marks for fix print to work. Now, how do I put
the value of ramp on an "equal" style variable? I still get the
"Cannot use ramp in variable formula between runs" error when i use
this line:

variable dens equal count(polymer)/8/xhi/yhi/\${ramp}

Jan-Michael

Thanks Axel,

I needed the quotation marks for fix print to work. Now, how do I put
the value of ramp on an "equal" style variable? I still get the
"Cannot use ramp in variable formula between runs" error when i use
this line:

variable dens equal count(polymer)/8/xhi/yhi/\${ramp}

as you should, you need to use v_ramp
and \${var} style variable is expanded immediately,
but you don't want then, and thus need to
use the v_var style representation.

axel.

I still get the
"Cannot use ramp in variable formula between runs" error

The reason you cannot use ramp in a variable that gets
evaluated between runs, is that ramp is defined as a quantity
that only makes sense during a run (i.e. the fractional value
between the start and end of the run). So you have to insure
you do not directly or indirectly evaluated a formula
that has a ramp() in it.

Steve