Change pair style from coul/long to coul/cut

Hello all,

I’m running a MD simulation in which I need to change the boundary after equilibration. I performed the equilibration part with:

Boundary p p p

pair_style lj/class2/coul/long 12.5

kspace_style pppm 1e-4

After performing appropriate equilibration, I need to change the boundary to perform a pull-out test (from p p p to p p s). Here, we need to change the pair_style before changing the boundary condition (cause we can not use coul/long for nonperiodic systems). So I added the following lines:

pair_style lj/class2/coul/cut 12.5

kspace_style none

pair_modify mix sixthpower

change_box all boundary p p s remap

I faced the following error:

ERROR: All pair coeffs are not set (…/pair.cpp:225)

Now, here is the question**: Is it possible to change the coul/long pair_style to coul/cut?!**

I have no problem if I use coul/cut pair_style for the whole simulation and the change_box command works without any errors.

Thank you so much for your time and considerations.

Bests,

Abolfazl

Hello all,

I’m running a MD simulation in which I need to change the boundary after equilibration. I performed the equilibration part with:

Boundary p p p

pair_style lj/class2/coul/long 12.5

kspace_style pppm 1e-4

After performing appropriate equilibration, I need to change the boundary to perform a pull-out test (from p p p to p p s). Here, we need to change the pair_style before changing the boundary condition (cause we can not use coul/long for nonperiodic systems). So I added the following lines:

pair_style lj/class2/coul/cut 12.5

kspace_style none

pair_modify mix sixthpower

change_box all boundary p p s remap

I faced the following error:

ERROR: All pair coeffs are not set (…/pair.cpp:225)

Now, here is the question**: Is it possible to change the coul/long pair_style to coul/cut?!**

yes it is possible, but you will lose all pair_coeff settings whenever you define a new pair style. those values are stored with the pair style specific data structures and thus deleted when the pair style gets changed.

in this case there should be a workaround, since the pair_coeff settings should be compatible. you can try writing those out first and then reading them back with something like this:

write out all *_coeff settings from pair styles that support it

write_coeff my.coeffs

pair_style lj/class2/coul/cut 12.5
kspace_style none
pair_modify mix sixthpower

read back all *_coeff settings

include “my.coeffs”

change_box all boundary p p s remap

axel.

Dear Axel,

Thank you so much for your quick response.

I went through your comments and added the line to the code. This time we have an error in the writing of coeffs with the write_coeff command.

Attached I have enclosed the “my.coeffs” file. As can be seen, the Angle_coeff for BondBond Coeffs (line 154) has been written with an incorrect syntax (we have similar problem for the BondAngle Coeffs, AngleAngleTorsion and etc.) So I faced the following error this time:

Incorrect args for angle coefficient (…/angle_class2.cpp:272)

Since we are working with a class2 forcefield, then how can we write the coefficients in a correct way? It seems that write_coeff command does not work properly on the class2 forcefields!

Bests,

Abolfazl

my.coeffs (25.2 KB)

Dear Axel,

Thank you so much for your quick response.

I went through your comments and added the line to the code. This time we have an error in the writing of coeffs with the write_coeff command.

Attached I have enclosed the “my.coeffs” file. As can be seen, the Angle_coeff for BondBond Coeffs (line 154) has been written with an incorrect syntax (we have similar problem for the BondAngle Coeffs, AngleAngleTorsion and etc.) So I faced the following error this time:

Incorrect args for angle coefficient (…/angle_class2.cpp:272)

Since we are working with a class2 forcefield, then how can we write the coefficients in a correct way? It seems that write_coeff command does not work properly on the class2 forcefields!

is this with the latest version of LAMMPS (currently 15 Nov 2018)?

axel.

Dear Axel,

Thank you so much for your quick response.

I went through your comments and added the line to the code. This time we have an error in the writing of coeffs with the write_coeff command.

you can simply transform the file using grep, e.g. with

write_coeff my.coeffs
system “grep pair_coeff my.coeffs > pair.coeffs”

include pair.coeffs

axel.

I used June 2018 version.

You mean that the problem has been solved in the “15 Nov 2018” version?

Thank you very much for your valuable comments.

Best Regards,

Abolfazl

I used June 2018 version.

are you sure?? your my.coeffs file says 11 August 2017

