I need to add an additional per-atom vector to store information about atoms, when I compute bond_harmonic style potential. These values should change during the simulation. I defined the new per-atom vector in input script as
"fix 1 all property/atom i_flag "
Now I add these lines in compute function of bond_harmonic.cpp
const char *name;
flag=0; //integer array
cols=0; // per atom array
name =“i_flag” ;
int idx = atom->find_custom(name, flag, cols);
int *ilist = atom->ivector[idx];
It compiles and create executable, but when I try to run it, I get segmentation error. Because the value of idx is “-1”, because it is a null pointer. How do I fix this error. What is the ‘name’ in the find_custom command. Do I need to change any other .cpp files for my use. Please clarify.
Thank you for your time