# Optimization of matrix-element calculations

Registered by Nick Papior

Since 4.0r557, 4.1r846 and trunkr661 NRTAB has been increased from 128 to 1024 (current maximum).

Initial findings suggests that this improves many aspects of the calculations:
- Forces are more precise
- Phonon calculations are better at capturing symmetries, an initial H2 phonon calculation reproduces the symmetric phonons to 6th digit (only to 3nd digit in prior versions)
- Nearly all matrix elements *should* thus improve on their numerical values.

Alberto suggests to adaptively calculate the required number of tabulated data depending on each orbitals.
This could be implemented by having a local derived type for the tabulated data.

Not only should this adaptively increase precision, it will also allow longer range orbitals which is currently limited to around 14 Bohr. E.g. Bessel functions cannot extend further due to the reciprocal cut-off. Having these values adaptively calculated would easily accommodate these extended basis-orbitals.

## Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
Direction:
Needs approval
Assignee:
None
Definition:
Drafting
Series goal:
None
Implementation:
Unknown
Milestone target:
None

### Whiteboard

@Alberto, @Jose, if you think other people should be subscribed for comments, could you please let me know, then I will add them!

Jose writes:
A few notes that may help. The FT cutoffs and mesh intervals are related by kc=pi/dr, rc=pi/dk, n=rc/dr=kc*rc/pi. The matrix elements of the kinetic energy involve products of FTs of two orbitals, times k^2. So the error in the kinetic energy is, in Ry, DEk=int_kc^inf(dk*k^4*psi(k)^2)/int_0^inf(dk*k^2*psi(k)^2).
We could aim at, say rc=20Bohr and DEk<1.e-6Ry to find kc for each orbital, then set n to the maximum.

(?)

### Work Items

This blueprint contains Public information
Everyone can see this information.