modified sw potential

Dear all,

I am try to use a modified sw potential proposed by Zhou [1,2] for MgO thin film. In this modified sw potential, the of costheta0 is not yet an constant -0.3333, which is ok for diamond structure. It is an angle dependent value now. In order to apply this, I modify the source file pair_sw.cpp in the following way.

Replacing lines 574 and 576, where
delcs = cs - paramijk->costheta;
delcssq = delcs*delcs;

if (cs>=-1 && cs<-0.75){
delcs = cs+1.0;
delcssq = delcs*delcs;
else if ((cs>=-0.75) && (cs<-0.25)){
delcs = -1*(cs + 0.5);
delcssq = -1delcsdelcs + 0.125;
} else {
delcs = cs;
delcssp = delcs*delcs;

However, when I test the modification by changing the costheta value in my potential file MgO.sw using 0, -0.3333, -1. The atomic structure changes correspondingly.

Since I am not familiar with C++. I am wondering if any one can suggest me how to incorporate such modified sw potential, where the costheta is angle dependent, and the cut off value of a for two body potential is different from that for three body. Really appreciate.

[1] X. W. Zhou, H. N. G. Wadley, Computational Materials Science 39, 541 (2007).
[2] X. W. Zhou, H. N. G. Wadley, Computational Materials Science 39, 340 (2007).


Aidan can likely advise.


I can't give you any specific advice on this. The code snippet that you
show seems close to the right answer, although the energy appears to be
dicontinuous at cs=-0.75. You might want to check your equations again.
Note that the variable costheta no longer appears, so changing it in the
MgO.sw file should have no effect. For the different cutoffs, use the
larger one in the input file and then for the smaller cutoff, modify the
corresponding line in PairSW::compute() from:

      if (rsq > params[ijparam].cutsq) continue;


      if (rsq > 3.1 or whatever) continue;


      Aidan P. Thompson
      01425 Advanced Device Technologies
      Sandia National Laboratories
      PO Box 5800, MS 1322 Phone: 505-844-9702
      Albuquerque, NM 87185 Fax : 505-845-7442
      E-mail:[email protected] Cell : 505-550-2614

Dear Aidan,

Thank you very much. I now understand the problem why the costheta0 value in the potential can still affect the result after I modified the pair_sw.cpp. It is because I run lammps in Windows. Therefore, the executable did not run the program with my modified pair_sw.cpp. I am wondering how can I incorporate the modified pair_sw.cpp into lammps to run it.


You have to be able to re-compile LAMMPS to do that.
Which you can't do with a downloaded executable. So you
need to grab the LAMMPS tarball, which has source code,
and build LAMMPS yourself with your new file.


Dear Steve,

Thank you very much. I am just curious about how to build the executable in windows.If cygwin installation is necessary for this. I would think built it in Ubuntu maybe is more convenient.


The manual has instructions on building for Windows. cygwin is identical
to Linux. Tools for a MS Visual Studio option is provided with
the distro and docuumented.


There are at least two ways to build your own LAMMPS Windows executable: 1) cygwin, and 2) Visual Studio.

Probably better to use Ubuntu since you’ve presumably got it on your machine, and you’re building your own executable.