Adding a term to bond properties of atom

Dear Lammps users/developers,

I am interested in adding an additional term similar to bond_type and bond_atom. Similar to how the bond_type stores the type of the bond, the bond_atom stores the tag of the bonded atom, I want to add an element of type double called bond_time (which is the time the bond has been in existence)

Is there any way to include this without having to change much of the source code?

Also how will this affect the bondlist creation?

Thanks

Sincerely,

Liza

Dear Lammps users/developers,

I am interested in adding an additional term similar to bond_type and
bond_atom. Similar to how the bond_type stores the type of the bond, the
bond_atom stores the tag of the bonded atom, I want to add an element of
type double called bond_time (which is the time the bond has been in
existence)

Is there any way to include this without having to change much of the source
code?

the philosophy of coding in LAMMPS is not to change any fundamental
code unless there is a very, very good reason. your proposed change
edits basic code and would require massive coding and testing for no
good reason, since it seems possible to do it differently.

Also how will this affect the bondlist creation?

i would recommend against the strategy you seem to favor. the most
straightforward approach would be to write a new fix style that
maintains an instance of compute bond/local or property/local and
processes that data on the fly. you have to apply some strategy that
makes it possible to match your doubles with the bond partners. you
also have to make sure that your code is compatible with the newton
setting for bonds being on or off.

or you can just dump it to a file and do your lifetime analysis in
post-processing.

the biggest issue will be to handle the fact that atoms (and bonds)
migrate between domains and you'd have to keep track of it in parallel
and migrate your lifetime data with it. the easiest approach would be
to do reductions and only handle this globally, but that can require a
lot of RAM for large systems and can negatively affect parallel
efficiency.

axel.

You don’t say what you want to do with your new
per-bond quantity, which you call bond_time,
similar to the existing bond_atom and bond_type,
all of which are 2d arrays: per-atom and per-bond-stored-with-atom.

You also don’t say whether bond_time is a permanent
attribute of a bond, or you have some kind of model
where you are expecting to create and destroy bonds
and somehow update these times in bond_time.

Axel is correct that you could write a new fix which allocates
and stores these values with each atom. The new fix
could take care of moving those quantities with
the atom as it migrates to new processors.

However you will still have the issue of needing to figure
out when the values in bond_time are updated, how to
access them for calculating statistics, or whatever else
you want to do. That will likely require coding other
computes or fixes that access the new data structure.

Steve

Thank you for your replies.
I want to be able to count the time from the time the bond is created to the time it breaks. I want to be able to use this quantity to calculate a time dependent force. This bond_time will not be permanent, it will have to reset to zero every time a new bond is created. I am creating and breaking the bonds based on a distance criterion.

I assume you are using fix bond/create and bond/break.
Here is a simple idea that requires no coding.

Use dump local to dump the bond list every N steps.
If you post-process the dump file and flag the
differences between 2 successive steps you can
calculate the time that bonds are broken and formed,
to a precision of N timesteps.

If you can limit the dump file to a small number
the bonds involving atoms that eligible to
create/break bonds than the file can be smaller
and you can dump it more often.

If that’s not sufficient accuracy, I think you;ll
need to write a fix that stores the “time” for
every bond (as I emailed last time), and
add some logic to fix bond/create and break
to tally their events in that data structure.

Steve

Thanks again for the suggestion.
Yes, I am using fix bond/create and bond/break. I need precision for the force calculation so I decided to go with the new fix.
The new fix stores the bondtime for all the bonds however I am not sure how to sync the bondtime with the correct bond atom. This is in order to access the correct bondtime for the force calculation.

Thanks

Sincerely,
Liza

Again, if you are convinced you can’t do what you want
via post-processing, then you need to write a new fix
that stores the bondtime data with each atom for all
its bonds. Then you will need to edit the fix bond/create
and break fixes to set/unset values in that data structure,

when it breaks/creates bonds. You could put some kinds

of stats or output method in the new fix to process the
data values.

Steve