PT2 stoch OK

This commit is contained in:
Anthony Scemama 2020-12-11 01:34:51 +01:00
commit 17d9d8b2b7
23 changed files with 841 additions and 0 deletions

BIN
Comb1.pdf Normal file

Binary file not shown.

BIN
Comb2.pdf Normal file

Binary file not shown.

BIN
Comb3.pdf Normal file

Binary file not shown.

389
algorithms.org Normal file
View File

@ -0,0 +1,389 @@
#+TITLE: Important algorithms for CIPSI
#+DATE: 14/12/2020
#+AUTHOR: Anthony Scemama
#+startup: beamer
#+LaTeX_HEADER: \institute{Laboratoire de Chimie et Physique Quantiques, IRSAMC, UPS/CNRS, Toulouse}
#+LATEX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS:[aspectratio=169]
#+BEAMER_THEME: pterosor
#+LaTeX_HEADER: \usepackage{minted}
#+LaTeX_HEADER: \usepackage[utf8]{inputenc}
#+LaTeX_HEADER: \usepackage[T1]{fontenc}
#+LaTeX_HEADER: \usepackage{hyperref}
#+LaTeX_HEADER: \usepackage{mathtools}
#+LaTeX_HEADER: \usepackage{physics}
#+LaTeX_HEADER: \definecolor{darkgreen}{rgb}{0.,0.6,0.}
#+LaTeX_HEADER: \definecolor{darkblue}{rgb}{0.,0.2,0.7}
#+LaTeX_HEADER: \definecolor{darkred}{rgb}{0.6,0.1,0.1}
#+LaTeX_HEADER: \definecolor{darkpink}{rgb}{0.7,0.0,0.7}
#+EXPORT_EXCLUDE_TAGS: noexport
#+OPTIONS: H:2 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+LATEX: \newcommand{\mcenter}[1]{\multicolumn{1}{c}{#1}}
#+LATEX: \newcommand{\Ndet}{{\textcolor{darkgreen}{N_\text{det}}}}
#+LATEX: \newcommand{\Evar}{\textcolor{darkgreen}{E_\text{var}}}
#+LATEX: \newcommand{\Ept}{\textcolor{red}{E_\text{PT2}}}
#+LATEX: \newcommand{\de}{\textcolor{red}{\delta E(\alpha)}}
#+LATEX: \newcommand{\mH}{\mathcal{H}}
#+LATEX: \newcommand{\mDup}{{\textcolor{orange}{D_k^\uparrow}}}
#+LATEX: \newcommand{\mDupp}{{\textcolor{orange}{D_{k'}^\uparrow}}}
#+LATEX: \newcommand{\mDdn}{{\textcolor{orange}{D_m^\downarrow}}}
#+LATEX: \newcommand{\mDdnn}{{\textcolor{orange}{D_{m'}^\downarrow}}}
#+LATEX: \newcommand{\Ndetup}{{\textcolor{orange}{N_\text{det}^\uparrow}}}
#+LATEX: \newcommand{\Ndetdn}{{\textcolor{orange}{N_\text{det}^\downarrow}}}
#+LATEX: \newcommand{\mD}{{\textcolor{darkgreen}{\mathcal{D}}}}
#+LATEX: \newcommand{\mPsi}{{\textcolor{darkgreen}{\Psi}}}
#+LATEX: \newcommand{\mA}{\textcolor{red}{\mathcal{A}}}
#+LATEX: \newcommand{\ma}{{\textcolor{red}{\alpha}} }
#+LATEX: \newcommand{\mi}{{\textcolor{darkgreen}{I}} }
#+LATEX: \newcommand{\mpi}{{\textcolor{darkgreen}{p_I}} }
#+LATEX: \newcommand{\mci}{{\textcolor{darkgreen}{c_I}} }
#+LATEX: \newcommand{\mcj}{{\textcolor{darkgreen}{c_J}} }
#+LATEX: \newcommand{\epsi}{{\textcolor{darkgreen}{\epsilon}_\mi} }
#+LATEX: \newcommand{\mj}{{\textcolor{darkgreen}{J}} }
#+LATEX: \newcommand{\nea}{{N_\text{elec}^\uparrow}}
#+LATEX: \newcommand{\neb}{{N_\text{elec}^\downarrow}}
#+LATEX: \newcommand{\nmo}{{N_\text{MO}}}
#+LATEX: \newcommand{\Nsamples}{N_\text{samples}}
#+LATEX: \newcommand{\uniqueness}{{\textcolor{blue}{uniqueness}} }
#+LATEX: \newcommand{\mk}{{\textcolor{blue}{k}} }
#+LATEX: \newcommand{\mM}{{\textcolor{blue}{M}} }
#+LATEX: \newcommand{\epsik}{{\textcolor{darkgreen}{\epsilon_{I_{\textcolor{blue}{k}}}} }}
* Stochastic evaluation of the PT2 correction
** Epstein-Nesbet Second order correction
Consider a wave function $\mPsi$ expanded on an /arbitrary/ set $\mD$
of $\Ndet$ orthonormal Slater determinants,
\[
\mPsi = \sum_{\mi \in \mD} {\mci} | \mi \rangle, \;\;\;
\Evar = \frac{ \langle \mPsi | \mH | \mPsi \rangle}{\langle \mPsi | \mPsi \rangle}
\]
The Epstein-Nesbet 2nd order correction to the energy is
\[
\Ept = \sum_{\ma \in \mA} \frac{ \langle \mPsi | \mH | \ma \rangle
\langle \ma | \mH | \mPsi \rangle}{\Evar - \langle \ma | \mH | \ma \rangle }
\]
The set $\mA$ contains the Slater determinants
- that are not in $\mD$
- for which $d(\mi,\ma) = 1$ or $2$ for at least one pair $(\mi,\ma)$
** Formal scaling
\[
\Ept = \sum_{\ma \in \mA} \frac{ \langle \mPsi | \mH | \ma \rangle
\langle \ma | \mH | \mPsi \rangle}{\Evar - \langle \ma | \mH | \ma
\rangle} = \sum_{\ma \in \mA} \frac{ \left( \sum_{\mi \in \mD} \mci
\langle \mi | \mH | \ma \rangle \right)^2 }{\Evar - \langle \ma |
\mH | \ma \rangle }
\]
- Size of $\mA$ : size of $(\hat{T}_1 + \hat{T}_2)|\mPsi\rangle$
- Number of non-zero terms : $d(\mi,\ma) \le 2 \sim \Ndet \times
\left[ \textcolor{darkgreen}{\left( \nea \times (\nmo - \nea) \right)^2 }\right]$
- *Expensive*
** Solutions to make simulations possible
*** "Non-general'' but /conventional/ solutions:
- Partition the MO space into different classes (active, virtual, inactive, \emph{etc})
- Use another zeroth-order Hamiltonian (CAS-PT2, NEV-PT2)
*** Solutions applicable to /any/ wave function:
- Truncation of $\mD$ to consider only contributions due to large
${\mci}$ \\
But: Truncation $\longrightarrow$ bias because $\Ept$ is a sum of
same-sign values (negative).
- Monte Carlo sampling in $\mA$. \\
But: Statistical error decreases as
$\mathcal{O}\left(1/\sqrt{\Nsamples}\right) \Longrightarrow$
Difficult to get $\textcolor{darkgreen}{10^{-5} a.u}$ precision.
- Parallelism
*** :B_ignoreheading:
:PROPERTIES:
:BEAMER_env: ignoreheading
:END:
** Central idea
#+LATEX: \begin{columns}
#+LATEX: \begin{column}{0.5\textwidth}
- Choose an arbitrary ordering of $|\mi \rangle$. Natural choice:
\[w_\mi = \frac{\mci ^2}{\langle \mPsi | \mPsi \rangle } \]
- Make \emph{disjoint} groups $\mA_{\mi}$ of $| \ma \rangle$ originating from the same generator $| \mi \rangle$
- Each $\mA_\mi$ has its own contribution $\epsi$ to $\Ept$
#+LATEX: \end{column}
#+LATEX: \begin{column}{0.5\textwidth}
#+ATTR_LATEX: :width 0.9\columnwidth
[[./fig1.pdf]]
#+LATEX: \end{column}
#+LATEX: \end{columns}
** Central idea
\begin{eqnarray*}
\Ept &=& \sum_{\ma \in \mA} \frac{ \left( \langle \mPsi | \mH | \ma \rangle
\right)^2 }{\Evar - \langle \ma | \mH | \ma \rangle } \\ &=& \sum_{\mi \in \mD}
\sum_{\ma_\mi \in \mA_\mi} \frac{ \left( \langle \mPsi | \mH | \ma_\mi \rangle
\right)^2}{\Evar - \langle \ma_\mi | \mH | \ma_\mi \rangle} \\
&=& \sum_{\mi \in \mD} \epsi
\end{eqnarray*}
*** Contribution per /internal/ determinant
\[
\epsi = \sum_{\ma_\mi \in \mA_\mi} \frac{ \left( \langle \mPsi | \mH | \ma_\mi
\rangle \right)^2}{\Evar - \langle \ma_\mi | \mH | \ma_\mi \rangle}
\]
** Consequences
\[
\epsi = \sum_{\ma_\mi \in \mA_\mi} \frac{ \left( \langle \mPsi | \mH | \ma_\mi
\rangle \right)^2}{\Evar - \langle \ma_\mi | \mH | \ma_\mi \rangle}
\]
1. $\langle \mPsi | \mH | \ma_\mi \rangle = \sum_{\mj \ge \mi} \mcj\, \langle\, \mj | \mH | \ma_\mi \rangle$
2. $\langle \ma_\mi | \mH | \ma_\mi \rangle$ is always large
(otherwise $|\ma_\mi \rangle$ would be better in the
\textcolor{red}{variational space}, and PT is questionable)
*** :B_ignoreheading:
:PROPERTIES:
:BEAMER_env: ignoreheading
:END:
- $\forall \mi \in \mD : \epsi \le 0$
- $|\epsi|$ is expected to decrease as $\mci^2$
- The computational cost decreases with $\mi$
*** Monte Carlo formulation
\[
\Ept = \sum_{\mi \in \mD} \epsi = \sum_{\mi \in \mD} \mpi \frac{\epsi}{\mpi} =
\left\langle \frac{\epsi}{\mpi} \right\rangle_{\mpi}
\]
** Naive sampling
#+LATEX: \begin{columns}
#+LATEX: \begin{column}{0.2\textwidth}
Uniform sampling:
\mpi = \frac{1}{\Ndet}$
#+LATEX: \end{column}
#+LATEX: \begin{column}{0.8\textwidth}
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./dist2_noise.png]]
#+LATEX: \end{column}
#+LATEX: \end{columns}
** Improved sampling
#+LATEX: \begin{columns}
#+LATEX: \begin{column}{0.2\textwidth}
Sampling : $\mpi = \mci^2$
#+LATEX: \end{column}
#+LATEX: \begin{column}{0.8\textwidth}
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./eici2.png]]
#+LATEX: \end{column}
#+LATEX: \end{columns}
** Lazy evaluation
Only $\Ndet$ contributions $\epsi \longrightarrow$ all $\epsi$ can be stored in memory.
*** Lazy Evaluation (Wikipedia)
In programming language theory, /lazy evaluation/, or /call-by-need/ is
an evaluation strategy which delays the evaluation of an expression until its
value is needed (non-strict evaluation) and which also avoids repeated
evaluations (sharing).
*** :B_ignoreheading:
:PROPERTIES:
:BEAMER_env: ignoreheading
:END:
#+BEGIN_SRC python
def lazy_e(i):
if not e_is_computed[i]:
e[i] = compute_e(i)
e_is_computed[i] = true
return e[i]
#+END_SRC
** Monte Carlo with Lazy Evaluation
\[
\Ept = \sum_{\mi \in \mD} \epsi = \sum_{\mi \in \mD} \mpi \frac{\epsi}{\mpi} =
\left\langle \frac{\epsi}{\mpi} \right\rangle_{\mpi}
\]
- Draw a generator determinant $|\mi\,\rangle$ with probability $\mpi$
- Increment $n_\mi$, the number of evaluations of $\epsi$
- If $\epsi$ is not already computed, compute it and store its value
- $\Ept \sim \sum_{\mi \in \mD} \frac{n_\mi}{\Nsamples} \frac{\epsi}{\mpi}$
- Statistical error : $\mathcal{O}\left(1/\sqrt{\Nsamples}\right)$
- Lazy evaluation : Exponential acceleration (time to solution)
** Monte Carlo with Lazy Evaluation
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./samples.pdf]]
** Monte Carlo with Lazy Evaluation
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./lazy_e.pdf]]
** Monte Carlo with Lazy Evaluation
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./lazy_err.pdf]]
** Monte Carlo with Variance reduction
- Noise can be smoothed out by averaging
- Split $\mD$ into $\mM$ \emph{equiprobable} sets : "Comb"
\[
\Ept = \sum_{\mi \in \mD} \epsi = \sum_{\mk=1}^{\mM} \sum_{\mi_\mk \in \mD_\mk} \epsik
\]
*** New Monte Carlo estimator
\[
\Ept = \left \langle
\frac{1}{\mM} \sum_{\mk=1}^{\mM} \frac{\epsik}{{\textcolor{red}{p_{I_k}}}}
\right \rangle_{\textcolor{red}{(p_{I_1}, \dots, p_{I_M})}}
\]
** Monte Carlo with Variance reduction
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./Comb1.pdf]]
** Monte Carlo with Variance reduction
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./Comb2.pdf]]
** Monte Carlo with Variance reduction
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./Comb3.pdf]]
** Monte Carlo with Variance reduction
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./dist2.png]]
** Monte Carlo with Variance reduction
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./lazy_e.pdf]]
** Monte Carlo with Variance reduction
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./comb_e.pdf]]
** Monte Carlo with Variance reduction
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./comb_err.pdf]]
** Hybrid deterministic/stochastic scheme
- When all the determinants have been drawn, the \emph{exact} $\Ept$ can be computed
- $\Longrightarrow$ The result with zero statistical error can be reached
in a finite time
- In typical wave functions, $90\%$ of the norm is on a few determinants
- Compute the few first contributions $\epsi$, and perform the MC in the rest
\[
\Ept = \sum_{\mi \in \mD_D} \epsi + \left \langle
\frac{1}{\mM} \sum_{\mk=1}^{\mM} \frac{\epsik}{\textcolor{red}{p_{I_k}}}
\right \rangle_{(\textcolor{red}{p_{I \in \mD_S})}}
\]
** Hybrid deterministic/stochastic scheme
Make the deterministic part grow during the calculation.
*** At each MC step
- Draw a random number
- Find the determinants selected by the comb (increment $n_\mi$'s)
- Compute the $\epsi$ which have not been yet computed
- Compute deterministically the first non-computed determinant
- If a tooth of the comb is completely filled $\Longrightarrow$ Deterministic
*** At any time
\[
\Ept(t) = \sum_{\mi \in \mD_D(t)} \epsi + \sum_{\mi \in \mD_S(t)} \frac{1}{\mM(t)}
\frac{n_\mi(t)}{\Nsamples(t)} \frac{\epsi}{\mpi}
\]
** Hybrid deterministic/stochastic scheme
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./lazy_e.pdf]]
** Hybrid deterministic/stochastic scheme
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./comb_e.pdf]]
** Hybrid deterministic/stochastic scheme
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./hybrid_e.pdf]]
** Hybrid deterministic/stochastic scheme
#+CAPTION: F$_2$, cc-pVDZ, \textcolor{red}{$10^6$} determinants in the variational space
#+ATTR_LATEX: :height 0.75\textheight
[[./hybrid_err.pdf]]
** Some timings: Cr$_2$, $2\,10^7$ determinants, 800 cores
|---------+-------------------------------------+--------------------------|
| Basis | $\Ept$ | Wall-clock time |
|---------+-------------------------------------+--------------------------|
| cc-pVDZ | \textcolor{red}{$-0.068\,3(1)$} | 14 min |
| | \textcolor{red}{$-0.068\,36(1)$} | 55 min |
| | \textcolor{red}{$-0.068\,361(1)$} | 2.4 hr |
| | \textcolor{red}{$-0.068\,360\,604$} | 3 hr |
|---------+-------------------------------------+--------------------------|
| cc-pVTZ | \textcolor{red}{$-0.124\,4(5)$} | 19 min |
| | \textcolor{red}{$-0.124\,7(1)$} | 58 min |
| | \textcolor{red}{$-0.124\,63(1)$} | 3.5 hr |
| | \textcolor{red}{$-0.124\,642(1)$} | 8.7 hr |
| | --- | $\sim$ 15 hr (estimated) |
|---------+-------------------------------------+--------------------------|
| cc-pVQZ | \textcolor{red}{$-0.155\,8(5)$} | 56 min |
| | \textcolor{red}{$-0.155\,9(1)$} | 2.5 hr |
| | \textcolor{red}{$-0.155\,95(1)$} | 9.0 hr |
| | \textcolor{red}{$-0.155\,952(1)$} | 18.5 hr |
| | --- | $\sim$ 29 hr (estimated) |
|---------+-------------------------------------+--------------------------|
** Parallel efficiency
#+ATTR_LATEX: :height 0.8\textheight
[[./speedup_pt2.png]]
* Efficient direct CI
* Export :noexport:
#+BEGIN_SRC elisp :output none
(setq org-latex-listings 'minted
org-latex-packages-alist '(("" "minted"))
org-latex-pdf-process
'("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
(setq org-latex-minted-options '(("breaklines" "true")
("breakanywhere" "true")))
(setq org-latex-minted-options
'(("frame" "lines")
("fontsize" "\\scriptsize")
("linenos" "")))
(org-beamer-export-to-pdf)
#+END_SRC
#+RESULTS:
: /home/scemama/TEX/Nuclearistes/algorithms.pdf

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

