# Class `NEB`

NEB class

## Methods

 NEB:new (images[, k=5.[, climbing=5[, climbing_tol=0.005]]]) Instantiating a new NEB object. NEB:dR (img1, img2) Return the coordinate difference between two images NEB:tangent (image) Calculate the tangent of a given image NEB:climbing (image) Determine whether the queried image is climbing NEB:spring_force (image) Calculate the spring force of a given image NEB:perpendicular_force (image) Calculate the perpendicular force of a given image NEB:curvature (image) Calculate the curvature of the force with regards to the tangent NEB:neb_force (image) Calculate the resulting NEB force of a given image NEB:R (image) Query the current coordinates of an image NEB:force (image, IO) Query the current NEB force and optionally write out the current step information Calculates the NEB force for the current image and optionally store the current image information to the files. NEB:save (IO) Store the current step of the NEB iteration with the appropriate results Append to the file NEB.results the current NEB image step results. NEB:init_files () Initialize all files that will be written to NEB:info () Print to screen some information regarding the NEB algorithm

## Methods

NEB:new (images[, k=5.[, climbing=5[, climbing_tol=0.005]]])
Instantiating a new NEB object.

For the NEB object it is important to pass the images, and then all the NEB settings as named arguments in a table.

The NEB object implements a generic NEB algorithm as detailed in: 1. "Improved tangent estimate in the nudged elastic band method for finding minimum energy paths and saddle points", Henkelman & Jonsson, JCP (113), 2000 2. "A climbing image nudged elastic band method for finding saddle points and minimum energy paths", Henkelman, Uberuaga, & Jonsson, JCP (113), 2000

This particular implementation has been tested and initially developed by Jesper T. Rasmussen, DTU Nanotech, 2016.

When instantiating a new NEB calculator one must populate the initial, all intermediate images and a final image in a a table. The easiest way to do this can be seen in the below usage field.

To perform the NEB calculation all images (besides the initial and final) are relaxed by an external relaxation method (see Optimizer and its child classes). Due to the forces being highly non-linear as the NEB algorithm updates the forces depending on the nearest images, it is adviced to use an MD-like relaxation method such as FIRE. If one uses history based relaxation methods (LBFGS, CG, etc.) one should limit the number of history steps used.

Running the NEB class will create a huge list of files with corresponding output. Check the NEB:save function for details.

### Parameters:

• images table all images (starting with the initial, and ending with the final)
• k number or table spring constant between the images, a table can be used for individual spring constants (default 5.)
• climbing number after this number of iterations the climbing image will be taken into account (to disable climbing, pass `false`) (default 5)
• climbing_tol number the tolerance for determining whether an image is climbing or not (default 0.005)

### Usage:

```-- Read in the images
-- Note that `read_geom` must be a function that you define to read in the
-- atomic coordinates of a corresponding `.xyz` file.
images = {}
for i = 0, n_images + 1 do
images[#images+1] = flos.MDStep{R=read_geom(image_label .. i .. ".xyz")}
end
neb = NEB(images, {<field1 = value>, <field2 = value>})
relax = {}
for i = 1, neb.n_images do
relax[i] = flos.FIRE()
end
neb:set(F=<initial-forces>, E=<initial-E>)
neb[neb.n_images+1]:set(F=<final-forces>, E=<final-E>)
while true do
-- Calculate all forces and energies of each image
for i = 1, neb.n_images do
neb[i]:set(F=<forces>, E=<energy>)
end
-- Calculate new positions (this must be done after
-- the force calculations because the coordinates depend on the
-- neighbouring image forces)
R = {}
for i = 1, neb.n_images do
f = neb:force(i)
R[i] = relax:optimize(neb[i].R, neb:force(i))
end
for i = 1, neb.n_images do
neb:set(R=R[i])
end
end```
NEB:dR (img1, img2)
Return the coordinate difference between two images

### Parameters:

• img1 int the first image
• img2 int the second image

### Returns:

`NEB[img2].R - NEB[img1].R`
NEB:tangent (image)
Calculate the tangent of a given image

### Parameters:

• image int the image to calculate the tangent of

### Returns:

tangent force
NEB:climbing (image)
Determine whether the queried image is climbing

### Parameters:

• image int image queried

### Returns:

true if the image is climbing
NEB:spring_force (image)
Calculate the spring force of a given image

### Parameters:

• image int the image to calculate the spring force of

### Returns:

spring force
NEB:perpendicular_force (image)
Calculate the perpendicular force of a given image

### Parameters:

• image int the image to calculate the perpendicular force of

### Returns:

perpendicular force
NEB:curvature (image)
Calculate the curvature of the force with regards to the tangent

### Parameters:

• image int the image to calculate the curvature of

### Returns:

curvature
NEB:neb_force (image)
Calculate the resulting NEB force of a given image

### Parameters:

• image int the image to calculate the NEB force of

### Returns:

NEB force
NEB:R (image)
Query the current coordinates of an image

### Parameters:

• image int the image

### Returns:

coordinates
NEB:force (image, IO)
Query the current NEB force and optionally write out the current step information Calculates the NEB force for the current image and optionally store the current image information to the files.

The generated files are:

• `NEB.<image>.R` containing the relaxation steps of image `<image>`
• `NEB.<image>.F` containing the force of image `<image>`
• `NEB.<image>.F.P` containing the perpendicular force of image `<image>`
• `NEB.<image>.F.S` containing the spring force of image `<image>`
• `NEB.<image>.F.NEB` containing the NEB force of image `<image>` (equivalent to the returned force)
• `NEB.<image>.T` containing the tangent of image `<image>`
• `NEB.<image>.dR_prev` containing the reaction coordinate against the previous image
• `NEB.<image>.dR_next` containing the reaction coordinate against the next image

All files contains a consecutive list of the values for each iteration.

### Parameters:

• image int the image
• IO bool whether or not the current step should be stored

### Returns:

force
NEB:save (IO)
Store the current step of the NEB iteration with the appropriate results Append to the file NEB.results the current NEB image step results. The stored data consists of the following columns: 1. Image number 2. Accummulated reaction coordinate (the 1D-norm of `NEB:dR(i-1, i)`) 3. Total energy of current iteration 4. Total energy difference from initial image 5. Image curvature 6. Maximum NEB force exerted on any given atom.

### Parameters:

• IO bool whether or not the results should be written
NEB:init_files ()
Initialize all files that will be written to
NEB:info ()
Print to screen some information regarding the NEB algorithm
generated by LDoc 1.4.6 Last updated 2019-05-23 08:36:38