varialble definition using atoms

First thanks a lot for the information on “atoms”, axel.
When I put atoms in thermo_style, it printed the number of atoms correctly.
However, when I define variable using “atoms”, it acts as if it is zero.
For instasnce, if I define N using “variable N equal atoms”, command of print “Natoms: $N” showed “Natom:0”.
May it be somthing like bug?
How can I solve this?

Thanks for your answer in advance.

Young

First thanks a lot for the information on "atoms", axel.
When I put atoms in thermo_style, it printed the number of atoms correctly.
However, when I define variable using "atoms", it acts as if it is zero.
For instasnce, if I define N using "variable N equal atoms", command of
print "Natoms: $N" showed "Natom:0".

it works for me.

just appended those two commands to in.melt
and it prints "Natoms: 4000"

May it be somthing like bug?

How can I solve this?

you first have to demonstrate how to reproduce it.
a potential bug that cannot be reproduced, cannot be fixed.

axel.

Thanks a lot for your answer on my question.
After recieving your reply, I tested it again using the most current lammps (windows,no-mpi, 1 July) execution file but it showed the same result to me.
I also tested it using the lammps file of October 14, 2012 in linux system but it still showed the same problem.
Would you let me know what version of lammps file you used in the test?

My input file is as follows.

3d Lennard-Jones melt

units lj
atom_style atomic

lattice fcc 0.8442
region box block 0 10 0 10 0 10
create_box 1 box
create_atoms 1 box
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

variable N equal atoms
print “Natoms:${N}”

neighbor 0.3 bin
neigh_modify every 20 delay 0 check no

fix 1 all nve

#dump id all atom 50 dump.melt
#dump 1 all image 25 image.*.jpg type type &

axes yes 0.8 0.02 view 60 -30

#dump_modify 1 pad 3

thermo 50

run 250

Thanks for your answer in advance.

Young

Thanks a lot for your answer on my question.
After recieving your reply, I tested it again using the most current
lammps (windows,no-mpi, 1 July) execution file but it showed the
same result to me.
I also tested it using the lammps file of October 14, 2012 in linux system
but it still showed the same problem.
Would you let me know what version of lammps file you used in the test?

the current version.

My input file is as follows.

# 3d Lennard-Jones melt

units lj
atom_style atomic

lattice fcc 0.8442
region box block 0 10 0 10 0 10
create_box 1 box
create_atoms 1 box
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

variable N equal atoms
print "Natoms:${N}"

here is your mistake. thermodynamic
data is only updated during thermo output.
at this point, you didn't have yet had any
thermo output, so you cannot reference
the variable or rather the "atoms" property.
it is not yet initialized.

if you move the line to the end of the script,
i.e. *after* the run command it works.

axel.

I made a change in thermo.cpp so this should now work.
It will be in a patch later today.

Steve