[lammps-users] write a new compute command

Dear Steve and all lammps users,

I am trying to write a new "compute command" for:

A= \sum_i \sum_j \sum_k (rij+rik)*Bi

where

Bi=0 if rij .or. rik > rcut
Bi=Veloctiy of atom i elsewhere

So I have modified "compute heat/flux" to write a new compute command:

compute ID group_Id TEST

I have attached my new cpp and h files. Would you pleae have a look at
them? Would you please tell me which lines are unnecceray?

It could be a good tutorial for everyone to write a new compte command
that needs neighbor list and ghost atoms. ( "Bi" may be replaced with a
more complicated formula in future)

Best regards,
Ali

compute_TEST.h (353 Bytes)

compute_TEST.cpp (3.05 KB)

Sorry, I have no time to debug other people's code.
How do you use a pairwise neighbor list to generate
i,j,k triplets? Pair sw does this if you want to look at that.

Steve

Steve,

I know that you are busy enogh and I didn't mean you debug my code.
let me ask you my questions in a different way:

what does the follwing variables mean in a compute command?

1- inum = list->inum;
2- ilist = list->ilist;
3- numneigh = list->numneigh;
4- firstneigh = list->firstneigh;
5- int *mask = atom->mask;

Thanks a lot for your precious time.

Ali

Steve,

ali,

I know that you are busy enogh and I didn't mean you debug my code.
let me ask you my questions in a different way:

it is always a good idea to ask "what is this?" type questions to a
mailing list rather than posting "can somebody tell me what i am doing wrong?"
type of requests. even though your intentions may be the same,
the second type requires more work from the person to answer
and thus your chances to get a useful response will shrink correspondingly.

what does the follwing variables mean in a compute command?

1- inum = list->inum;
2- ilist = list->ilist;
3- numneigh = list->numneigh;
4- firstneigh = list->firstneigh;

the are related to neighbor lists. lammps uses an enhanced version of
verlet lists to store the information about neighbors for each "local" atom
inside a domain. i suggest reading the lammps papers for an explanation
of the principals and then read the sources if you need to know more details.

when dealing with neighbor lists, you always have to be careful that there
can be different types of neighbor lists, depending on the pair style
(full or half)
or integration style (verlet or respa) and that one can add custom requests.

the principals can probably most easily seen from the use of neighbor lists
in pair_lj_cut.cpp and pair_lj_cut.h.

5- int *mask = atom->mask;

this is the pointer to the bitmask array that allows to determine
whether an atom belongs to a given group.

cheers,
   axel.