Hi All,
I'm looking for a method of locating the atom id of the atom at coordinates 0,0,0.
In my input script, I create the crystal system using the built in lammps commands, e.g.
Hi All,
I'm looking for a method of locating the atom id of the atom at coordinates 0,0,0.
In my input script, I create the crystal system using the built in lammps commands, e.g.
Hi All,
I'm looking for a method of locating the atom id of the atom at coordinates 0,0,0.
In my input script, I create the crystal system using the built in lammps commands, e.g.
==================
variable lattic_parameter equal 4.09
lattice fcc \{lattice\_parameter\} region whole block \-50 50 \-50 50 \-50 50 units lattice create\_box 1 whole region upper block INF INF INF INF INF INF units box lattice fcc {lattice_parameter} orient x 1 0 0 orient y 0 1 0 orient z 0 0 1
create_atoms 1 region upperThen currently, to locate the atom id of the atom at 0,0,0, I use the following:
==================
Variable natoms equal "count(all)"
Label loopa
Variable I loop ${natoms}
variable xx equal x[$i]
variable yy equal y[$i]
variable zz equal z[i\] if "\({xx} == 0) && (\{yy\} == 0\) &&\({zz} == 0)" then "jump SELF break"
next i
jump SELF loopa
label break
variable centralAtom equal $iThis method is fine for a small number of atoms, but when the number of atoms is large, the looping system can take an extraordinary amount of time.
Can anyone think of a better method of doing this?
here are some ideas:
1) generate a small region around 0.0 0.0 0.0
and then create a group from this region.
this should contain only the one atom you care about.
2) write out a restart file and run restart2data on it
then use a small program/script to swap the
coordinates of the first atom with those of the atom
at 0.0 0.0 0.0 and the use the clear command and
start from reading the modified data file.
3) create the coordinates with an external program
you write in the first place and write it so that
0.0 0.0 0.0 is the first atom.
axel.
This works. The run is necessary to invoke the computes
via the thermo output of the id variable.
compute allid all property/atom id
variable foo atom c_allid*(x==0.0)*(y==0.0)*(z==0.0)
compute oneid all reduce sum v_foo
variable id equal c_oneid
thermo_style custom step v_id
run 0
print "Atom at origin: ${id}"
Steve