[I am running a 3-Nov-2022 build of LAMMPS on an AMD 8-core machine.]
I want to simulate 10 polymers whose end units (one at each end) are all identical, but I would like to display them with a color unique to the particular polymer for still images and movies. I can do this by declaring 10 types of units (1 type for each polymer), but I wondered if there is a more compact way to do this, since they are identical with regard to pair interactions.
No, you can use any per-atom attribute that is available to dump custom to color atoms by, same as for atom diameter. So using the molecule id via “mol” should work.
However, if you want a color scheme similar to what you get for atom type, you have to dig deeper into the many, many settings and change the coloring method. By default, only type and element get the “sequence of colors” treatment, everything else is using a color gradient.
I’m not whether either of these two posts goes with what I want to do. Say,
1st polymer: atom #1 and atom #50 (at each end) are both red, all others are gray with smaller diameters
2nd polymer: atom #51 and atom #100 (at each end) are both blue, all others are gray with smaller diameters
—etc—
These atoms are otherwise identical in terms of interactions.
I don’t see a way to do this except to declare that atoms #1 and #50 are of one type, and atoms #51 and #100 are a second type, etc. (one additional declaration for each polymer), then refer to them by type in the dump image command. That’s OK, except there’s a proliferation of atom types that are physically/chemically equivalent, and are different only for visualization purposes. Unless there is a way to select both an atom type and the molecule it sits in, or I can refer to an atom by its sequential ID… I could not find that in the documentation.
You can use the molecule ID for this purpose, if you don’t need to use it for anything else. The molecule ID has no impact on the physics, it is merely used as a “marker”. If you don’t want to do that, you can assign a custom (integer) property to each atom using fix property/atom and then specify that as property to derive the atom color from. In either way, it takes a bit of time to figure out the details from the documentation, since the image dump facility has many options.