[lammps-users] Regional pressure

Dear All,

I want to calculate the permeability of some small gases on a membrane. I need to understand how to calculate the pressure in both sides of the membrane and consequently the drop across the membrane. I also need to know how the pressure changes on each side of the membrane with respect to the time. I wonder if you could give me some elaboration on how to implement the LAMMPS commands for these purposes.

Amir Vahid

Chem Eng Dept

The University of Akron

Akron OH 44325-3906

Dear Amir,

In order to compute the pressure difference between both sides of the
membrane, you can simply measure the total normal force on the
membrane -using compute group/group or the variable function
fcm(group,dim)- and divide it by the (projected) area of the membrane.
This is the most fundamental definition of pressure and the easiest
way to compute it.

Best,
Laurent

Thanks Laurent. It was really a helpful comment. I appreciate it!

Amir Vahid
Chem Eng Dept
The University of Akron
Akron OH 44325-3906

I followed the instructions sent by Laurent as the folllowing commands on Lammps Oct 2006:

region my_region block 0 45.97 0 45.97 0 45.97 units box
variable local_force_x equal fcm(all, x, my_region)
variable local_force_y equal fcm(all, y, my_region)
variable local_force_z equal fcm(all, z, my_region)
thermo_style custom step press pxx pyy pzz lx ly lz
print $local_force_x $local_force_y $local_force_z

However, I got the following error:

ERROR on proc 0: Substitution for undefined variable
[cli_0]: aborting job:
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0
rank 0 in job 1 polymer6.uakron.edu_33468 caused collective abort of all ranks
exit status of rank 0: killed by signal 9

I wonder if you could give me some elaboration.

I have attached my input file for more clarifications.

in.class2 (2.1 KB)

You need ${local_force_x}, etc. Always true
if variable names are more than 1 character long.

Steve

Dear Steve,
Thanks for your email.
Now when I am using the instruction, I am getting the following error msg:

ERROR: Cannot evaluate variable equal command

the input file looked like this:

(5) Dynamics

timestep 1.0
velocity all create 293 4928459 rot yes dist uniform
fix 1 all npt 293.0 293.0 1000 xyz 10 10 1000
region my_region block 0 12 0 12 0 12 units box
variable local_force_x equal fcm(all, x, my_region)
variable local_force_y equal fcm(all, y, my_region)
variable local_force_z equal fcm(all, z, my_region)
print {local_force_x} {local_force_y} ${local_force_z}
thermo_style custom step press pxx pyy pzz lx ly lz
thermo_modify window 1
thermo 1

Thanks Tyler for the message. I tried so, however, the problem is still there!

Dear all,
I am in need of using variable equal-style command (to calculate pressure in a region of my box). I could not get it running. Could anyone give me an example of input script that uses a variable equal-style (any function) and print it at each step (every certain steps) by thermo_style or print command? Thank you very much.
Amir

Dear Amir,

Could you type 'tail log.lammps' in the command line and send the
output? That would help identify where the error occurs.

As a side remark, I don't quite understand why you use the
fcm(group,dim,region) function. Wouldn't it be simpler to define a
group with the atoms of your membrane (for instance you could call it
'membrane') and measure the force on this group, e.g. fcm(membrane,x)
if your membrane is normal to the x axis. The pressure difference
would then simply be fcm(membrane,x)/ly/lz.

Best,
Laurent

Dear Laurent,
Thank you very much for the response. I think my problem at this time is that I don’t know how to give the printing commands properly (either with thermo_style or print). I tried fcm(molecules,x)… as you said and
the problem remains.
Trying to use themo_style … I get below problem:

(5) Dynamics

timestep 1.0
velocity all create 293 4928459 rot yes dist uniform
fix 1 all npt 293.0 293.0 1000 xyz 10 10 1000

region my_region block 0 12 0 12 0 12 units box

variable o equal fcm(all,x)
variable w equal fcm(all,y)
variable x equal fcm(all,z)
thermo_style custom step press pxx pyy pzz lx ly lz v_o v_w v_x
thermo_modify window 1
ERROR: Illegal thermo_modify command

Trying to use print command … I get below problem

(5) Dynamics

timestep 1.0
velocity all create 293 4928459 rot yes dist uniform
fix 1 all npt 293.0 293.0 1000 xyz 10 10 1000

region my_region block 0 12 0 12 0 12 units box

variable o equal fcm(all,x)
variable w equal fcm(all,y)
variable x equal fcm(all,z)

next o

next w

next x

print {local_force_x} {local_force_y} ${local_force_z}

thermo_style custom step press pxx pyy pzz lx ly lz v_o v_w v_x
print $o $w $x
print 0 $w $x
print 0 0 $x
print 0 0 0
ERROR: Illegal print command

“I just had print $o $w $x and I am so confused …”

I really appreciate your helps
Amir

Dear Amir,

You should try a little bit harder to solve your problems by yourself
before asking the mailing list, simply by *reading* the documentation
and looking for the error message you get in the "error" section of
the manual:

http://lammps.sandia.gov/doc/Section_errors.html

For instance:

thermo_modify window 1
ERROR: Illegal thermo_modify command

Obviously there is something wrong with the thermo_modify command.
Where did you see the window keyword?
http://lammps.sandia.gov/doc/thermo_modify.html

print 0 0 0
ERROR: Illegal print command

Here it's indeed a little bit strange, when I run lammps with the
following input file, everything goes fine:

variable u equal 0
variable v equal 0
variable w equal 0
print $u $v $w

Can you try to run this sample input file and see if it works? Are you
using the latest version of lammps?
Anyway maybe try print "$o $w $x" and see if it works...

Best,
Laurent

Hi Laurent,
Problem solved. I was actually using lammps-Oct-06 version. I found its documentation and saw that fcm is not even in the commands of that version. I switched to 2010 version and now it is working fine. Many thanks for your helps.
Amir