M04A Conjugate Gradient Method in MD++
Manual 04A for MD++
Conjugate Gradient Method in MD++
Keonwook Kang and Wei Cai
Conjugate Gradient Method
The conjugate gradient (CG) method was initially proposed as an iterative method to solve a large linear system, such as .[1] Later, Fletcher and Reeves[2] adopted it to solve nonlinear optimization problems. In MD++, the CG method is used to find a (local) minimum structure by minimizing a given (usu. nonlinear) potential energy function.
Algorithmically, the structure of the CG method is composed of two nested loops. The outer loop tries different search directions, which are A-orthogoanl to each other for a linear system A. The inner loop aims to find the optimal step length which minimizes the object function along a given search direction. When certain conditions are met, the program exits out of the loops and stops.
| . |
where and are the step length and the search direction at k-th iteration, respectively, and k is the index of the outer loop.
Implementation of the CG method in MD++
For more information, see supplementary document: Vacancy formation energy by MD++ .
We can run this script file by typing
$ bin/fs gpp scripts/movacancy.script
First, MD++ creates a 5×5×5 perfect cubic crystal of Mo with edges along <100> directions. Then it fixes atom 0 by
input = [ 1 # number of atoms to be fixed
0 ] # index of an atom to be fixed
fixatoms_by_ID
and then removs this atom by the command removefixedatoms. The first number in the input array specifies the number of atoms to be removed. For example, if you would like to remove two atoms, say 3 and 8, you can do so by
input = [ 2 # number of atoms to be fixed
3 8 ] # index of atoms to be fixed
fixatoms_by_ID # fix a set of atoms by their index
removefixedatoms # remove fixed atoms
Comparision of the CG method in MD++ and LAMMPS
| E_perf (eV) | E_defect (eV) | E_rlx (eV) | d_max | Iter. No. | No. of Calls | CPU time | |
|---|---|---|---|---|---|---|---|
| MD++ (zxcgr) | -1.00008000022397e+03 | -9.00066105589930e+02 | -9.04000245870123e+02 | 13 | 46 | ||
| MD++ (PR+) | 0.1 | -9.03999391688090e+02 | 13 | 46 | |||
| 0.01 | -9.04000164920736e+02 | 46 | 52 | ||||
| 0.001 | -9.03987772936424e+02 | 424 | 424 | ||||
| LAMMPS (Serial Run) | -1.00008000022397e+03 | -9.00066105589930e+02 | 0.1 | -9.03999391688090e+02 | 13 | 46 | 0.30734 |
| 0.01 | -9.04000164920732e+02 | 46 | 52 | 0.34946 | |||
| 0.001 | -9.03987772936424e+02 | 424 | 424 | 2.7843 |
in the Appendix.
