Assigning color to atoms

I have a spherical Aluminum particle of 7nm diameter (containing almost 11000 atoms) in a cubic simulation box. I want to select and assign different colors (say yellow) to the atoms which lie outside the 9/10th radius range (from the center of sphere) from remaining atoms (assign them blue color). Can any one please tell me how to do this. I tried to solve this problem in Atomsk etc. also but haven’t been able to figure out anything as of now.
In other words, I want to mark those atoms so that I can track/visualize in OVITO where they went after I do a deformation simulation on them.
I am attaching the datafile here as well in case it is required by anyone. Thank you very much in advance.
Alsphere.lmp (873.1 KB)

You cannot assign a color to atoms. The choice of color is a choice of the visualization software.
In order to make it easy to tell atoms apart, you need to assign different atom types to them.

This can be easily done with a little LAMMPS input like the following:

units metal
read_data Alsphere.lmp extra/atom/types 1

region shell sphere 35.0 35.0 35.0 30.752 side out
set region shell type 2
mass 2 26.98153860

write_data Alsphere-new.lmp nocoeff
1 Like

Ok, thank you. I greatly appreciate your help.

Sir, can you please tell me how can we do above if we have two type of atoms already and want to change the atom type from 1 and 2 to type 3 and 4 respectively (only for those atoms who falls outside the given radius range) . I’m attaching the data file and trail script (not working properly) below for reference. Given script is changing all the atoms in ‘shell’ region to type 4. Thank you.

script (307 Bytes)
mgsphere.lmp (697.3 KB)

This question would be better posted in the OVITO section of the forum. Note that you can make a selection using a formula like sqrt((Position.X-35)*(Position.X-35)+(Position.Y-35)*(Position.Y-35)+(Position.Z-35)*(Position.Z-35)) > 30.752 directly in the software and fiddle with the pipeline modifiers to track your particles along.

Your script is not working properly because you don’t understand the options you are using. Some quick comments:

  • set region applies changes to all atoms in the given region. This is not what you want since you want only specific types in the selected region.
  • The type/fraction argument is used to randomly change atoms. Again this is not what you want.
  • set group would apply to a group. You can combine groups (which are basically just boolean yes/no flags applied on atoms) and you can make groups based on region on the one hand, and types on the other.

It is rather straightforward to define two group containing each set of atoms you want to change. I suggest you read the group command and set command manual pages and go through all the arguments. Your script requires only few modifications and ends up being a good exercise for figuring out how groups combination works. Overall give a better reading to the doc of the commands you want to use and wrap your head around it. The answers to you questions will be there most of the time. :wink:


Thank you sir for the advice. I’ll try to figure out something based on the info provided.