On how RDF calculations for multiple ions should be done in LAMMPS

I want to calculate the RDF of ions 1, 2 and 3 in a box with respect to ion 4. Treating 1, 2 and 3 as the same ion, how do I write the compute command?

Please see the documentation for the compute rdf command — LAMMPS documentation.
The command allows to specify type ranges and how to enter and use them is explained in detail.

Thank you very much for your answer, I have read the compute rdf command - LAMMPS documentation. But the cases I have seen only calculate the RDF between two classes of atoms, whereas I want to calculate the RDF between 1, 2 and 3 as a type of atom with 4 atom

Please read the entire documentation for the command. It does explain how you can run what you want to do. I quote:

The itypeN and jtypeN settings can be specified in one of two ways. An explicit numeric value can be used, as in the fourth example above. Or a wild-card asterisk can be used to specify a range of atom types. This takes the form “*” or “*n” or “m*” or “m*n”.

Thank you very much for pointing out the method for me, I would like to ask you again if I write the command :
“compute 1 all rdf 200 3*5 6‘’
is calculated 345-6 RDF or 3-6, 4-6, 5-6 RDF?

While the documentation is rather explicit, you can still set up a quick test with a dummy fcc crystal, change atom types randomly between 3 or 4 types and compare the output of both commands on a dummy run. You don’t even need physical results, just the number of columns.

This might be more instructive to you to understand what’s going on and this is a trick you can use if you have other questions of the same type on another command.