## Averaging method
_baptiste Auguié -- `r format(Sys.time(), "%d %B, %Y")`_

```{r demo, message=FALSE, echo=FALSE}
knitr::read_demo("averaging_method", package="cda")
knitr::read_chunk("load.R")
```
```{r load, message=FALSE, echo=FALSE}
```
```{r setup, message=FALSE, echo=FALSE}
```

Three options are provided for angular averaging: Gauss-Legendre quadrature, regular grid in (theta, phi), and a quasi-random Monte Carlo sequence on the sphere. Here we compare their performance and accuracy.

### Cluster definitions
```{r cluster, tidy=FALSE, fig.path='averaging-'}
```

### Comparison
```{r comparison, tidy=FALSE, fig.path='averaging-'}
```
The dashed line is a "cheap" version of angular averaging, using only 4 orthogonal directions; it is reasonably close to the converged solution (solid line). QMC seems to perform best in terms of convergence, however, GL may appear more reliable when taking into account symmetry considerations: if a dimer is achiral, the CD signal should be zero. Because QMC uses uneven points on the sphere, it has a harder time at converging towards 0 in such cases. 

```{r achiral, tidy=FALSE, fig.path='averaging-'}
```