View File

@ -0,0 +1,33 @@
\mode<presentation>
% Settings
\definecolor{myBlue}{RGB}{97,148,201}
\definecolor{myDarkBlue}{RGB}{73,110,150}
\definecolor{myPink}{RGB}{200,149,147}
\definecolor{myRed}{RGB}{206,51,45}
\setbeamercolor*{title page header}{fg=myRed}
\setbeamercolor*{author}{fg=myDarkBlue}
\setbeamercolor*{institute}{fg=myDarkBlue}
\setbeamercolor*{date}{fg=myBlue}
\setbeamercolor*{item}{fg=myBlue}
\setbeamertemplate{items}[triangle]
\setbeamertemplate{sections/subsections in toc}[square]
\setbeamercolor*{section title}{fg=myBlue}
\setbeamercolor*{subsection title}{fg=myBlue}
\setbeamercolor{block title}{fg=white,bg=myBlue}
%\setbeamercolor{block body}{bg=block title.bg!30!bg}
% alertblock
\setbeamercolor{block title alerted}{fg=white,bg=MyPink}
%\setbeamercolor{block body alerted}{bg=block title alerted.bg!10!bg}
% exampleblock
\setbeamercolor{block title example}{fg=myBlue}
%\setbeamercolor{block body example}{bg=white}
\mode
<all>

