diff options
33 files changed, 1517 insertions, 0 deletions
diff --git a/Jauslin_RUMA_2022.tex b/Jauslin_RUMA_2022.tex new file mode 100644 index 0000000..0cab260 --- /dev/null +++ b/Jauslin_RUMA_2022.tex @@ -0,0 +1,349 @@ +\documentclass{ian-presentation} + +\usepackage[hidelinks]{hyperref} +\usepackage{graphicx} +\usepackage{xcolor} + +\definecolor{highlight}{HTML}{981414} +\def\high#1{{\color{highlight}#1}} + +\begin{document} +\pagestyle{empty} +\hbox{}\vfil +\bf\Large +\hfil Statistical Mechanics:\par +\smallskip +\hfil from the microscopic to the macroscopic\par +\vfil +\large +\hfil Ian Jauslin\par +\rm\normalsize +\vfil +{\tt \href{mailto:ian.jauslin@rutgers.edu}{ian.jauslin@rutgers.edu}} +\hfill{\tt \href{http://ian.jauslin.org}{http://ian.jauslin.org}} +\eject + +\setcounter{page}1 +\pagestyle{plain} + +\title{Macroscopic laws: phases of water} +\begin{itemize} + \item Phenomena that are \high{directly observable} are \high{Macroscopic}. + + \item For example, water at ambient pressure freezes \high{at} $0^\circ\mathrm{C}$ and boils \high{at} $100^\circ\mathrm{C}$. + + \item Liquid water, vapor and ice all have \high{very different properties}, and yet one can \high{easily transition} between these states, simply by changing the \high{temperature} + \begin{itemize} + \item A gas fills the entire volume available. + \item A liquid is incompressible, but flows. + \item A solid is rigid, and moves only as a whole. + \end{itemize} + + \item Melting ice is \high{exactly} at $0^\circ\mathrm{C}$, and boiling water is \high{exactly} at $100^\circ\mathrm{C}$. +\end{itemize} +\vfill +\eject + +\title{Macroscopic laws: gasses} +\begin{itemize} + \item The state of a (ideal) gas is entirely characterized by \high{three} quantities: + \begin{itemize} + \item $p$: pressure + \item $T$: temperature + \item $n$: density + \end{itemize} + + \item Ideal gas law: + $$p=\frac{k_B}\mu nT$$ + \vskip-5pt + + \item Energy density: + $$e=\frac32k_B T$$ +\end{itemize} +\vfill +\eject + +\title{Microscopic Theories: phases of water} +\begin{itemize} + \item Understand macroscopic laws from \high{first principles}: \high{Microscopic} theories. + \vskip-5pt + \item Freezing and boiling: \high{ordering transitions}. + + \hfil + \includegraphics[width=3cm]{gas.png} + \hfil + \includegraphics[width=3cm]{liquid.png} + \hfil + \includegraphics[width=3cm]{crystal.png} + + \begin{itemize} + \item Gases expand because the molecules are far apart. + \vskip-5pt + \item Liquids are jammed, but molecules can still move around each other. + \vskip-5pt + \item Solids are constrained by the rigid pattern of their molecules. + \end{itemize} +\end{itemize} +\vfill +\eject + +\title{Microscopic Theories: gasses} +\begin{itemize} + \item Ideal gas: non-interacting molecules. + + \hfil + \includegraphics[width=3cm]{gas.png} + + \item We will discuss later how this predicts the laws discussed earlier. +\end{itemize} +\vfill +\eject +\title{What is Statistical Mechanics?} +\vfill +\begin{itemize} + \item Statistical mechanics: understanding how the \high{macroscopic} properties follow from the \high{microscopic} laws of nature (``first principles''). +\end{itemize} +\vfill +\eject + +\title{The arrow of time} +\begin{itemize} + \item Microscopic dynamics are \high{reversible}. + + \item Consider the motion of a point particle, which follows the laws of (conservative) Newtonian mechanics. If time is \high{reversed}, the motion still satisfies the \high{same} laws of Newtonian mechanics. + + \item In fact, Newtonian mechanics has a \high{recurrence time}: any (bounded, conservative) mechanical system will return \high{arbitrarily close} to its original state in \high{finite} time. +\end{itemize} +\vfill +\eject + +\title{The arrow of time} +\begin{itemize} + \item Yet, many macroscopic phenomena are \high{irreversible}. + \item Friction: the law of friction is not invariant under time reversal. + \item The expansion of a gas in a container. + \item How can \high{reversible} microscopic dynamics give rise to \high{irreversible} macroscopic phenomena? +\end{itemize} +\vfill +\eject + +\title{The thermodynamic limit} +\begin{itemize} + \item One mole $\approx\ 6.02\times10^{23}$. + + \item Rough estimate of the recurrence time for a mechanical system containing $10^{23}$ particles: $\approx 10^{10^{23}}\ \mathrm{s}$. (Time since the big bang: $\approx 10^{17}\ \mathrm s$.) + + \item Whereas a \high{finite} number of microscopic particles behaves reversibly, an \high{infinite} number of microscopic particles does not. + + \item Fundamental tool of statistical mechanics: the \high{thermodynamic limit}, in which the number of particles $\to\infty$. + +\end{itemize} +\vfill +\eject + +\title{Putting the Statistics in Statistical Mechanics} +\begin{itemize} + \item To understand these infinite interacting particles, we use \high{probability theory}. + + \item Simple example: the ideal gas: + \begin{itemize} + \item Each particle is a point, and no two particles interact. + \item Probability distribution: \high{Gibbs distribution} + $$ + p(\mathbf x,\mathbf v)=\frac1Z e^{-\beta H(\mathbf x,\mathbf v)} + ,\quad + \beta:=\frac1{k_BT} + $$ + where $H(\mathbf x,\mathbf v)$ is the energy of the configuration where the particles are located at $\mathbf x\equiv(x_1,\cdots,x_N)$ with velocities $\mathbf v\equiv(v_1,\cdots,v_N)$. + \end{itemize} +\end{itemize} +\vfill +\eject + +\title{The ideal gas} +\begin{itemize} + \item The energy is the kinetic energy: + $$ + H(\mathbf x,\mathbf v)= + \frac12m\sum_{i=1}^Nv_i^2 + . + $$ + \vskip-5pt + + \item Denoting the number of particles by $N$ and the volume by $V$, we have + $$ + Z=\int d\mathbf x d\mathbf v\ e^{-\beta H(\mathbf x,\mathbf v)} + =\int d\mathbf x\int d\mathbf v\ e^{-\frac{\beta m}2\mathbf v^2}=V^N\left(\frac{2\pi}{\beta m}\right)^{\frac32N} + . + $$ + \vskip-5pt + + \item The average energy is + $$ + \mathbb E(H)=\frac1Z\int d\mathbf xd\mathbf v\ H(\mathbf x,\mathbf v)e^{-\beta H(\mathbf x,\mathbf v)} + = + -\frac\partial{\partial\beta}\log Z + = + \frac{3N}{2\beta} + =\frac32Nk_BT + . + $$ + + \item + The ideal gas law can also be proved for this model. +\end{itemize} +\vfill +\eject + +\title{Hard sphere model} +\begin{itemize} + \item The ideal gas does \high{not} form a liquid or a solid phase. + + \item In order to have such phase transitions, we need an \high{interaction} between particles. + + \item \high{Hard sphere model}: each particle is a sphere of radius $R$, and the interaction is such that no two spheres can overlap. + + \item Parameter: density. +\end{itemize} +\vfill +\eject + +\title{Hard sphere model} +\vskip-10pt +\begin{itemize} + \item We expect, from numerical simulations, to see two phases: a \high{gaseous} phase at low density and a \high{crystalline} one at high density. +\end{itemize} + +\hfil +\includegraphics[width=3cm]{gas.png} +\hfil +\includegraphics[width=3cm]{crystal.png} +\vskip-10pt + +\begin{itemize} + \item In the \high{gaseous phase}, the particles are almost decorrelated: they behave as if they did not interact. + + \item In the \high{crystalline phase}, they form large scale periodic structures: they behave very differently from the ideal gas. +\end{itemize} + +\vfill +\eject + +\title{Hard sphere model} +\begin{itemize} + \item The \high{gaseous phase} is very well understood. + + \item The \high{crystalline phase} is much more of a mystery: we still lack a proof that it exists at positive temperatures! + + \item \high{Open Problem}: prove that hard spheres crystallize at sufficiently low temperatures. + + \item Even at zero temperature, it was only proved that they crystallize in 2005, and that proof is computer-assisted. + + \item This is very difficult: even tiny fluctuations in the positions of the spheres could destroy the crystalline structure. +\end{itemize} +\vfill +\eject + +\title{Liquid crystals} +\begin{itemize} + \item Phase of matter that shares properties of \high{liquids} (disorder) and \high{crystals} (order). + + \item Nematic liquid crystals: order in orientation, disorder in position. +\end{itemize} +\hfil\includegraphics[width=4cm]{nematic.png} +\vfill +\eject + +\title{Liquid crystals} +\begin{itemize} + \item Model: hard cylinders, expected phases: \high{gas}, \high{nematic}, \high{smectic}, ... +\end{itemize} +\hfil\includegraphics[height=4cm]{gas-rods.png} +\hfil\includegraphics[height=4cm]{nematic.png} +\hfil\includegraphics[height=4cm]{smectic.png} +\begin{itemize} + \item Here again, the gas phase is well understood, but neither the nematic nor the smectic have yet been proved to exist. +\end{itemize} +\vfill +\eject + +\title{Continuous symmetry breaking} +\begin{itemize} + \item Difficulty for both the hard spheres and liquid crystals: \high{breaking a continuous symmetry} (translation for the hard spheres, rotation for the liquid crystals). + + \item Continuous symmetries cannot\textsuperscript{$\ast$} be broken in one or two dimensions. + + \item Continuous symmetry breaking can, so far, only be proved in very special models. +\end{itemize} +\vfill +\eject + +\title{Lattice models} +\begin{itemize} + \item Many examples: +\end{itemize} +\vfill +\hfil\includegraphics[width=1.2cm]{diamond.pdf} +\hfil\includegraphics[width=1.2cm]{cross.pdf} +\hfil\includegraphics[width=1.2cm]{hexagon.pdf} +\par +\vfill +\hfil\includegraphics[width=0.9cm]{V_triomino.pdf} +\hfil\includegraphics[width=0.9cm]{T_tetromino.pdf} +\hfil\includegraphics[width=0.9cm]{L_tetromino.pdf} +\hfil\includegraphics[width=0.9cm]{P_pentomino.pdf} +\vfill +\eject + +\title{Hard diamond model} +\hfil\includegraphics[height=6cm]{diamonds.pdf} +\vfill +\eject + +\addtocounter{page}{-1} +\title{Hard diamond model} +\hfil\includegraphics[height=6cm]{diamonds_color.pdf} +\vfill +\eject + +\title{Hard diamond model} +\vfill +\begin{itemize} + \item Idea: treat the vacancies as a gas of ``virtual particles''. + + \item Can prove crystallization for a large class of lattice models. +\end{itemize} +\vfill +\eject + +\title{Hard rods on a lattice} +\begin{itemize} + \item Model: rods of length $k$ on $\mathbb Z^2$. +\end{itemize} +\hfil\includegraphics[height=5cm]{rods.pdf} +\vfill +\eject + +\title{Hard rods on a lattice} +\begin{itemize} + \item Can prove that, when $k^{-2}\ll\rho\ll k^{-1}$, the system forms a nematic phase. + + \item For larger densities, one expects yet another phase, in which there are tiles of horizontal and vertical rods. + + \item \high{Open Problem}: generalization to 3 dimensions. +\end{itemize} +\vfill +\eject + +\title{Conclusion} +\begin{itemize} + \item Statistical Mechanics establishes a \high{link} between \high{Microscopic} theories and \high{Macroscopic} behavior. + + \item (In equilibrium) it consists in studying the properties of special probability distributions called \high{Gibbs Measures}. + + \item Even simple models pose significant mathematical challenges. + + \item Still, much can be said about \high{lattice models}, even though there are many problems that are \high{still open}! +\end{itemize} + +\end{document} diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8571f86 --- /dev/null +++ b/Makefile @@ -0,0 +1,48 @@ +PROJECTNAME=$(basename $(wildcard *.tex)) +LIBS=$(notdir $(wildcard libs/*)) +FIGS=$(notdir $(wildcard figs/*.fig)) + +PDFS=$(addsuffix .pdf, $(PROJECTNAME)) +SYNCTEXS=$(addsuffix .synctex.gz, $(PROJECTNAME)) + +all: $(PROJECTNAME) + +$(PROJECTNAME): $(LIBS) $(FIGS) + pdflatex -file-line-error $@.tex + pdflatex -synctex=1 $@.tex + +$(SYNCTEXS): $(LIBS) $(FIGS) + pdflatex -synctex=1 $(patsubst %.synctex.gz, %.tex, $@) + + +libs: $(LIBS) + +$(LIBS): + ln -fs libs/$@ ./ + +figs: $(FIGS) + +$(FIGS): + make -C figs/$@ + for pdf in $$(find figs/$@/ -name '*.pdf'); do ln -fs "$$pdf" ./ ; done + for png in $$(find figs/$@/ -name '*.png'); do ln -fs "$$png" ./ ; done + +clean-aux: clean-figs-aux + rm -f $(addsuffix .aux, $(PROJECTNAME)) + rm -f $(addsuffix .log, $(PROJECTNAME)) + rm -f $(addsuffix .out, $(PROJECTNAME)) + +clean-libs: + rm -f $(LIBS) + +clean-figs: + $(foreach fig,$(addprefix figs/, $(FIGS)), make -C $(fig) clean; ) + rm -f $(notdir $(wildcard figs/*.fig/*.pdf)) + +clean-figs-aux: + $(foreach fig,$(addprefix figs/, $(FIGS)), make -C $(fig) clean-aux; ) + +clean-tex: + rm -f $(PDFS) $(SYNCTEXS) + +clean: clean-aux clean-tex clean-libs clean-figs @@ -0,0 +1,34 @@ +This directory contains the source files to typeset the presentation, and +generate the figures. This can be accomplished by running + make + +This document uses a custom class file, located in the 'libs' directory, which +defines a number of commands. + + +* Dependencies: + + pdflatex + TeXlive packages: + amsfonts + graphics + hyperref + latex + pgf + standalone + colorx + GNU make + python + gnuplot + +* Files: + + Jauslin_RUMA_2022.tex: + main LaTeX file + + libs: + custom LaTeX class file + + figs: + source code for the figures + diff --git a/figs/atoms.fig/Makefile b/figs/atoms.fig/Makefile new file mode 100644 index 0000000..50559fa --- /dev/null +++ b/figs/atoms.fig/Makefile @@ -0,0 +1,15 @@ +PROJECTNAME=crystal liquid gas nematic smectic gas-rods +PNGS=$(addsuffix .png, $(PROJECTNAME)) + +all: $(PNGS) + +$(PNGS): + cp $(patsubst %.png, %, $@)-base.gp $(patsubst %.png, %, $@).gp + python $(patsubst %.png, %, $@).py >> $(patsubst %.png, %, $@).gp + gnuplot $(patsubst %.png, %, $@).gp > $@ + +clean-aux: + rm -f $(addsuffix .gp, $(PROJECTNAME)) + +clean: clean-aux + rm -f $(PNGS) diff --git a/figs/atoms.fig/crystal-base.gp b/figs/atoms.fig/crystal-base.gp new file mode 100644 index 0000000..4de0ee2 --- /dev/null +++ b/figs/atoms.fig/crystal-base.gp @@ -0,0 +1,21 @@ +set terminal pngcairo size 2048,2048 + +set key off +unset colorbox +unset border +unset xtics +unset ytics +unset ztics + +set parametric + +set view equal xyz + +set isosample 100 + +set pm3d depthorder +set pm3d lighting primary 0.50 specular 0.6 + +set palette defined (0 "#339999", 1 "#339999") + +splot \ diff --git a/figs/atoms.fig/crystal.py b/figs/atoms.fig/crystal.py new file mode 100644 index 0000000..4b1ba3c --- /dev/null +++ b/figs/atoms.fig/crystal.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +from math import * +import random +import sys + +# size of lattice +N=5 + +# configuration +config=[] +for i in range(N): + for j in range(N): + for k in range(N): + config.append([2*i+((j+k)%2),sqrt(3)*(j+(k%2)/3),2*sqrt(6)/3*k]) + + +for i in range(len(config)): + print(str(config[i][0])+"+cos(u)*sin(v)", end=",") + print(str(config[i][1])+"+sin(u)*sin(v)", end=",") + print(str(config[i][2])+"+cos(v)", end=" ") + print("with pm3d", end="") + if i<len(config)-1: + print(", \\") diff --git a/figs/atoms.fig/gas-base.gp b/figs/atoms.fig/gas-base.gp new file mode 100644 index 0000000..e95f005 --- /dev/null +++ b/figs/atoms.fig/gas-base.gp @@ -0,0 +1,21 @@ +set terminal pngcairo size 2048,2048 + +set key off +unset colorbox +unset border +unset xtics +unset ytics +unset ztics + +set parametric + +set view equal xyz + +set isosample 100 + +set pm3d depthorder +set pm3d lighting primary 0.5 specular 0.6 + +set palette defined (0 "#339999", 1 "#339999") + +splot \ diff --git a/figs/atoms.fig/gas-rods-base.gp b/figs/atoms.fig/gas-rods-base.gp new file mode 100644 index 0000000..4de0ee2 --- /dev/null +++ b/figs/atoms.fig/gas-rods-base.gp @@ -0,0 +1,21 @@ +set terminal pngcairo size 2048,2048 + +set key off +unset colorbox +unset border +unset xtics +unset ytics +unset ztics + +set parametric + +set view equal xyz + +set isosample 100 + +set pm3d depthorder +set pm3d lighting primary 0.50 specular 0.6 + +set palette defined (0 "#339999", 1 "#339999") + +splot \ diff --git a/figs/atoms.fig/gas-rods.py b/figs/atoms.fig/gas-rods.py new file mode 100644 index 0000000..dc63d24 --- /dev/null +++ b/figs/atoms.fig/gas-rods.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python3 + +from math import * +import random + +# size of space +L=30 +# number of rods +N=15 +# aspect ratio +a=10 + +# check whether two rods overlap +def check_overlap(rod1,rod2): + # relative placement + relative_pos=unrotate(subtract(rod2[0],rod1[0]), rod1[1]) + if(abs(relative_pos[0])<2 and abs(relative_pos[1])<2 and abs(relative_pos[2])<2): + return(True) + # relative angle + relative_ang=cart_to_spherical(unrotate(spherical_to_cart(rod2[1]), rod1[1])) + # exclusion volume + # rotate other rod + relative_pos=unrotate(relative_pos, [0,relative_ang[1]]) + #if(abs(relative_pos[1])<2 and abs(relative_pos[0])-2<abs(sin(relative_ang[0]))*a and abs(relative_pos[2])-a-2<abs(cos(relative_ang[0])*a)): + if(abs(relative_pos[1])<2 and abs(relative_pos[0])-2<abs(sin(relative_ang[0]))*a and abs(sin(relative_ang[0])*relative_pos[2]-cos(relative_ang[0])*relative_pos[0])-2<abs(sin(relative_ang[0])*a)): + return(True) + return(False) + +# def subtract vectors +def subtract(x,y): + return([x[0]-y[0],x[1]-y[1],x[2]-y[2]]) +# rotate vector +def unrotate(x,w): + ret=[x[0],x[1],x[2]] + # rotate phi + tmp=cos(w[1])*ret[0]+sin(w[1])*ret[1] + ret[1]=-sin(w[1])*ret[0]+cos(w[1])*ret[1] + ret[0]=tmp + # rotate theta + tmp=cos(w[0])*ret[0]-sin(w[0])*ret[2] + ret[2]=sin(w[0])*ret[0]+cos(w[0])*ret[2] + ret[0]=tmp + return(ret) + +# convert coordinates +def spherical_to_cart(w): + return([cos(w[1])*sin(w[0]),sin(w[1])*sin(w[0]),cos(w[0])]) +def cart_to_spherical(x): + w=[0,0] + w[0]=acos(x[2]) + if(sin(w[0]==0)): + return([w[0],0]) + c=x[0]/sin(w[0]) + s=x[1]/sin(w[0]) + # to avoid truncation errors + if(abs(c)>1 and abs(c)<1.0001): + if(c>0): + return([w[0],0]) + else: + return([w[0],pi]) + if(s>=0): + return([w[0],acos(c)]) + return([w[0],2*pi-acos(c)]) + +# configuration +config=[] +# add rods +while len(config)<N: + # random position and angles + x=[random.uniform(0,L), random.uniform(0,L), random.uniform(0,L)] + w=[random.uniform(0,pi), random.uniform(0,2*pi)] + # chek it does not interfere with other rods + fine=True + for rod in config: + if(check_overlap(rod,[x,w])): + fine=False + break + if fine: + config.append([x,w]) + +for i in range(len(config)): + rod=config[i] + print(str(rod[0][0])+"+("+str(cos(rod[1][1])*cos(rod[1][0]))+")*cos(u)*sin(v)+("+str(-sin(rod[1][1]))+")*sin(u)*sin(v)+("+str(cos(rod[1][1])*sin(rod[1][0])*a)+")*cos(v)", end=", ") + print(str(rod[0][1])+"+("+str(sin(rod[1][1])*cos(rod[1][0]))+")*cos(u)*sin(v)+("+str(cos(rod[1][1]))+")*sin(u)*sin(v)+("+str(sin(rod[1][1])*sin(rod[1][0])*a)+")*cos(v)", end=", ") + print(str(rod[0][2])+"+("+str(-sin(rod[1][0]))+")*cos(u)*sin(v)+("+str(cos(rod[1][0])*a)+")*cos(v)", end=" ") + print("with pm3d", end="") + if i<len(config)-1: + print(", \\") diff --git a/figs/atoms.fig/gas.py b/figs/atoms.fig/gas.py new file mode 100644 index 0000000..8685999 --- /dev/null +++ b/figs/atoms.fig/gas.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 + +from math import * +import random + +# size of space +L=15 +# number of particles +N=10 + +# check whether two rods overlap +def check_overlap(sphere1,sphere2): + if(sqrt((sphere2[0]-sphere1[0])**2+(sphere2[1]-sphere1[1])**2+(sphere2[2]-sphere1[2])**2)<2): + return(True) + return(False) + +# configuration +config=[] +# add spheres +while len(config)<N: + # random position + x=[random.uniform(0,L), random.uniform(0,L), random.uniform(0,L)] + # check it does not interfere with other spheres + fine=True + for sphere in config: + if(check_overlap(sphere,x)): + fine=False + break + if fine: + config.append(x) + +for i in range(len(config)): + sphere=config[i] + print(str(sphere[0])+"+cos(u)*sin(v)", end=", ") + print(str(sphere[1])+"+sin(u)*sin(v)", end=", ") + print(str(sphere[2])+"+cos(v)", end=" ") + print("with pm3d", end="") + if i<len(config)-1: + print(", \\") diff --git a/figs/atoms.fig/liquid-base.gp b/figs/atoms.fig/liquid-base.gp new file mode 100644 index 0000000..4de0ee2 --- /dev/null +++ b/figs/atoms.fig/liquid-base.gp @@ -0,0 +1,21 @@ +set terminal pngcairo size 2048,2048 + +set key off +unset colorbox +unset border +unset xtics +unset ytics +unset ztics + +set parametric + +set view equal xyz + +set isosample 100 + +set pm3d depthorder +set pm3d lighting primary 0.50 specular 0.6 + +set palette defined (0 "#339999", 1 "#339999") + +splot \ diff --git a/figs/atoms.fig/liquid.py b/figs/atoms.fig/liquid.py new file mode 100644 index 0000000..99b09ba --- /dev/null +++ b/figs/atoms.fig/liquid.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 + +from math import * +import random + +# size of space +L=15 +# number of particles +N=100 + +# check whether two rods overlap +def check_overlap(sphere1,sphere2): + if(sqrt((sphere2[0]-sphere1[0])**2+(sphere2[1]-sphere1[1])**2+(sphere2[2]-sphere1[2])**2)<2): + return(True) + return(False) + +# configuration +config=[] +# add spheres +while len(config)<N: + # random position + x=[random.uniform(0,L), random.uniform(0,L), random.uniform(0,L)] + # check it does not interfere with other spheres + fine=True + for sphere in config: + if(check_overlap(sphere,x)): + fine=False + break + if fine: + config.append(x) + +for i in range(len(config)): + sphere=config[i] + print(str(sphere[0])+"+cos(u)*sin(v)", end=", ") + print(str(sphere[1])+"+sin(u)*sin(v)", end=", ") + print(str(sphere[2])+"+cos(v)", end=" ") + print("with pm3d", end="") + if i<len(config)-1: + print(", \\") diff --git a/figs/atoms.fig/nematic-base.gp b/figs/atoms.fig/nematic-base.gp new file mode 100644 index 0000000..4de0ee2 --- /dev/null +++ b/figs/atoms.fig/nematic-base.gp @@ -0,0 +1,21 @@ +set terminal pngcairo size 2048,2048 + +set key off +unset colorbox +unset border +unset xtics +unset ytics +unset ztics + +set parametric + +set view equal xyz + +set isosample 100 + +set pm3d depthorder +set pm3d lighting primary 0.50 specular 0.6 + +set palette defined (0 "#339999", 1 "#339999") + +splot \ diff --git a/figs/atoms.fig/nematic.py b/figs/atoms.fig/nematic.py new file mode 100644 index 0000000..5c779c0 --- /dev/null +++ b/figs/atoms.fig/nematic.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 + +from math import * +import random + +# size of space +L=30 +# number of rods +N=75 +# aspect ratio +a=10 +# spread in theta angle +spread=pi/30 + +# check whether two rods overlap +def check_overlap(rod1,rod2): + # relative placement + relative_pos=unrotate(subtract(rod2[0],rod1[0]), rod1[1]) + if(abs(relative_pos[0])<2 and abs(relative_pos[1])<2 and abs(relative_pos[2])<2): + return(True) + # relative angle + relative_ang=cart_to_spherical(unrotate(spherical_to_cart(rod2[1]), rod1[1])) + # exclusion volume + # rotate other rod + relative_pos=unrotate(relative_pos, [0,relative_ang[1]]) + #if(abs(relative_pos[1])<2 and abs(relative_pos[0])-2<abs(sin(relative_ang[0]))*a and abs(relative_pos[2])-a-2<abs(cos(relative_ang[0])*a)): + if(abs(relative_pos[1])<2 and abs(relative_pos[0])-2<abs(sin(relative_ang[0]))*a and abs(sin(relative_ang[0])*relative_pos[2]-cos(relative_ang[0])*relative_pos[0])-2<abs(sin(relative_ang[0])*a)): + return(True) + return(False) + +# def subtract vectors +def subtract(x,y): + return([x[0]-y[0],x[1]-y[1],x[2]-y[2]]) +# rotate vector +def unrotate(x,w): + ret=[x[0],x[1],x[2]] + # rotate phi + tmp=cos(w[1])*ret[0]+sin(w[1])*ret[1] + ret[1]=-sin(w[1])*ret[0]+cos(w[1])*ret[1] + ret[0]=tmp + # rotate theta + tmp=cos(w[0])*ret[0]-sin(w[0])*ret[2] + ret[2]=sin(w[0])*ret[0]+cos(w[0])*ret[2] + ret[0]=tmp + return(ret) + +# convert coordinates +def spherical_to_cart(w): + return([cos(w[1])*sin(w[0]),sin(w[1])*sin(w[0]),cos(w[0])]) +def cart_to_spherical(x): + w=[0,0] + w[0]=acos(x[2]) + if(sin(w[0]==0)): + return([w[0],0]) + c=x[0]/sin(w[0]) + s=x[1]/sin(w[0]) + # to avoid truncation errors + if(abs(c)>1 and abs(c)<1.0001): + if(c>0): + return([w[0],0]) + else: + return([w[0],pi]) + if(s>=0): + return([w[0],acos(c)]) + return([w[0],2*pi-acos(c)]) + +# configuration +config=[] +# add rods +while len(config)<N: + # random position and angles + x=[random.uniform(0,L), random.uniform(0,L), random.uniform(0,L)] + w=[abs(random.gauss(0,spread)), random.uniform(0,2*pi)] + # chek it does not interfere with other rods + fine=True + for rod in config: + if(check_overlap(rod,[x,w])): + fine=False + break + if fine: + config.append([x,w]) + +for i in range(len(config)): + rod=config[i] + print(str(rod[0][0])+"+("+str(cos(rod[1][1])*cos(rod[1][0]))+")*cos(u)*sin(v)+("+str(-sin(rod[1][1]))+")*sin(u)*sin(v)+("+str(cos(rod[1][1])*sin(rod[1][0])*a)+")*cos(v)", end=", ") + print(str(rod[0][1])+"+("+str(sin(rod[1][1])*cos(rod[1][0]))+")*cos(u)*sin(v)+("+str(cos(rod[1][1]))+")*sin(u)*sin(v)+("+str(sin(rod[1][1])*sin(rod[1][0])*a)+")*cos(v)", end=", ") + print(str(rod[0][2])+"+("+str(-sin(rod[1][0]))+")*cos(u)*sin(v)+("+str(cos(rod[1][0])*a)+")*cos(v)", end=" ") + print("with pm3d", end="") + if i<len(config)-1: + print(", \\") diff --git a/figs/atoms.fig/smectic-base.gp b/figs/atoms.fig/smectic-base.gp new file mode 100644 index 0000000..6b2077f --- /dev/null +++ b/figs/atoms.fig/smectic-base.gp @@ -0,0 +1,21 @@ +set terminal pngcairo size 2048,2048 + +set key off +unset colorbox +unset border +unset xtics +unset ytics +unset ztics + +set parametric + +set view 90,0 + +set isosample 100 + +set pm3d depthorder +set pm3d lighting primary 0.50 specular 0.6 + +set palette defined (0 "#339999", 1 "#339999") + +splot \ diff --git a/figs/atoms.fig/smectic.py b/figs/atoms.fig/smectic.py new file mode 100644 index 0000000..c8d4d13 --- /dev/null +++ b/figs/atoms.fig/smectic.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 + +from math import * +import random + +# size of space +L=30 +# number of rods +N=150 +# aspect ratio +a=10 +# spread in theta angle +spread=pi/30 +# spread in height +spread_height=a/5 + +# check whether two rods overlap +def check_overlap(rod1,rod2): + # relative placement + relative_pos=unrotate(subtract(rod2[0],rod1[0]), rod1[1]) + if(abs(relative_pos[0])<2 and abs(relative_pos[1])<2 and abs(relative_pos[2])<2): + return(True) + # relative angle + relative_ang=cart_to_spherical(unrotate(spherical_to_cart(rod2[1]), rod1[1])) + # exclusion volume + # rotate other rod + relative_pos=unrotate(relative_pos, [0,relative_ang[1]]) + #if(abs(relative_pos[1])<2 and abs(relative_pos[0])-2<abs(sin(relative_ang[0]))*a and abs(relative_pos[2])-a-2<abs(cos(relative_ang[0])*a)): + if(abs(relative_pos[1])<2 and abs(relative_pos[0])-2<abs(sin(relative_ang[0]))*a and abs(sin(relative_ang[0])*relative_pos[2]-cos(relative_ang[0])*relative_pos[0])-2<abs(sin(relative_ang[0])*a)): + return(True) + return(False) + +# def subtract vectors +def subtract(x,y): + return([x[0]-y[0],x[1]-y[1],x[2]-y[2]]) +# rotate vector +def unrotate(x,w): + ret=[x[0],x[1],x[2]] + # rotate phi + tmp=cos(w[1])*ret[0]+sin(w[1])*ret[1] + ret[1]=-sin(w[1])*ret[0]+cos(w[1])*ret[1] + ret[0]=tmp + # rotate theta + tmp=cos(w[0])*ret[0]-sin(w[0])*ret[2] + ret[2]=sin(w[0])*ret[0]+cos(w[0])*ret[2] + ret[0]=tmp + return(ret) + +# convert coordinates +def spherical_to_cart(w): + return([cos(w[1])*sin(w[0]),sin(w[1])*sin(w[0]),cos(w[0])]) +def cart_to_spherical(x): + w=[0,0] + w[0]=acos(x[2]) + if(sin(w[0]==0)): + return([w[0],0]) + c=x[0]/sin(w[0]) + s=x[1]/sin(w[0]) + # to avoid truncation errors + if(abs(c)>1 and abs(c)<1.0001): + if(c>0): + return([w[0],0]) + else: + return([w[0],pi]) + if(s>=0): + return([w[0],acos(c)]) + return([w[0],2*pi-acos(c)]) + +# configuration +config=[] +# add rods +while len(config)<N: + # random position and angles + x=[random.uniform(0,L), random.uniform(0,L), 1.6*a*random.randint(0,2)+random.gauss(0,spread_height)] + w=[abs(random.gauss(0,spread)), random.uniform(0,2*pi)] + # chek it does not interfere with other rods + fine=True + for rod in config: + if(check_overlap(rod,[x,w])): + fine=False + break + if fine: + config.append([x,w]) + +for i in range(len(config)): + rod=config[i] + print(str(rod[0][0])+"+("+str(cos(rod[1][1])*cos(rod[1][0]))+")*cos(u)*sin(v)+("+str(-sin(rod[1][1]))+")*sin(u)*sin(v)+("+str(cos(rod[1][1])*sin(rod[1][0])*a)+")*cos(v)", end=", ") + print(str(rod[0][1])+"+("+str(sin(rod[1][1])*cos(rod[1][0]))+")*cos(u)*sin(v)+("+str(cos(rod[1][1]))+")*sin(u)*sin(v)+("+str(sin(rod[1][1])*sin(rod[1][0])*a)+")*cos(v)", end=", ") + print(str(rod[0][2])+"+("+str(-sin(rod[1][0]))+")*cos(u)*sin(v)+("+str(cos(rod[1][0])*a)+")*cos(v)", end=" ") + print("with pm3d", end="") + if i<len(config)-1: + print(", \\") diff --git a/figs/diamonds.fig/Makefile b/figs/diamonds.fig/Makefile new file mode 100644 index 0000000..42b4031 --- /dev/null +++ b/figs/diamonds.fig/Makefile @@ -0,0 +1,20 @@ +all: diamonds + +diamonds: + python diamonds.py > diamonds.tikz.tex + cat diamonds.tikz.tex | sed 's/%1%/red/g;s/%2%/blue/g' > diamonds_color.tikz.tex + sed -i 's/%1%/teal/g;s/%2%/teal/g' diamonds.tikz.tex + pdflatex -jobname diamonds diamonds.tikz.tex + pdflatex -jobname diamonds_color diamonds_color.tikz.tex + +clean-aux: + rm -f diamonds.tikz.tex + rm -f diamonds.log + rm -f diamonds.aux + rm -f diamonds_color.tikz.tex + rm -f diamonds_color.log + rm -f diamonds_color.aux + +clean: clean-aux + rm -f diamonds.pdf + rm -f diamonds_color.pdf diff --git a/figs/diamonds.fig/diamonds.py b/figs/diamonds.fig/diamonds.py new file mode 100644 index 0000000..2bc4d9c --- /dev/null +++ b/figs/diamonds.fig/diamonds.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 + +from math import * +import random + +# size of space (must be int) +L=30 +# number of particles +N=int(L*L/2*0.97) + +# check whether two diamonds overlap +def check_overlap(x1,x2): + if(sqrt((x1[0]-x2[0])**2+(x1[1]-x2[1])**2)<=1): + return(True) + return(False) + +# configuration +config=[] + +# put particles on odd lattice manually +for i in range(4): + for j in range(4): + if (i!=2 or j!=1): + config.append([2*int(L/2/2)+1+i+j,2*int(L/2/2)+i-j]) + +# add particles +while len(config)<N: + # random position + # even sublattice + if(random.random()<0.5): + x=[2*random.randint(0,int(L/2)), 2*random.randint(0,int(L/2))] + else: + x=[2*random.randint(0,int(L/2))+1, 2*random.randint(0,int(L/2))+1] + # check it does not interfere with other particles + fine=True + for part in config: + if(check_overlap(part,x)): + fine=False + break + if fine: + config.append(x) + +print(r'''\documentclass{standalone} +\usepackage{tikz} +\usepackage{shapes} + +\begin{document} +\begin{tikzpicture} +\grid{'''+str(L+3)+'}{'+str(L+3)+'''}{(-1,-1)} +''') + +for i in range(len(config)): + part=config[i] + # different colors for even and odd + if i<15: + # replace %1% later + print(r'\diamond{%1%}{('+str(part[0])+','+str(part[1])+')}') + else: + # replace %2% later + print(r'\diamond{%2%}{('+str(part[0])+','+str(part[1])+')}') + +print(r''' +\end{tikzpicture} +\end{document} +''') diff --git a/figs/diamonds.fig/shapes.sty b/figs/diamonds.fig/shapes.sty new file mode 120000 index 0000000..2607bef --- /dev/null +++ b/figs/diamonds.fig/shapes.sty @@ -0,0 +1 @@ +../libs/shapes.sty
\ No newline at end of file diff --git a/figs/libs/shapes.sty b/figs/libs/shapes.sty new file mode 100644 index 0000000..e60faeb --- /dev/null +++ b/figs/libs/shapes.sty @@ -0,0 +1,109 @@ +% square lattice (width #1, height #2, origin #3, spacing #4) +\def\grid#1#2#3{ + \foreach\i in {0,...,#2}{ + \draw#3++(0,\i)--++(#1,0); + } + \foreach\i in {0,...,#1}{ + \draw#3++(\i,0)--++(0,#2); + } +} + + +% cross (color #1, position #2) +\def\cross#1#2{ + \fill[color=#1]#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-1)--++(-1,0)--++(0,-1)--++(1,0)--++(0,-1)--++(1,0)--++(0,1)--++(1,0)--++(0,1)--++(-1,0); + \begin{scope} + \clip#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-1)--++(-1,0)--++(0,-1)--++(1,0)--++(0,-1)--++(1,0)--++(0,1)--++(1,0)--++(0,1)--++(-1,0); + \grid44{[color=white]#2++(-2,-2)} + \end{scope} + \draw[color=black]#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-1)--++(-1,0)--++(0,-1)--++(1,0)--++(0,-1)--++(1,0)--++(0,1)--++(1,0)--++(0,1)--++(-1,0); +} + +% V triomino (color #1, position #2) +\def\Vtriomino#1#2{ + \fill[color=#1]#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-2)--++(2,0)--++(0,1)--++(-1,0); + \begin{scope} + \clip#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-2)--++(2,0)--++(0,1)--++(-1,0); + \grid33{[color=white]#2++(-1,-1)} + \end{scope} + \draw[color=black]#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-2)--++(2,0)--++(0,1)--++(-1,0); +} + +% T tetromino (color #1, position #2) +\def\Ttetromino#1#2{ + \fill[color=#1]#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-3)--++(1,0)--++(0,1)--++(1,0)--++(0,1)--++(-1,0); + \begin{scope} + \clip#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-3)--++(1,0)--++(0,1)--++(1,0)--++(0,1)--++(-1,0); + \grid34{[color=white]#2++(-1,-2)} + \end{scope} + \draw[color=black]#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-3)--++(1,0)--++(0,1)--++(1,0)--++(0,1)--++(-1,0); +} + +% L tetromino (color #1, position #2) +\def\Ltetromino#1#2{ + \fill[color=#1]#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-3)--++(2,0)--++(0,1)--++(-1,0)--++(0,1); + \begin{scope} + \clip#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-3)--++(2,0)--++(0,1)--++(-1,0)--++(0,1); + \grid34{[color=white]#2++(-1,-2)} + \end{scope} + \draw[color=black]#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-3)--++(2,0)--++(0,1)--++(-1,0)--++(0,1); +} + +% P pentomino (color #1, position #2) +\def\Ppentomino#1#2{ + \fill[color=#1]#2++(1.5,1.5)--++(-2,0)--++(0,-3)--++(1,0)--++(0,1)--++(1,0)--++(0,2); + \begin{scope} + \clip#2++(1.5,1.5)--++(-2,0)--++(0,-3)--++(1,0)--++(0,1)--++(1,0)--++(0,2); + \grid34{[color=white]#2++(-1,-2)} + \end{scope} + \draw[color=black]#2++(1.5,1.5)--++(-2,0)--++(0,-3)--++(1,0)--++(0,1)--++(1,0)--++(0,2); +} + +% 1x1 square (color #1, position #2) +\def\square#1#2{ + \fill[color=#1]#2++(-0.5,-0.5)--++(0,1)--++(1,0)--++(0,-1)--cycle; + \draw[color=black]#2++(-0.5,-0.5)--++(0,1)--++(1,0)--++(0,-1)--cycle; + \draw[color=white]#2++(-0.5,0)--++(1,0); + \draw[color=white]#2++(0,-0.5)--++(0,1); +} + +% 2x2 square (color #1, position #2) +\def\ttsquare#1#2{ + \fill[color=#1]#2++(-1,-1)--++(0,2)--++(2,0)--++(0,-2)--cycle; + \draw[color=black]#2++(-1,-1)--++(0,2)--++(2,0)--++(0,-2)--cycle; + \draw[color=white]#2++(-0.5,-1)--++(0,2); + \draw[color=white]#2++(0.5,-1)--++(0,2); + \draw[color=white]#2++(-1,-0.5)--++(2,0); + \draw[color=white]#2++(-1,0.5)--++(2,0); +} +\def\ttsquareempty#1{ + \draw[color=black]#1++(-1,-1)--++(0,2)--++(2,0)--++(0,-2)--cycle; +} + +% diamond (color #1, position #2) +\def\diamond#1#2{ + \fill[color=#1]#2++(0,-1)--++(1,1)--++(-1,1)--++(-1,-1)--cycle; + \begin{scope} + \clip#2++(0,-1)--++(1,1)--++(-1,1)--++(-1,-1)--cycle; + \grid22{[color=white]#2++(-1,-1)} + \end{scope} + \draw[color=black]#2++(0,-1)--++(1,1)--++(-1,1)--++(-1,-1)--cycle; +} + +% rods (color #1, position #2) +\def\rodh#1#2{ + \fill[color=#1]#2++(-5.5,-0.5)--++(11,0)--++(0,1)--++(-11,0)--cycle; + \begin{scope} + \clip#2++(-5.5,-0.5)--++(11,0)--++(0,1)--++(-11,0)--cycle; + \grid{12}2{[color=white]#2++(-6,-1)} + \end{scope} + \draw[color=black]#2++(-5.5,-0.5)--++(11,0)--++(0,1)--++(-11,0)--cycle; +} +\def\rodv#1#2{ + \fill[color=#1]#2++(-0.5,-5.5)--++(0,11)--++(1,0)--++(0,-11)--cycle; + \begin{scope} + \clip#2++(-0.5,-5.5)--++(0,11)--++(1,0)--++(0,-11)--cycle; + \grid2{12}{[color=white]#2++(-1,-6)} + \end{scope} + \draw[color=black]#2++(-0.5,-5.5)--++(0,11)--++(1,0)--++(0,-11)--cycle; +} diff --git a/figs/rods.fig/Makefile b/figs/rods.fig/Makefile new file mode 100644 index 0000000..33b81e2 --- /dev/null +++ b/figs/rods.fig/Makefile @@ -0,0 +1,28 @@ +PROJECTNAME=$(basename $(basename $(wildcard *.tikz.tex))) +LIBS=$(notdir $(wildcard libs/*)) + +PDFS=$(addsuffix .pdf, $(PROJECTNAME)) + +all: $(PDFS) + +$(PDFS): $(LIBS) + echo $(LIBS) + pdflatex -jobname $(basename $@) -file-line-error $(patsubst %.pdf, %.tikz.tex, $@) + +install: $(PDFS) + cp $^ $(INSTALLDIR)/ + +$(LIBS): + ln -fs libs/$@ ./ + +clean-libs: + rm -f $(LIBS) + +clean-aux: + rm -f $(addsuffix .aux, $(PROJECTNAME)) + rm -f $(addsuffix .log, $(PROJECTNAME)) + +clean-tex: + rm -f $(PDFS) + +clean: clean-libs clean-aux clean-tex diff --git a/figs/rods.fig/libs/shapes.sty b/figs/rods.fig/libs/shapes.sty new file mode 120000 index 0000000..eaa25c7 --- /dev/null +++ b/figs/rods.fig/libs/shapes.sty @@ -0,0 +1 @@ +../../libs/shapes.sty
\ No newline at end of file diff --git a/figs/rods.fig/rods.tikz.tex b/figs/rods.fig/rods.tikz.tex new file mode 100644 index 0000000..935a72f --- /dev/null +++ b/figs/rods.fig/rods.tikz.tex @@ -0,0 +1,30 @@ +\documentclass{standalone} + +\usepackage{tikz} +\usepackage{shapes} + +\begin{document} +\begin{tikzpicture} +\grid{27}{27}{(-13,-13)} + +\rodh{teal}{(0,0)} +\rodh{teal}{(2,1)} +\rodh{teal}{(8,3)} +\rodh{teal}{(-6,6)} +\rodh{teal}{(8,6)} +\rodh{teal}{(-7,7)} +\rodh{teal}{(8,8)} +\rodh{teal}{(-6,10)} +\rodh{teal}{(-4,-2)} +\rodh{teal}{(8,-2)} +\rodh{teal}{(-1,-5)} +\rodh{teal}{(-3,-7)} +\rodh{teal}{(5,-8)} +\rodh{teal}{(-3,-10)} + +\rodv{teal}{(-12,-1)} +\rodv{teal}{(-11,-5)} +\rodv{teal}{(1,8)} + +\end{tikzpicture} +\end{document} diff --git a/figs/shapes.fig/L_tetromino.tikz.tex b/figs/shapes.fig/L_tetromino.tikz.tex new file mode 100644 index 0000000..5c82766 --- /dev/null +++ b/figs/shapes.fig/L_tetromino.tikz.tex @@ -0,0 +1,11 @@ +\documentclass{standalone} + +\usepackage{tikz} +\usepackage{shapes} + +\begin{document} +\begin{tikzpicture} +\grid34{(-1,-2)} +\Ltetromino{teal}{(0,0)} +\end{tikzpicture} +\end{document} diff --git a/figs/shapes.fig/Makefile b/figs/shapes.fig/Makefile new file mode 100644 index 0000000..33b81e2 --- /dev/null +++ b/figs/shapes.fig/Makefile @@ -0,0 +1,28 @@ +PROJECTNAME=$(basename $(basename $(wildcard *.tikz.tex))) +LIBS=$(notdir $(wildcard libs/*)) + +PDFS=$(addsuffix .pdf, $(PROJECTNAME)) + +all: $(PDFS) + +$(PDFS): $(LIBS) + echo $(LIBS) + pdflatex -jobname $(basename $@) -file-line-error $(patsubst %.pdf, %.tikz.tex, $@) + +install: $(PDFS) + cp $^ $(INSTALLDIR)/ + +$(LIBS): + ln -fs libs/$@ ./ + +clean-libs: + rm -f $(LIBS) + +clean-aux: + rm -f $(addsuffix .aux, $(PROJECTNAME)) + rm -f $(addsuffix .log, $(PROJECTNAME)) + +clean-tex: + rm -f $(PDFS) + +clean: clean-libs clean-aux clean-tex diff --git a/figs/shapes.fig/P_pentomino.tikz.tex b/figs/shapes.fig/P_pentomino.tikz.tex new file mode 100644 index 0000000..9ef3990 --- /dev/null +++ b/figs/shapes.fig/P_pentomino.tikz.tex @@ -0,0 +1,11 @@ +\documentclass{standalone} + +\usepackage{tikz} +\usepackage{shapes} + +\begin{document} +\begin{tikzpicture} +\grid34{(-1,-2)} +\Ppentomino{teal}{(0,0)} +\end{tikzpicture} +\end{document} diff --git a/figs/shapes.fig/T_tetromino.tikz.tex b/figs/shapes.fig/T_tetromino.tikz.tex new file mode 100644 index 0000000..087e809 --- /dev/null +++ b/figs/shapes.fig/T_tetromino.tikz.tex @@ -0,0 +1,11 @@ +\documentclass{standalone} + +\usepackage{tikz} +\usepackage{shapes} + +\begin{document} +\begin{tikzpicture} +\grid34{(-1,-2)} +\Ttetromino{teal}{(0,0)} +\end{tikzpicture} +\end{document} diff --git a/figs/shapes.fig/V_triomino.tikz.tex b/figs/shapes.fig/V_triomino.tikz.tex new file mode 100644 index 0000000..ba07c5f --- /dev/null +++ b/figs/shapes.fig/V_triomino.tikz.tex @@ -0,0 +1,11 @@ +\documentclass{standalone} + +\usepackage{tikz} +\usepackage{shapes} + +\begin{document} +\begin{tikzpicture} +\grid33{(-1,-1)} +\Vtriomino{teal}{(0,0)} +\end{tikzpicture} +\end{document} diff --git a/figs/shapes.fig/cross.tikz.tex b/figs/shapes.fig/cross.tikz.tex new file mode 100644 index 0000000..ef5f391 --- /dev/null +++ b/figs/shapes.fig/cross.tikz.tex @@ -0,0 +1,11 @@ +\documentclass{standalone} + +\usepackage{tikz} +\usepackage{shapes} + +\begin{document} +\begin{tikzpicture} +\grid44{(-2,-2)} +\cross{teal}{(0,0)} +\end{tikzpicture} +\end{document} diff --git a/figs/shapes.fig/diamond.tikz.tex b/figs/shapes.fig/diamond.tikz.tex new file mode 100644 index 0000000..6d9eaa4 --- /dev/null +++ b/figs/shapes.fig/diamond.tikz.tex @@ -0,0 +1,11 @@ +\documentclass{standalone} + +\usepackage{tikz} +\usepackage{shapes} + +\begin{document} +\begin{tikzpicture} +\grid44{(-2,-2)} +\diamond{teal}{(0,0)} +\end{tikzpicture} +\end{document} diff --git a/figs/shapes.fig/hexagon.tikz.tex b/figs/shapes.fig/hexagon.tikz.tex new file mode 100644 index 0000000..a23b7dc --- /dev/null +++ b/figs/shapes.fig/hexagon.tikz.tex @@ -0,0 +1,37 @@ +\documentclass{standalone} + +\usepackage{tikz} +\usepackage{shapes} + +\begin{document} +\begin{tikzpicture} + +\draw(0,0)--++(2,0); +\draw(120:1)--++(3,0); +\draw(120:2)--++(4,0); +\draw(120:2)++(60:1)--++(3,0); +\draw(120:2)++(60:2)--++(2,0); + +\draw(0,0)--++(60:4); +\draw(1,0)--++(60:3); +\draw(2,0)--++(60:2); +\draw(120:1)--++(60:3); +\draw(120:2)--++(60:2); + +\draw(0,0)--++(120:2); +\draw(1,0)--++(120:3); +\draw(2,0)--++(120:4); +\draw(2,0)++(60:1)--++(120:3); +\draw(2,0)++(60:2)--++(120:2); + +\fill[color=teal](60:1)--++(0:1)--++(60:1)--++(120:1)--++(180:1)--++(240:1)--++(300:1)--cycle; + +\draw[color=white](60:1)--++(60:2); +\draw[color=white](60:1)++(1,0)--++(120:2); +\draw[color=white](60:1)++(120:1)--++(2,0); + +\draw(60:1)--++(0:1)--++(60:1)--++(120:1)--++(180:1)--++(240:1)--++(300:1)--cycle; + + +\end{tikzpicture} +\end{document} diff --git a/figs/shapes.fig/libs/shapes.sty b/figs/shapes.fig/libs/shapes.sty new file mode 120000 index 0000000..eaa25c7 --- /dev/null +++ b/figs/shapes.fig/libs/shapes.sty @@ -0,0 +1 @@ +../../libs/shapes.sty
\ No newline at end of file diff --git a/libs/ian-presentation.cls b/libs/ian-presentation.cls new file mode 100644 index 0000000..91bd487 --- /dev/null +++ b/libs/ian-presentation.cls @@ -0,0 +1,187 @@ +%% +%% Ian's presentation class +%% + +%% TeX format +\NeedsTeXFormat{LaTeX2e}[1995/12/01] + +%% class name +\ProvidesClass{ian-presentation}[2017/09/29] + +\def\ian@defaultoptions{ + \pagestyle{plain} + \RequirePackage{color} + \RequirePackage{amssymb} +} + +%% paper dimensions +\setlength\paperheight{240pt} +\setlength\paperwidth{427pt} + +%% fonts +\input{size11.clo} +\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm} +\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf} +\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt} +\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf} +\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit} + +%% text dimensions +\textheight=208pt +\textwidth=370pt +\hoffset=-1in +\voffset=-1in +\oddsidemargin=24pt +\evensidemargin=24pt +\topmargin=8pt +\headheight=0pt +\headsep=0pt +\marginparsep=0pt +\marginparwidth=0pt +\footskip=16pt + + +%% remove default skips +\parindent=0pt +\parskip=0pt +\baselineskip=0pt + +%% something is wrong with \thepage, redefine it +\gdef\thepage{\the\c@page} + +%% correct vertical alignment at the end of a document +\AtEndDocument{ + % save total slide count + \immediate\write\@auxout{\noexpand\gdef\noexpand\slidecount{\thepage}} + \vfill + \eject +} + + +%% footer +\def\ps@plain{ + \def\@oddhead{} + \def\@evenhead{\@oddhead} + \def\@oddfoot{\tiny\hfill\thepage/\safe\slidecount\hfill} + \def\@evenfoot{\@oddfoot} +} +\def\ps@empty{ + \def\@oddhead{} + \def\@evenhead{\@oddhead} + \def\@oddfoot{} + \def\@evenfoot{\@oddfoot} +} + + +%% title of slide +\def\title#1{ + \hfil{\bf\large #1}\par + \hfil\vrule width0.75\textwidth height0.3pt\par + \vskip5pt +} + + +%% hyperlinks +% hyperlinkcounter +\newcounter{lncount} +% hyperref anchor +\def\hrefanchor{% +\stepcounter{lncount}% +\hypertarget{ln.\thelncount}{}% +} + +%% define a command and write it to aux file +\def\outdef#1#2{% + % define command% + \expandafter\xdef\csname #1\endcsname{#2}% + % hyperlink number% + \expandafter\xdef\csname #1@hl\endcsname{\thelncount}% + % write command to aux% + \immediate\write\@auxout{\noexpand\expandafter\noexpand\gdef\noexpand\csname #1\endcsname{\csname #1\endcsname}}% + \immediate\write\@auxout{\noexpand\expandafter\noexpand\gdef\noexpand\csname #1@hl\endcsname{\thelncount}}% +} + +%% can call commands even when they are not defined +\def\safe#1{% + \ifdefined#1% + #1% + \else% + {\color{red}\bf?}% + \fi% +} + + +%% itemize +\newlength\itemizeskip +% left margin for items +\setlength\itemizeskip{20pt} +\newlength\itemizeseparator +% space between the item symbol and the text +\setlength\itemizeseparator{5pt} +% penalty preceding an itemize +\def\itemizepenalty{0} +% counter counting the itemize level +\newcounter{itemizecount} + +% item symbol +\def\itemizept#1{ + \ifnum#1=1 + \textbullet + \else + $\scriptstyle\blacktriangleright$ + \fi +} + +\newlength\current@itemizeskip +\setlength\current@itemizeskip{0pt} +\def\itemize{ + \par\penalty\itemizepenalty\medskip\penalty\itemizepenalty + \addtocounter{itemizecount}{1} + \addtolength\current@itemizeskip{\itemizeskip} + \leftskip\current@itemizeskip +} +\def\enditemize{ + \addtocounter{itemizecount}{-1} + \addtolength\current@itemizeskip{-\itemizeskip} + \par\leftskip\current@itemizeskip + \medskip +} +\newlength\itempt@total +\def\item{ + \settowidth\itempt@total{\itemizept\theitemizecount} + \addtolength\itempt@total{\itemizeseparator} + \par + \medskip + \hskip-\itempt@total\itemizept\theitemizecount\hskip\itemizeseparator +} + +%% enumerate +\newcounter{enumerate@count} +\def\enumerate{ + \setcounter{enumerate@count}0 + \let\olditem\item + \let\olditemizept\itemizept + \def\item{ + % counter + \stepcounter{enumerate@count} + % set header + \def\itemizept{\theenumerate@count.} + % hyperref anchor + \hrefanchor + % define tag (for \label) + \xdef\tag{\theenumerate@count} + \olditem + } + \itemize +} +\def\endenumerate{ + \enditemize + \let\item\olditem + \let\itemizept\olditemizept +} + + +%% end +\ian@defaultoptions + +\endinput |