Dear all:
I’m writing a fix involving the creation of new molecules (including bond, angle ….).
In pre_exchange() stage, I manage to create everything associated with the atom class, but looks like the global to local atom id map is not set as the error appears in ntopo_bond_all.cpp atom->map(tag[kk]) still yields -1.
And I don’t understand where the map is actually set.
The result should be atom->map(tag[kk]) =kk which I know already.
Could anyone explain where the map is actually set or if there are some similar codes relative to the creation of a molecular with bond, angle structures?
Thanks, a lot!
Part of my code is shown below.
// atom->avec->create_atom(l,xh); // create new atom
nlocal = atom->nlocal;
kk = nlocal - 1;
atom->molecule[kk] = static_cast(buf_recv[k+1]);
atom->mask[kk] = static_cast(buf_recv[k+3]);
for (j = 0; j < 3; ++j) // assign velocities
atom->v[kk][j] = buf_recv[k + 7 + j];
k += part_size;
if (molecule[kk]){ // assign molecular data
tag[kk] = static_cast(buf_recv[k++]);
atom->num_bond[kk] = static_cast(buf_recv[k++]);
for (m = 0; m < atom->num_bond[kk]; m++){
atom->bond_type[kk][m] = static_cast(buf_recv[k++]);
atom->bond_atom[kk][m] = static_cast(buf_recv[k++]);
}
atom->num_angle[kk] = static_cast(buf_recv[k++]);
for (m = 0; m < atom->num_angle[kk]; m++){
atom->angle_type[kk][m] = static_cast(buf_recv[k++]);
atom->angle_atom1[kk][m] = static_cast(buf_recv[k++]);
atom->angle_atom2[kk][m] = static_cast(buf_recv[k++]);
atom->angle_atom3[kk][m] = static_cast(buf_recv[k++]);
}
…
……………………………
if (atom->map_style) {
atom->map_init();
atom->map_set();
}
//