Computing angle of approach of a polymer translocating through a hole at every 1000 timesteps

Hello all,

I am simulating a system consisting of a polymer moving out through a hole from an inner spherical cavity to the space outside. I am interested in calculating the angle of approach the polymer makes along the axis of the hole. To do so I wish to execute the following criteria:
i)list all bead indices that are inside the spherical region(beads that haven’t crossed the hole)
ii)access the coordinates of the last and penultimate bead just before the hole
iii)calculate Rij vector between the last two beads, and then calculate the dot product with the hole axis to obtain the angle
iv)perform the calculation and output the angle to a dump file every 1000 timesteps

So far I am not still not able to find out about any commands that can list the atom indices in each group dynamically.

Your help and if possible and if you’re willing to share any input scripts would be really appreciated as it would greatly aid me in my understanding of dynamic computes

Thanks!

This seems far to complex a computation to be realized with existing commands without some additional programming. The major challenge here is that you want to access atomic data globally, but that data is distributed to the individual MPI processes during a run. The LAMMPS script language can do some “globalization” operations, but does not support computing properties this complex.

Thus it would likely be much easier to perform this type of analysis in post-processing. Since you don’t need it for every step, it should be feasible. There are multiple tools that have features supporting the implementation of such kind of analysis. I would be using VMD and particularly its “atomselect” function as I am very familiar with it. But you may want to check out other tools like those listed here: https://www.lammps.org/prepost.html

If you absolutely want to do this during the run, then you should consider using Python scripting and the LAMMPS Python module in combination with, e.g., fix python/invoke command — LAMMPS documentation
There you have gather operations to collect data from all MPI processes and access to internal data of LAMMPS.

Thank you for your help and advice, I acted on the general gist that these sort of custom calculations are invoked in lammps input script during run time to dynamically calculate and dump quantities of interest.

I have carried out the following procedure on vmd using atomselect, but I wanted to obtain the general idea of carrying it out on lammps, in order to generalise my understanding of same procedure in lammps so I may carry it out to new calculations.

I believe I may have seen it being used on many occasions where they have used to output the structural parameters of atoms that move during the run, such as tracking the center of mass of among a certain group of atoms within a certain proximity or obtaining the force felt by the last atom belonging to a dynamical group. I am unable to follow the correct use of fix ave/chunk and fix/time commands although I am aware they operate on previous computes by invoking the c_ID[] array.

I would like to ask if it is possible for anyone to send their input scripts invoking custom calculations through manipulation of compute and variables in lammps, as I will be really pick up the cues by learning from example. I have been searching through the discussion threads but so far I have hadn’t any luck finding any recently. Your help would be greatly appreciated!

Thanks!

You can do this up to a point. What you were trying to do is beyond what is practical. It is certainly possible to pre-compute some data and output only the required subset of data instead of a full system dump in order to save time and resources for a following analysis step.

Running the command: find examples/ -name in.\* | xargs grep -l chunk/atom yields:

examples/PACKAGES/addtorque/in.addtorque
examples/PACKAGES/flow_gauss/in.GD
examples/PACKAGES/dpd-meso/edpd/in.edpd
examples/PACKAGES/dpd-meso/tdpd/in.tdpd
examples/KAPPA/in.langevin
examples/KAPPA/in.heat
examples/KAPPA/in.ehex
examples/KAPPA/in.mp
examples/coreshell/in.coreshell.thermostats
examples/coreshell/in.coreshell
examples/coreshell/in.coreshell.wolf
examples/coreshell/in.coreshell.dsf
examples/VISCOSITY/in.wall.2d
examples/VISCOSITY/in.mp.2d
examples/VISCOSITY/in.nemd.2d
examples/HEAT/in.lj.ehex
examples/HEAT/in.spce.hex
examples/HEAT/in.spce.ehex
examples/HEAT/in.lj.hex

Thank you!, I will look into this