how to set a new value to a atom-variable

Submitted by strathclyde on Wed, 09/23/2015 - 21:04

Hello guys,

I define a atom variable. Then loop all atoms, do some calculation about the array and get a value of every atom. Finally modify the radius of every atom, as follows:

variable stress atom 5.0
label loopa
variable i loop 538 // i is the ID of the atom , 538 is the total amount of the atoms
variable C1 equal v_stress[$i] //
if "${C1} <= 0.0" then stress[$i]=0.2// modify the variable 'stress'-> stress[i]=0.2
variable C1 equal v_stress[$i] //
set atom $i property/atom diameter ${C1} //set the diameter to variable C1 to relevant atom which ID is 'i'
next i
jump in.initialgravity loopa

So now, it seems like I could not return value 0.2 to the atom variable stress with the ID 'i' like this->stress[$i]=0.2

How should I do?

Many thanks,

Leo