You mean that the problem has been solved in the “15 Nov 2018” version?

i don’t know, but i won’t even spend the effort to look and try to correct it, unless it is confirmed that this issue persists in the latest development version.

axel.

I checked the run with a LAMMPS August 2017 and June 2018 versions and the error persisted with the write_coeff command.

Thank you again for your time and considerations.

Best Regards,

Abolfazl

I checked the run with a LAMMPS August 2017 and June 2018 versions and the error persisted with the write_coeff command.

but what i NEED to know is, whether this persists with the 15 November 2018 version.
i don’t want to waste my time on looking for a bug that may not exist anymore.

axel.

You are absolutely right

I will check it with the 15 Nov 2018 version and keep you posted.

Thank you.

Abolfazl

Dear Axel,

I checked the performance of write_coeff command in the last version of LAMMPS (15Nov2018). I just want to inform you that the problem persists in it, especially for writing class 2 pair coefficients. Attached I have enclosed the coeffs file writed by write_coeff.

Thank you very much for the time and consideration.

Bests,

Abolfazl

my.coeffs (25.2 KB)

Dear Axel,

I checked the performance of write_coeff command in the last version of LAMMPS (15Nov2018).

thanks.

I just want to inform you that the problem persists in it, especially for writing class 2 pair coefficients. Attached I have enclosed the coeffs file writed by write_coeff.

sorry, i don’t see any problems with pair coefficients, only angle, dihedral, and improper. pair and bond coeffs look ok.
i will look into correcting this and include it into the next patch/stable release.

as you are only replacing the pair style, you only need to re-read the pair_coeff statements, so you can easily work around the issue by issuing a grep command on the file to filter out only the pair_coeff statements.

shell grep pair_coeff my.coeffs > pair.coeffs

and then include pair.coeffs instead of my.coeffs.

axel.

Dear Axel,

Thank you so much for your consideration and your valuable comments.

Well, the problem is that for example for a class 2 BondAngle Coeffs should be like this:

angle_coeff 1 ba 11.4210 20.7540 1.1010 1.5300

While if you look into the file created by write_coeff (line 193-195), we have:

angle_coeff 1 11.421 20.754 1.101 1.53

and similarly for BondBond, AngleAngle, AngleAngleTorsion, etc.

Dear Axel,

Thank you so much for your consideration and your valuable comments.

Well, the problem is that for example for a class 2 BondAngle Coeffs should be like this:

angle_coeff 1 ba 11.4210 20.7540 1.1010 1.5300

While if you look into the file created by write_coeff (line 193-195), we have:

angle_coeff 1 11.421 20.754 1.101 1.53

and similarly for BondBond, AngleAngle, AngleAngleTorsion, etc.

yes, i know. i’ve looked at the source code and seen, that this is a limitation of the code in write_coeffs. it basically (ab-)uses the code for writing out the coeffs section of a data file to a temporary hidden file, and then post-processes it into turn it into the final file (and deletes the intermediate file). for angle, dihedral, and improper, the coefficients are written out multiple times, since there are multiple force field components, but the parser in write_coeffs, doesn’t handle that case and needs to be updated to treat those three cases special. not too difficult to do…

axel.

Thank you very much.

And thank you again for the patch for msi2lmp.exe. I had inform you it worked, solving the topological problem of 3-atom rings! I think you need to update msi2lmp too.

Best Regards,

Abolfazl

Thank you very much.

And thank you again for the patch for msi2lmp.exe. I had inform you it worked, solving the topological problem of 3-atom rings! I think you need to update msi2lmp too.

have you checked out the version of msi2lmp included in version 15 November 2018 of LAMMPS?

axel.

Dear Axel,

I just checked the msi2lmp.exe included in version 15 November 2018. It works correctly!

Thank you so much for all the supports.

Best Regards.

Abolfazl

please find attached a patch, relative to the 15 November 2018 version of LAMMPS, that should address the write_coeff command issues with some class2 styles.

axel.

write_coeff_fix.diff.gz (1.08 KB)

Dear Axel,

Excellent!

I really appreciate your time and support.

Best Regards,

Abolfazl

FYI, we just posted a new patch release of LAMMPS on github https://github.com/lammps/lammps/releases/tag/patch_27Nov2018
that includes the write_coeff bugfix and other improvements.

axel.