couple LAMMPS with Fortran code

Hi,

I would like to couple my Fortran code with LAMMPS. I hope it is able to simulate the breaking and forming of bonds and angles when using the potential which does not allow the breaking of the bonds. I need to reset the bonds and angles by deleting broke bonds and angles and adding new bonds and angles. But after going through simple.c and library.cpp, I am not sure what functions I should call to edit the list of bonds and angles or I should add a new function to library.cpp.

If new functions are needed, where the list of bonds and angles is stored? I mean what is the name of variables for storing the lists of bonds and angles. I will very appreciate if anyone could help me with this.

Best,

Yumeng Li

I am not sure what functions I should call to edit the list of bonds and angles or I should add a new function to library.cpp.

If new functions are needed, where the list of bonds and angles is stored? I mean what is the name of variables for storing the lists of bonds and angles. I >will very appreciate if anyone could help me with this.

You would have to add new functions. Which is easy to do if you understand
the simple LAMMPS data structures. They are all defined in atom.h
and you should look at any of the bond*.cpp or angle*.cpp files to
see how they are used.

Steve

Please keep the mail list in the loop.

bond_atom is permanent. bondlist is reformed
at every reneighbor to be a list of bonds on that
processor. It depends on when your driver is updating
the bonds, whether you need to update both or
just the permanent.

Steve

Sorry, I did not realize I just reply to you directly.

I am not sure about the reneighbor and which command will invoke the reneighbor of the bonds, angles and dihedrals. I usually consider neighbor command is only about pairwise neighbor lists. Below is the input file I use. For the potentials I applied for bonds, angles and dihedrals, I think the bonds, angles and dihedrals will not change during the simulations. So does this mean I should change both of bond_atom and bondlist at the same time?

units real
dimension 3

boundary p p p

atom_style molecular

#potentail used

pair_style lj/cut 10.0
bond_style harmonic
angle_style harmonic
dihedral_style harmonic

read_data data.Lammps.polyethylene

neighbor 2.0 bin
neigh_modify delay 5

timestep 0.01

start the simulation at 100 K

velocity all create 100 50012

therostats show in the screen

thermo_style custom step vol press temp pe ke etotal

thermo 10000

dump file format

dump 1 all atom 50000 dump.polyethylene.lammpstrj
#dump 2 all custom 10000 dump.polyethyleneCV x y z vx vy vz type id
dump_modify 1 scale no

minimize the potential energy to get local minimum energy postion

minimize 1.0e-4 1.0e-6 10000 100000

#shrink the box first

fix 2 all deform 100 x erate -0.00049999 y erate -0.00050528 z erate -0.0002502 remap x
fix 14 all nvt temp 100.0 100.0 10
run 100000

Thank you very much for you help.

Yumeng Li

I can't answer well, b/c I don't really know what you
are trying to do. If you are calling LAMMPS
thru its lib interface, then you can run an entire script,
or run one command at a time, or run a few steps,
invoke a lib function (that you add if you like), run
a few more steps, etc. Wihtout knowing what you
intend to do in your Fortran code, I can't help.

Steve

I am trying to simulate the crosslinking of the epon system. Because the
potential I use, the crosslinking has to be done outside lammps. Hence I
need to update the bonds and angles during the whole simulation when the new
crosslinking is formed based on the coordinated of the atoms.

Yumeng Li

Then I imagine you want the Fortran
code to run LAMMPS for a few steps,
extract coords and bonds, change them,
put them back into LAMMPS, run a few
more steps, repeat.

Or you could use fix external, to have LAMMPS
make a callback to your Fortran driver as
often as you like from within its timestep.

Both of these are workable, but to change
bonds you will need to understand the inner
workings of LAMMPS and be careful. The
only way to do that is for you to dig into the code.
A few mail list comments is not going to suffice.

Steve

Thank you very much for your replies. It looks like it is a great point to get to know LAMMPS more.