Accessing all the atoms in a mlecule

I was writing a custom fix to add force on each atom of a molecule .I need all the atoms in a molecule.
There are 3 arrays (molid ,molecule ,molatom).What are they representing?
How can ia cess all the atoms in amolecule?

There are NO global arrays in LAMMPS. Arrays that are globally accessible are part of a class. One would need to know which class you are looking at. None of the LAMMPS core classes has a “molid” class member:

[src]$ grep molid *.h
[src]$ 

The “molindex” and “molatom” arrays are only defined in the Atom class and are only relevant for atom style template (for more on that see atom_style command — LAMMPS documentation).

In general, LAMMPS has no concept of “molecules”. The molecule ID is just a number that can be used to group atoms, but it neither is required to indicate molecules, nor has changing the molecule id an impact on the force computation. Some functionality, e.g. fix rigid or delete_atoms assume that all atoms with the same molecule ID are in the same molecule. The molecule ID is stored in Atom::molecule.

Collecting constituent information about all atoms in a molecule requires either some replicated global data structure within the fix and global communication (and thus limited parallel scaling) or having some data structure that is associated with one of the constituent atoms of a molecule (with better parallel scaling, if the molecule is “small”). You can see the difference in the management of the rigid body information in fix rigid and fix rigid/small (the latter works ony with the molecule ID as defining the rigid body).