# Compute rdf commad g(r)

Dear lammps User,

Hello, everyone! I have some understanding problem about compute rdf in lammps, I read the instruction in lammps website, instruction doesn’t mention any detail for how to compute the atoms rdf between two molecules. My question is, when we compute atomes rdf g®, how the lammps command work? For example, if I have a CO2, and I want to compute the O-O rdf, but there are two Oxygen atoms in the specific molecule (the molecule we chose as center to calculate the rdf), does the lammps calculate the O-O rdf in the specific molecule?

Any explantion would be appreciate.

Thanks,
Kerwin

Dear lammps User,

Hello, everyone! I have some understanding problem about compute rdf in
lammps, I read the instruction in lammps website, instruction doesn't
mention any detail for how to compute the atoms rdf between two molecules.
My question is, when we compute atomes rdf g(r), how the lammps command
work? For example, if I have a CO2, and I want to compute the O-O rdf, but
there are two Oxygen atoms in the specific molecule (the molecule we chose
as center to calculate the rdf), does the lammps calculate the O-O rdf in
the specific molecule?

g(r) is an entity that is only defined for (point) particles, or
rather pairs of point particles. so molecules are in principle
irrelevant for this.

however, the compute rdf function uses the pairwise neighbor lists for
that. and while it does not *care* whether a pair is inter- or
intra-molecular,
depending on your choice of force field, intramolecular interactions
may be excluded as special 1-2, 1-3, or 1-4 pairs (this will happen
when the special_bonds setting is lj/coul 0.0 0.0 0.0).
so for CO2 (if you define bonds between C and O and exclude 1-3
neighbors completely), they will not show up in the output of compute
rdf. on the other hand, if you use 1.0e-20 instead of 0.0, those pairs
would be included. which is the preferred of the two options depends
strongly on what kind of analysis you need the resulting g(r)s for. in
some cases you need the intra-molecular peak, in some it is easier to
leave them out.

axel.

Thanks a lot., Alex. Now it is clear for me.

Dear lammps User,

Hello, everyone! I have some understanding problem about compute rdf in
lammps, I read the instruction in lammps website, instruction doesn’t
mention any detail for how to compute the atoms rdf between two molecules.
My question is, when we compute atomes rdf g(r), how the lammps command
work? For example, if I have a CO2, and I want to compute the O-O rdf, but
there are two Oxygen atoms in the specific molecule (the molecule we chose
as center to calculate the rdf), does the lammps calculate the O-O rdf in
the specific molecule?

g(r) is an entity that is only defined for (point) particles, or
rather pairs of point particles. so molecules are in principle
irrelevant for this.

however, the compute rdf function uses the pairwise neighbor lists for
that. and while it does not care whether a pair is inter- or
intra-molecular,
depending on your choice of force field, intramolecular interactions
may be excluded as special 1-2, 1-3, or 1-4 pairs (this will happen
when the special_bonds setting is lj/coul 0.0 0.0 0.0).
so for CO2 (if you define bonds between C and O and exclude 1-3
neighbors completely), they will not show up in the output of compute
rdf. on the other hand, if you use 1.0e-20 instead of 0.0, those pairs
would be included. which is the preferred of the two options depends
strongly on what kind of analysis you need the resulting g(r)s for. in
some cases you need the intra-molecular peak, in some it is easier to
leave them out.

axel.