Fix adapt for bond style hybrid

Hello,

I am working on a polymer simulation that requires using a hybrid of FENE and harmonic bonds. In the simulation, I would like to gradually increase the spring constant k of the harmonic bonds over time using the variable equal ramp feature.

I was looking into using the “fix adapt” command, but I found out that it does not currently support the hybrid bond style. Is there a reason for this?

I tried modifying the fix_adapt.cpp file by just commenting out the lines that check if the bond style is hybrid, i.e.,

if (utils::strmatch(force->bond_style,“^hybrid”))
error->all(FLERR,“Fix adapt does not support bond_style hybrid”);

The simulation seems to run fine without generating any errors (with LAMMPS version June 2022). Is there any caveat to this modification (for this simple case of having a hybrid of FENE and harmonic springs)?

Here is a snippet of the commands that I have been using:

bond_style hybrid fene harmonic
special_bonds fene
variable kramp equal ramp(0.0,200.0)
bond_coeff 1 fene 30.0 1.6 1.0 1.0
bond_coeff 2 harmonic 0.0 1.1
fix varyharm all adapt 1 bond harmonic k 2 v_kramp

run 100000
unfix varyharm

Thanks for your help in advance.

Michael

I have just had a closer look at the corresponding source code and can assure you that there is not much to worry about since for bond styles, you may not use the same bond style more than once. So you’ll always get the expected sub-style. The main thing that is missing when only deleting the test is the check for valid parameters and the correct/consistent substyle and bond type.

I have implemented those changes - also for angle style hybrid - and they will be available in a future LAMMPS release.

Can this functionality be implemented for dihedrals too?

That requires much more work since there is currently no support for dihedrals (or impropers) in fix adapt at all and no dihedral styles that support the extract() method.

What I have done is simply enabling support for the hybrid styles for bonds and angles.

P.S.: I would suggest to submit a Feature Request issue. Perhaps somebody is willing to add this. It is a perfect project for somebody with less experience in LAMMPS programming, since the programming part is not that complicated and the support for bonds and angles can be used as a template. The part that makes this a lot of work is the testing.

P.P.S: also adding the extract() method to more styles would be welcome. I just made a simple inexact check and found that only 122 out of 284 pair styles, 11 out of 28 bond styles, and 3 out of 28 angle styles have an extract() method. In practice, fewer will be needed since some styles are derived classes and thus can use the extract() function of the base class and some are not suitable at all (e.g. most manybody potentials).

1 Like