[lammps-users] ID assignment

Just an addition.

More than the complications involved, I wonder about the issue of making the
input code as general as possible to accommodate changes in the input
polymer structures comfortablely. The current language I am using i.e. C,
isn't somehow is the best fit I feel.

Thanks
Chetan

Hello Chetan,

If the atom is in the system, it has to have an id. Likewise, if you want to have an angle or dihedral calculated, it has to have an id. The programming language used to generate the code to number the items in your system is unlikely to be the biggest bottleneck. I’ve done comparable programs in python and in fortran for printing the topology of polymer chains. I didn’t notice a huge difference in ease between using those two languages. The biggest help was having a list of patterns available to use on a system that had atoms consistently numbered based on their position in the repeat unit. Have you thought about what recurring patterns you can use as templates? What I mean by patterns is, for example, if i is a carbon with two carbon bonds, then angles “i-1 i i+1”, “i-1 i i+2” “i-1 i i+3” exist so you can just write out angles j, j+1, j+2 and move on to the next atom. The same thing can be done with dihedrals.

Speaking from experience, making the code extremely general was too much trouble and I abandoned my effort to do so. Unless you have a basically random system with any atom bonded to any other atom type and no discernable relation between their atom ids, I wouldn’t bother. Take advantage of the repeat unit nature of your system as much as possible. If you make a special type of atom at branch points, chain ends, and ring closures, you can then set up functions to treat those atoms as special cases.

Good luck!

Joanne

Hi Joanne

Thanks for the quick reply. Yeah I have employed the use of repeating unit/pattern quite a bit, but my only concern was that it’s not getting generalized and easy as a I want. But yes it does make me clear that learning python may not solve this particular problem to significant extent.

Well, other than that, if I want to neglect any dihedrals (like also in the energy calculations), then I guess it’s fine with topological correctness as demanded by lammps, right?

Thanks again

Chetan

Hi Chetan,

LAMMPS doesn’t care if you neglect all the dihedrals or all the angles or even all the bonds. As long as you have excluded volume interactions to keep atoms from overlapping too closely, LAMMPS generally won’t scream. However, you may care because neglecting dihedrals will give your system the wrong dynamics. The short explanation is that physical systems don’t come with little tags indicating “This is energy due to dihedral 1, that is energy due to angle 3, and the other is energy due to bond 4”. The art of creating a potential is divvying energy into interactions that add back up to the physical behavior observed. Arbitrarily deciding that something is too much trouble, instead of basing the decision on contribution to the energy and other properties of interest, is poor practice and I advise against it.

To answer the python query, it would probably be worthwhile to spend a couple hours browsing through the features of python. If something strikes your fancy (e.g., “With a dictionary entry keyed to patterns, I could much more easily do X”, “Lists are exactly what I need for Y”, or “Yes, that array operation would completely eliminate these two slow loops”), then it may be worth investing a couple days into learning enough python to write your code. If all you are going to do is write C using python syntax, you really won’t see any benefit.

Joanne

Hi Joanne

Thanks for detailed reply. Well I appreciate your point that neglecting certain energy contributions, just to simplify the job may not be the correct approach. But my approach was based on the assumption that dihedrals containing H or F atoms may not contribute much as compared to the ones involving backbone.

Thanks again

Chetan