### Syntax

`res = optmagk(obj,Name,Value)`

### Description

`res = optmagk(obj,Name,Value)`

determines the optimal propagation vector
using the Luttinger-Tisza method. It calculates the Fourier transform of
the Hamiltonian as a function of wave vector and finds the wave vector
that corresponds to the smalles global eigenvalue of the Hamiltonian. It
also returns the normal vector that corresponds to the rotating
coordinate system. The global optimization is achieved using
Particle-Swarm optimizer.

### Input Arguments

`obj`

- spinw object.

### Name-Value Pair Arguments

`kbase`

- Provides a set of vectors that span the space for possible propagation
vectors:
where the optimiser determines the values that correspond to the lowest ground state energy. is a matrix with dimensions , where . The basis vectors have to be linearly independent.

The function also accepts all options of ndbase.pso.

### Output Arguments

`res`

- Structure with the following fields:
`k`

Value of the optimal k-vector, with values between 0 and 1/2.`n`

Normal vector, defines the rotation axis of the rotating coordinate system.`E`

The most negative eigenvalue at the given propagation vector.`stat`

Full output of the ndbase.pso optimizer.