317
beamerfontthemepterosor.sty Normal file
View File

@ -0,0 +1,317 @@
%%
%% This is file `beamerfontthemepterosor.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% beamerfontthemepterosor.dtx (with options: `package')
%% ---------------------------------------------------------------------------
%% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of
%% contributors can be found at
%%
%% https://github.com/matze/mtheme/graphs/contributors
%%
%% and the original template was based on the HSRM theme by Benjamin Weiss.
%%
%% This work is licensed under a Creative Commons Attribution-ShareAlike 4.0
%% International License (https://creativecommons.org/licenses/by-sa/4.0/).
%% ---------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerfontthemepterosor}[2020/12/10 pterosor font theme]
\RequirePackage{etoolbox}
\RequirePackage{ifxetex}
\RequirePackage{ifluatex}
\RequirePackage{pgfopts}
%\RequirePackage{mathpazo}
\RequirePackage{libertine}
\ifboolexpr{bool {xetex} or bool {luatex}}{
\@ifpackageloaded{fontspec}{
\PassOptionsToPackage{no-math}{fontspec}
}{
\RequirePackage[no-math]{fontspec}
}
\newcounter{fontsnotfound}
\newcommand{\checkfont}[1]{%
\suppressfontnotfounderror=1%
\font\x = "#1" at 10pt
\selectfont
\ifx\x\nullfont%
\stepcounter{fontsnotfound}%
\fi%
\suppressfontnotfounderror=0%
}
\newcommand{\iffontsavailable}[3]{%
\setcounter{fontsnotfound}{0}%
\expandafter\forcsvlist\expandafter%
\checkfont\expandafter{#1}%
\ifnum\value{fontsnotfound}=0%
#2%
\else%
#3%
\fi%
}
\iffontsavailable{Fira Sans Light,%
Fira Sans Light Italic,%
Fira Sans,%
Fira Sans Italic}%
{%
\setsansfont[ItalicFont={Fira Sans Light Italic},%
BoldFont={Fira Sans},%
BoldItalicFont={Fira Sans Italic}]%
{Fira Sans Light}%
}{%
\iffontsavailable{Fira Sans Light OT,%
Fira Sans Light Italic OT,%
Fira Sans OT,%
Fira Sans Italic OT}%
{%
\setsansfont[ItalicFont={Fira Sans Light Italic OT},%
BoldFont={Fira Sans OT},%
BoldItalicFont={Fira Sans Italic OT}]%
{Fira Sans Light OT}%
}{%
\PackageWarning{beamerthemepterosor}{%
Could not find Fira Sans fonts%
}
}
}
\iffontsavailable{Fira Mono, Fira Mono Bold}{%
\setmonofont[BoldFont={Fira Mono Medium}]{Fira Mono}%
}{%
\iffontsavailable{Fira Mono OT, Fira Mono Bold OT}{%
\setmonofont[BoldFont={Fira Mono Medium OT}]{Fira Mono OT}%
}{%
\PackageWarning{beamerthemepterosor}{%
Could not find Fira Mono fonts%
}
}
}
\AtBeginEnvironment{tabular}{%
\addfontfeature{Numbers={Monospaced}}%
}
}{%
\PackageWarning{beamerthemepterosor}{%
You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts%
}
}
\setbeamerfont{title}{size=\Large,%
series=\bfseries}
\setbeamerfont{author}{size=\small}
\setbeamerfont{date}{size=\small}
\setbeamerfont{section title}{size=\Large,%
series=\bfseries}
\setbeamerfont{block title}{size=\normalsize,%
series=\bfseries}
\setbeamerfont{block title alerted}{size=\normalsize,%
series=\bfseries}
\setbeamerfont*{subtitle}{size=\large}
\setbeamerfont{frametitle}{size=\large,%
series=\bfseries}
\setbeamerfont{caption}{size=\small}
\setbeamerfont{caption name}{series=\bfseries}
\setbeamerfont{description item}{series=\bfseries}
\setbeamerfont{page number in head/foot}{size=\scriptsize}
\setbeamerfont{bibliography entry author}{size=\normalsize,%
series=\normalfont}
\setbeamerfont{bibliography entry title}{size=\normalsize,%
series=\bfseries}
\setbeamerfont{bibliography entry location}{size=\normalsize,%
series=\normalfont}
\setbeamerfont{bibliography entry note}{size=\small,%
series=\normalfont}
\setbeamerfont{standout}{size=\Large,%
series=\bfseries}
\pgfkeys{
/pterosor/font/titleformat title/.cd,
.is choice,
regular/.code={%
\let\pterosor@titleformat\@empty%
\setbeamerfont{title}{shape=\normalfont}%
},
smallcaps/.code={%
\let\pterosor@titleformat\@empty%
\setbeamerfont{title}{shape=\scshape}%
},
allsmallcaps/.code={%
\let\pterosor@titleformat\lowercase%
\setbeamerfont{title}{shape=\scshape}%
\PackageWarning{beamerthemepterosor}{%
Be aware that titleformat title=allsmallcaps can lead to problems%
}
},
allcaps/.code={%
\let\pterosor@titleformat\uppercase%
\setbeamerfont{title}{shape=\normalfont}
\PackageWarning{beamerthemepterosor}{%
Be aware that titleformat title=allcaps can lead to problems%
}
},
}
\pgfkeys{
/pterosor/font/titleformat subtitle/.cd,
.is choice,
regular/.code={%
\let\pterosor@subtitleformat\@empty%
\setbeamerfont{subtitle}{shape=\normalfont}%
},
smallcaps/.code={%
\let\pterosor@subtitleformat\@empty%
\setbeamerfont{subtitle}{shape=\scshape}%
},
allsmallcaps/.code={%
\let\pterosor@subtitleformat\lowercase%
\setbeamerfont{subtitle}{shape=\scshape}%
\PackageWarning{beamerthemepterosor}{%
Be aware that titleformat subtitle=allsmallcaps can lead to problems%
}
},
allcaps/.code={%
\let\pterosor@subtitleformat\uppercase%
\setbeamerfont{subtitle}{shape=\normalfont}%
\PackageWarning{beamerthemepterosor}{%
Be aware that titleformat subtitle=allcaps can lead to problems%
}
},
}
\pgfkeys{
/pterosor/font/titleformat section/.cd,
.is choice,
regular/.code={%
\let\pterosor@sectiontitleformat\@empty%
\setbeamerfont{section title}{shape=\normalfont}%
},
smallcaps/.code={%
\let\pterosor@sectiontitleformat\@empty%
\setbeamerfont{section title}{shape=\scshape}%
},
allsmallcaps/.code={%
\let\pterosor@sectiontitleformat\MakeLowercase%
\setbeamerfont{section title}{shape=\scshape}%
\PackageWarning{beamerthemepterosor}{%
Be aware that titleformat section=allsmallcaps can lead to problems%
}
},
allcaps/.code={%
\let\pterosor@sectiontitleformat\MakeUppercase%
\setbeamerfont{section title}{shape=\normalfont}%
\PackageWarning{beamerthemepterosor}{%
Be aware that titleformat section=allcaps can lead to problems%
}
},
}
\pgfkeys{
/pterosor/font/titleformat frame/.cd,
.is choice,
regular/.code={%
\let\pterosor@frametitleformat\@empty%
\setbeamerfont{frametitle}{shape=\normalfont}%
},
smallcaps/.code={%
\let\pterosor@frametitleformat\@empty%
\setbeamerfont{frametitle}{shape=\scshape}%
},
allsmallcaps/.code={%
\let\pterosor@frametitleformat\MakeLowercase%
\setbeamerfont{frametitle}{shape=\scshape}%
\PackageWarning{beamerthemepterosor}{%
Be aware that titleformat frame=allsmallcaps can lead to problems%
}
},
allcaps/.code={%
\let\pterosor@frametitleformat\MakeUppercase%
\setbeamerfont{frametitle}{shape=\normalfont}
\PackageWarning{beamerthemepterosor}{%
Be aware that titleformat frame=allcaps can lead to problems%
}
},
}
\pgfkeys{
/pterosor/font/.cd,
titleformattitle/.code=\pgfkeysalso{titleformat title=#1},
titleformatsubtitle/.code=\pgfkeysalso{titleformat subtitle=#1},
titleformatsection/.code=\pgfkeysalso{titleformat section=#1},
titleformatframe/.code=\pgfkeysalso{titleformat frame=#1},
}
\newcommand{\pterosor@font@setdefaults}{
\pgfkeys{/pterosor/font/.cd,
titleformat title=regular,
titleformat subtitle=regular,
titleformat section=regular,
titleformat frame=regular,
}
}
\def\pterosor@titleformat#1{#1}
\def\pterosor@subtitleformat#1{#1}
\def\pterosor@sectiontitleformat#1{#1}
\def\pterosor@frametitleformat#1{#1}
\patchcmd{\beamer@title}%
{\def\inserttitle{#2}}%
{\def\inserttitle{\pterosor@titleformat{#2}}}%
{}%
{\PackageError{beamerfontthemepterosor}{Patching title failed}\@ehc}
\patchcmd{\beamer@subtitle}%
{\def\insertsubtitle{#2}}%
{\def\insertsubtitle{\pterosor@subtitleformat{#2}}}%
{}%
{\PackageError{beamerfontthemepterosor}{Patching subtitle failed}\@ehc}
\patchcmd{\sectionentry}
{\def\insertsectionhead{#2}}
{\def\insertsectionhead{\pterosor@sectiontitleformat{#2}}}
{}
{\PackageError{beamerfontthemepterosor}{Patching section title failed}\@ehc}
\@tempswafalse
\patchcmd{\beamer@section}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{%
\pterosor@sectiontitleformat{#1}}}}
{\@tempswatrue}
{}
\patchcmd{\beamer@section}
{\protected@edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{#1}}}
{\protected@edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{%
\noexpand\pterosor@sectiontitleformat{#1}}}}
{\@tempswatrue}
{}
\if@tempswa\else
\PackageError{beamerfontthemepterosor}{Patching section title failed}\@ehc
\fi
\@tempswafalse
\patchcmd{\beamer@subsection}
{\def\insertsubsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
{\def\insertsubsectionhead{\hyperlink{Navigation\the\c@page}{%
\pterosor@sectiontitleformat{#1}}}}
{\@tempswatrue}
{}
\patchcmd{\beamer@subsection}
{\protected@edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{#1}}}
{\protected@edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{%
\noexpand\pterosor@sectiontitleformat{#1}}}}
{\@tempswatrue}
{}
\if@tempswa\else
\PackageError{beamerfontthemepterosor}{Patching section title failed}\@ehc
\fi
\patchcmd{\beamer@@frametitle}
{{%
\gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}\space%
\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}}
{{%
\gdef\insertframetitle{{\pterosor@frametitleformat{#2}\ifnum%
\beamer@autobreakcount>0\relax{}\space%
\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}}
{}
{\PackageError{beamerfontthemepterosor}{Patching frame title failed}\@ehc}
\pterosor@font@setdefaults
\ProcessPgfPackageOptions{/pterosor/font}
\endinput
%%
%% End of file `beamerfontthemepterosor.sty'.

View File

@ -0,0 +1,53 @@
\mode<presentation>
\setbeamertemplate{background}{
\ifnum\thepage>1
\includegraphics[height=\paperheight]{beamerbackgroundpterosor.png}
\else
\includegraphics[height=\paperheight]{beamertitlepterosor.png}
\fi
}
% Title page
\defbeamertemplate*{title page}{pterosor}[1][]
{
\vskip3cm%
\begin{beamercolorbox}[wd=6.cm,leftskip=-0.5cm,#1]{title page header}
\usebeamerfont{title}\inserttitle\par%
\end{beamercolorbox}%
\vskip0.2cm%
\begin{beamercolorbox}[wd=6.cm,leftskip=-0.5cm,#1]{author}
\usebeamerfont{author}\insertauthor%
\end{beamercolorbox}
\vskip0.3cm%
\begin{beamercolorbox}[wd=6.cm,leftskip=-0.5cm,#1]{date}
\usebeamerfont{author}\insertdate%
\end{beamercolorbox}
\vskip0.3cm%
\begin{beamercolorbox}[wd=7.cm,leftskip=-0.5cm,#1]{institute}
\usebeamerfont{author}{\tiny \insertinstitute}%
\end{beamercolorbox}
\vfill
}
% Section page
\defbeamertemplate*{section page}{pterosor}{
\centering
\begin{minipage}{22em}
\raggedright
\usebeamercolor[fg]{section title}
\usebeamerfont{section title}
\insertsectionhead\\[-1ex]
\par
\ifx\insertsubsectionhead\@empty\else%
\usebeamercolor[fg]{subsection title}%
\usebeamerfont{subsection title}%
\insertsubsectionhead
\fi
\end{minipage}
\par
\vspace{\baselineskip}
}
\mode<all>

View File

@ -0,0 +1,20 @@
\mode<presentation>
% Frame title
\defbeamertemplate*{frametitle}{pterosor}[1][]
{
\begin{beamercolorbox}[wd=\paperwidth,ht=0.95cm]{frametitle}
\begin{tikzpicture}
% \useasboundingbox[fill=white](0,0) rectangle(\the\paperwidth,1.);
%\fill[red!80!black] (0,0) rectangle(2.95,1.);
%\fill[blue!50!cyan!80!black] (3.05,0) rectangle(\the\paperwidth,1.);
%\fill[white!50] (3.05,0) rectangle(\the\paperwidth,1.);
\useasboundingbox[](0,0) rectangle(\the\paperwidth,1.);
\node[anchor=east, white,font=\large] at
(\paperwidth,0.25){\insertframetitle \phantom{m}};
\end{tikzpicture}
\end{beamercolorbox}
}
\mode<all>

29
beamerthemepterosor.sty Normal file
View File

@ -0,0 +1,29 @@
\mode<presentation>
% Requirement
\RequirePackage{tikz}
% Settings
\useinnertheme{pterosor}
\useoutertheme{pterosor}
\usecolortheme{pterosor}
\usefonttheme{pterosor}
% we remove the navigation symbols and define blocks aspect.
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{blocks}[rounded][shadow=true]
\AtBeginSection[]{%
\begin{frame}[plain]
\usebeamertemplate{section page}
\end{frame}
}
\setbeamertemplate{footline}{
\vspace{0.6cm}
}
\mode<all>

BIN
beamertitlepterosor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
comb_e.pdf Normal file

Binary file not shown.

BIN
comb_err.pdf Normal file

Binary file not shown.

BIN
dist2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
dist2_noise.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
eici2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
fig1.pdf Normal file

Binary file not shown.

BIN
hybrid_e.pdf Normal file

Binary file not shown.

BIN
hybrid_err.pdf Normal file

Binary file not shown.

BIN
lazy_e.pdf Normal file

Binary file not shown.

BIN
lazy_err.pdf Normal file

Binary file not shown.

BIN
samples.pdf Normal file

Binary file not shown.

BIN
speedup_pt2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB