I want to calculate residence time distribution of a system. I used the following lines in the script:
region rtd block 0 0 0 0.01 0 0.01 units box
fix rt all property/atom/tracer region_mark rtd mark_step 1000 marker_style dirac check_mark_every 1000
compute nparticles all nparticles/tracer/region region_count rtd tracer rt
fix extra all print 100 $nparticles file rttd.txt
but this error occurs:
ERROR on proc 0: Substitution for illegal variable (input.cpp:410)
I think the problem is about printing the compute command. I want to make sure if the other lines (fixing the rtd calculation and compute commands) are correct and how to fix the printing error?
BTW, my LIGGGHTS version is 2.2
Regards,
Shahab
nasato | Mon, 01/12/2015 - 10:23
Hi Shabab,
Hi Shabab,
I think you forgot the brackets in your variable. Change $nparticles for "${nparticles}".
Cheers,
Nasato
j-kerbl | Mon, 01/12/2015 - 10:37
Hi Shahab,
Hi Shahab,
to access computes you need to write "c_COMPUTENAME" and for fixes "f_FIXNAME"
more more info see e.g. the variable page of the manual where it states:
compute references = c_ID, c_ID[i], c_ID[i][j]
fix references = f_ID, f_ID[i], f_ID[i][j]
Cheers
Josef
shahabgol | Mon, 01/12/2015 - 12:18
problem
Hi
Thank you very much for answers.
I used :
fix extra all print 100 "Coords of marker atom = ${c_nparticles}"
fix extra all print 100 "Coords of marker atom = ${nparticles}"
fix extra all print 100 "Coords of marker atom = $c_nparticles"
but in all 3 cases the error remains:
ERROR on proc 0: Substitution for illegal variable (input.cpp:410)
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode 1.
can you help me solve the problem?
richti83 | Mon, 01/12/2015 - 19:48
Hi Shahab,
Hi Shahab,
this is not the correct way to access fix or compute outputs.
There are two stages of "variables"
stage 1: ${VARIABLE_NAME} -> these values are interpreted by the script parser when the script is read in (with some exceptions e.g. fix print)
stage 2: v_ID / c_ID / f_ID these values are parsed by variable.cpp functions at runtime.
Your fix produces a per-atom vector which can be accessed by dump custom command like this:
dump dmp all custom 1000 post/dump*.liggghts id type x y z vx vy vz fx fy fz omegax omegay omegaz radius mass f_rt #last column will be 0 or 1 if atom is marked
And a global scalar which can be accessed by f_rt e.g. in a variable command:
variable num_tracer_particles equal f_rt
fix extra print 1000 number_of_tracer_particles=${num_tracer_particles} #no blanks, no marks !
I see no direct way to redirect the position of the marker atom to screen output.
Maybe you can catch the ID of the atom(s) you are interested in and then
variable x equal x[ATOM_ID]
variable y equal y[ATOM_ID]
variable z equal z[ATOM_ID]
fix extra print 1000 pos=[$x,$y,$z]
shahabgol | Tue, 01/13/2015 - 12:33
appreciation
Thank you very much Richti. It was very helpful.