# Manual:Linear Response

There are two ways of calculating polarizabilities in Octopus. The first one is to use Linear Response (TD)DFT and the second one is just doing finite differences, this was the first implemented but is slower and more limited and is only recomendend for comparison and testing.

For both cases, you need to do a ground state calculation first.

#### Linear Response

In this method the derivative of the energy is calculated analytically through Density Functional Perturbation Theory.

###### Ground state

To do a polarizability calculation you need a gs calculation for the system with very well converged wave functions, the following convergency parameters are recommended:

EigenSolverFinalTolerance = 1e-10 ConvAbsDens = 0 ConvRelDens = 0 ConvAbsEv = 1e-10 ConvRelEv = 0

##### Polarizability

After that you can calculate the hyperpolarizabity using *RunMode = pol_lr*. This will run a self consistent iteration for each dimension, each one takes about 10-20 steps and the calculation time is about the same for the ground state. The results will be in the *linear/* directory in two files:

- The
*polarizability_lr*file contains the static polarizability given as a matrix and the mean static polarizablity

- The
*beta_lr*file which contains the first static hyperpolarizability given by components (as the tensor is symmetrical there are only 10 independent components). Finally there are the 3 values defined as

#### Finite differences

In this mode only static polarizability can be obtained, the calculation is done by taking the numerical derivative of the energy with respect to an external static and uniform electric field. To use this run with `CalculationMode`

`=pol_fd`

. Octopus will run several ground state energy calculations (2 per dimension) and then calculate the polarizability using a finite differences formula for the derivative, the resulting tensor will be in the *linear/polarizability_fd* file.