Question about interactions among atoms

Dear LAMMPS Users,

Is there a way to monitor the atoms of a group who have interactions with a group of other type of atoms in LAMMPS? What I want to achieve is that if there is an atom in one group has interactions with another atom from a different group, then I will count it in a new group. Thank you very much!

Sincerely,
Steven

No.

Thanks for your reply! So does that mean LAMMPS doesn’t have some functions that Fortran does? It seems Fortran can achieve this work.

Thank you,
Steven

You asked whether this was a feature available to do this (and I assumed you were looking for a command) and that doesn’t exist.

If you want to modify the source code you can implement whatever you want.
LAMMPS is written in C++, and in C++ your can do whatever you can do in Fortran.

Oh, OK. I see. Thank you very much for your help!

Best,
Steven

Excuse me, sir, I have one more question: I’m not familiar with the source code working with LAMMPS. Can Python achieve similar function as Fortran?

Sincerely,
Steven

Sure, you can write a code in any programming language you like to analyze your data.

But you cannot use easily use Python to change what LAMMPS is computing. At that point, any attempt to access internal data structures in LAMMPS requires a sufficient understanding on what is done and how this is organized, especially when running in parallel. Please also keep in mind that any operation programming in Python is often about 100x slower than the equivalent operation in C++ (which is the main reason why programs like LAMMPS are not written in Python).

Supported ways of interfacing LAMMPS with Python are documented in the manual. 2. Use Python with LAMMPS — LAMMPS documentation

1 Like

Thank you so much for explaining this to me! That’s really helpful! I will check the documentation about all these stuffs.

Thank you,
Steven

Interesting question, I never did it before but if you can define the interaction in form of per atom variable, you should be able to monitor the group of interaction atoms. In your case, you may need 1) first to calculate the energy/force of interaction for each atom with “compute group/group” command, then 2) define an atom variable based on your compute, finally make a new group with you variable condition similar to Lammps documentation :

variable eatom atom “c_1 > -3.0”
group hienergy variable eatom

1 Like

Hi ddinhta,

Thanks for your idea!

Yes, I tried to use “compute group/group” before, but I think this command can only calculate the energy/force for a group, not a single atom. It would be great if there is a command that can analysis the force for single atom. In my case, because I use Morse potential to represent the interaction between two groups, I wonder maybe I can also think about calculating the distance of two atoms from different groups to see whether it’s greater than the cutoff distance or not. Do you think it’s doable? However, I still feel like it’s a similar situation as the calculation of force for single atom, which is unlikely to achieve only using LAMMPS command.

Sincerely,
Steven

You are right, the output for that compute is global not per atom. For calculating the distance and compare with cutoff, I think it may doable in Lammps, but much more complicated process compared to data post-processing with other software. For calculate the interaction force for each atom, I don’t know any Lammps command for your purpose.

1 Like

Thanks for your reply!

OK. I see what you are saying. Yeah, I guess I can only use other source code to achieve this so far. Thank you for the idea!