diff --git a/examples/code_snippet/hello.ipynb b/examples/code_snippet/hello.ipynb new file mode 100644 index 0000000..fb5a15f --- /dev/null +++ b/examples/code_snippet/hello.ipynb @@ -0,0 +1,533 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "autoscroll": false, + "ein.hycell": false, + "ein.tags": "worksheet-0", + "slideshow": { + "slide_type": "skip" + } + }, + "outputs": [], + "source": [ + "from Slides.snippet_helper import Snippet, SnippetCollection\n", + "Snippet.default_output='html'\n", + "# Snippet.default_line_numbering=True" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "autoscroll": false, + "ein.hycell": false, + "ein.tags": "worksheet-0", + "slideshow": { + "slide_type": "skip" + } + }, + "outputs": [], + "source": [ + "snippet = Snippet(r\"\"\"\n", + "#include \n", + "#include \n", + "\n", + "int main(int argc, char *argv[]){\n", + " int size, rank;\n", + " MPI_Init(&argc, &argv);\n", + " MPI_Comm_size(MPI_COMM_WORLD, &size);\n", + " MPI_Comm_rank(MPI_COMM_WORLD, &rank);\n", + "\n", + " printf(\"I’m process %d out of %d\\n\", rank, size);\n", + " MPI_Finalize();\n", + "}\n", + "\"\"\", compile_flag=True, format_flag=True,\n", + "include_paths=['/usr/lib/x86_64-linux-gnu/openmpi/include']\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "autoscroll": false, + "ein.hycell": false, + "ein.tags": "worksheet-0", + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
#include <mpi.h>\n",
+       "#include <stdio.h>\n",
+       "\n",
+       "int main(int argc, char *argv[]) {\n",
+       "  int size, rank;\n",
+       "  MPI_Init(&argc, &argv);\n",
+       "  MPI_Comm_size(MPI_COMM_WORLD, &size);\n",
+       "  MPI_Comm_rank(MPI_COMM_WORLD, &rank);\n",
+       "\n",
+       "  printf("I’m process %d out of %d\\n", rank, size);\n",
+       "  MPI_Finalize();\n",
+       "}\n",
+       "
\n", + "\n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "snippet.pigment()" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "autoscroll": false, + "ein.hycell": false, + "ein.tags": "worksheet-0", + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
 1\n",
+       " 2\n",
+       " 3\n",
+       " 4\n",
+       " 5\n",
+       " 6\n",
+       " 7\n",
+       " 8\n",
+       " 9\n",
+       "10\n",
+       "11\n",
+       "12
#include <mpi.h>\n",
+       "#include <stdio.h>\n",
+       "\n",
+       "int main(int argc, char *argv[]) {\n",
+       "  int size, rank;\n",
+       "  MPI_Init(&argc, &argv);\n",
+       "  MPI_Comm_size(MPI_COMM_WORLD, &size);\n",
+       "  MPI_Comm_rank(MPI_COMM_WORLD, &rank);\n",
+       "\n",
+       "  printf("I’m process %d out of %d\\n", rank, size);\n",
+       "  MPI_Finalize();\n",
+       "}\n",
+       "
\n", + "
\n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "snippet.pigment(line_numbering=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "autoscroll": false, + "ein.hycell": false, + "ein.tags": "worksheet-0", + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
  int size, rank;\n",
+       "  MPI_Init(&argc, &argv);\n",
+       "  MPI_Comm_size(MPI_COMM_WORLD, &size);\n",
+       "  MPI_Comm_rank(MPI_COMM_WORLD, &rank);\n",
+       "\n",
+       "  printf("I’m process %d out of %d\\n", rank, size);\n",
+       "  MPI_Finalize();\n",
+       "
\n", + "\n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "snippet[5:11].pigment()" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "autoscroll": false, + "ein.hycell": false, + "ein.tags": "worksheet-0", + "slideshow": { + "slide_type": "slide" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
  int size, rank;\n",
+       "  MPI_Init(&argc, &argv);\n",
+       "  MPI_Comm_size(MPI_COMM_WORLD, &size);\n",
+       "  MPI_Comm_rank(MPI_COMM_WORLD, &rank);\n",
+       "\n",
+       "  printf("I’m process %d out of %d\\n", rank, size);\n",
+       "  MPI_Finalize();\n",
+       "
\n", + "\n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "snippet[5:11].pigment(keyword='MPI')" + ] + } + ], + "metadata": { + "celltoolbar": "Slideshow", + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.2+" + }, + "name": "hello.ipynb" + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/examples/code_snippet/hello.ptex b/examples/code_snippet/hello.ptex new file mode 100644 index 0000000..fb11dd0 --- /dev/null +++ b/examples/code_snippet/hello.ptex @@ -0,0 +1,53 @@ +\documentclass[11pt,xcolor=dvipsnames]{beamer} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{fancyvrb} + +\begin{python}{header} +from Slides.snippet_helper import Snippet, SnippetCollection +Snippet.default_output='latex' +# Snippet.default_line_numbering=True +\end{python} +\py{Snippet.getLatexStyleDefs()} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{document} + +\begin{python}{code} +snippet = Snippet(r""" +#include +#include + +int main(int argc, char *argv[]){ + int size, rank; + MPI_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &size); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + + printf("I’m process %d out of %d\n", rank, size); + MPI_Finalize(); +} +""", compile_flag=True, format_flag=True, +include_paths=['/usr/lib/x86_64-linux-gnu/openmpi/include'] +) +\end{python} + +\begin{frame}[fragile]{Hello} + \py{snippet.pigment()} +\end{frame} + +\begin{frame}[fragile]{Hello} + \py{snippet.pigment(line_numbering=True)} +\end{frame} + +\begin{frame}[fragile]{Hello} + \py{snippet[5:11].pigment()} +\end{frame} + + +\begin{frame}[fragile]{Hello} + \py{snippet[5:11].pigment(keyword='MPI')} +\end{frame} + + +\end{document} \ No newline at end of file diff --git a/examples/test.ipynb b/examples/test.ipynb deleted file mode 100644 index a67a8d7..0000000 --- a/examples/test.ipynb +++ /dev/null @@ -1,415 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "\\documentclass{beamer}\n", - "\n", - "%Load the specific package\n", - "\\usepackage{LSMS/beamerthemeLSMS}\n", - "\n", - "%(Un)comment when using ERC-style\n", - "\\usepackage{multimedia}\n", - "\n", - "\n", - "\\def\\beamer@andinst{\\\\[1em]}\n", - "\n", - "%Set up the front matter (title slide)\n", - "%-> Please note that subtitle and date are ignored\n", - "\\title[LSMS]{3D coupled dislocation dynamics \\\\at nano- and micro-scales}\n", - "%\\author{Jaehyun Cho}\n", - "\\author[shortname]{Jaehyun Cho \\and Guillaume Anciaux \\and Till Junge \\and Hodapp L. Max \\and Jean-Fran\\c{c}ois Molinari \\and William Curtin}\n", - "\n", - "%\\end{center}\n", - "%\\begin{center}\n", - "\n", - "\n", - "\n", - "\n", - "%Set up stuff for nice PDF's\n", - "\\hypersetup{\n", - " pdfkeywords={LSMS; Template},\n", - " pdfstartview=FitH,\n", - " pdffitwindow=true,\n", - " pdfdisplaydoctitle=true\n", - "}\n", - "\n", - "%% % At begin of each section (uncomment if unwanted)\n", - "%% \\AtBeginSection[] {\n", - "%% \\begin{frame}{Outline}\n", - "%% %\\tableofcontents[currentsection,currentsubsection]\n", - "%% \\tableofcontents[currentsection]\n", - "%% \\end{frame}\n", - "%% }\n", - "\n", - "%Start the document\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "\\begin{document}%Set the background of the first slide\n", - "\\SetTitleSlideBackground\n", - "\n", - "%The title slide\n", - "\\begin{frame}\\titlepage\n", - "\\end{frame}\n", - "\n", - "%Set the background for all other slides \n", - "\\SetBaseSlideBackground\n", - "\n", - "%% % The first slide of the presentation\n", - "%% \\begin{frame}\n", - "%% \\frametitle{Outline}\n", - "%% \\tableofcontents\n", - "%% \\end{frame}\n", - "\n", - "%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%\n", - "\\section{Motivation}\n", - "%\\subsection{Size effects in plasticity deformations}\n", - "\\begin{frame}\\frametitle{Size effects in plasticity deformations}\n", - "\\vspace{-0.55cm}\n", - "\\begin{block}{Greer et.al. 2005}%Compression test of micro-pillar}\n", - "\\begin{center}\\includegraphics[width=1.0\\textwidth]{images/sizeeffect}\n", - "\\end{center}\n", - "\\end{block}\n", - "\\pause\n", - "%Sun et. al. Scripta Materialia 65 (2011)\n", - "\\vspace{-0.25cm}\n", - "\\begin{block}{}%Computational tools for dislocation dynamics}\n", - "\\begin{center}\\includegraphics[width=6.5cm]{images/tools0}\n", - "\\end{center}\n", - "\\end{block}\n", - "%% \\begin{itemize}\n", - "%% \\item General picture of material plasticity and its work hardening and solutes hardening\n", - "%% \\item nucleations and dislocation interactions\n", - "%% \\end{itemize}\n", - "%% \\begin{block}{A block with a title}\n", - "%% \\includegraphics[width=10.0cm]{images/sizeeffect}\n", - "%% \\end{block}\n", - "%% \\begin{block}{}\n", - "%% A block with some content but no title\n", - "%% \\end{block}\n", - "\\end{frame}\n", - "\n", - "%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%\n", - "\\section{Dislocation modeling}\n", - "\n", - "\\begin{frame}\\frametitle{Computational tools for dislocation dynamics}\n", - "\\framesubtitle{}%Multi length-scales}\n", - "\\vspace{-0.5cm}\n", - "\\begin{block}{}%Computational tools for dislocation dynamics}\n", - "%\\begin{center}\n", - "\\includegraphics[width=6.3cm]{images/tools0}\n", - "%\\end{center}\n", - "\\end{block}\n", - "\\begin{block}{}\n", - "%\\begin{center}\n", - " \\begin{tabular}{|l |}\\hline\n", - " DD \\\\ \\hline\n", - " Simple representations \\\\ \\hline\n", - " Large domain sizes ($\\mu$m) \\\\ \\hline\n", - " Comparable to experiments \\\\ \\hline\n", - " Long-range elastic fields \\\\ \\hline\n", - " (-) Adhoc approach for nucleation \\\\ \\hline\n", - " \\end{tabular}\n", - "%\\end{center}\n", - "\\end{block}\n", - "\\end{frame}\n", - "\n", - "\\begin{frame}\\frametitle{Computational tools for dislocation dynamics}\n", - "\\framesubtitle{}%Multi length-scales}\n", - "\\vspace{-0.5cm}\n", - "\\begin{block}{}%Computational tools for dislocation dynamics}\n", - "%\\begin{center}\n", - " \\includegraphics[width=9.0cm]{images/tools}\n", - "%\\end{center}\n", - "\\end{block}\n", - "\\begin{block}{}\n", - "\\begin{center}\\begin{tabular}[width=0.5\\textwidth]{|l | l|}\n", - " \\hline\n", - " DD & MD \\\\ \\hline\n", - " Simple representations &Explicit representation \\\\ \\hline\n", - " Large domain sizes ($\\mu$m) &Nonlinear atomistic fields \\\\ \\hline\n", - " Comparable to experiments &Natural nucleation \\\\ \\hline\n", - " Long-range elastic field &(-) Small domain sizes (nm) \\\\ \\hline\n", - " (-) Adhoc approach for nucleation&(-) Boundary conditions \\\\ \\hline\n", - " \\end{tabular}\n", - "\\end{center}\n", - "\\end{block}\n", - "\\end{frame}\n", - "\n", - "%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%\n", - "\\begin{frame}\\frametitle{CADD3D}\n", - "\\framesubtitle{{\\bf C}oupled {\\bf A}tomistic {\\bf D}iscrete {\\bf D}islocation dynamics in {\\bf 3D}}\n", - "\\vspace{-0.5cm}\n", - "\\begin{block}{From 2D to 3D}\\begin{center}\\includegraphics[width=0.5\\textwidth]{images/cadd2d}\n", - " \\pause\n", - " \\includegraphics[width=0.5\\textwidth]{images/cadd3d}\n", - "\\end{center}\n", - "\\end{block}\n", - "Main technique of CADD3D is a treatment of \"Hybrid\" dislocation dynamics. $\\to$ Communication through boundary condition\n", - "\\end{frame}\n", - "\n", - "%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%\n", - "\\section{Coupling strategy}\n", - "\\begin{frame}\\frametitle{Reciprocal boundary condition}\n", - "%\\framesubtitle{Multi-scale modeling}\n", - "\\begin{block}{Communications between MD and DD}\\begin{center}\\includegraphics[width=8.0cm]{images/domains}\n", - "\\end{center}\n", - "\\end{block}\n", - "\\end{frame}\n", - "\n", - "\\begin{frame}\\frametitle{Application of the BC during dynamics}\n", - "\\framesubtitle{Periodic update of the BCs}\n", - "\\vspace{-0.4cm}\n", - "\\begin{block}{}%Periodic update of the BCs}\n", - "\\begin{center}\\includegraphics[width=0.35\\textwidth]{images/staggered0}\n", - " \\includegraphics[width=0.35\\textwidth]{images/staggered1}\n", - " \\pause\n", - " \\vspace{-0.01cm}\n", - " \\includegraphics[width=0.35\\textwidth]{images/staggered2}\n", - " \\pause\n", - " \\includegraphics[width=0.35\\textwidth]{images/staggered3}\n", - "\\end{center}\n", - "%\\end{block}\n", - "\\vspace{-0.5cm}\n", - "\\begin{itemize}\\item Detection: DXA (Stukowski et.al.2012) \\& Centro symmetry\n", - "\\item Displacement of pad atoms: Linear elasticity \\& Pre-computed core structures\n", - "\\item DD dislocation dynamics: Exact mobility law compared to MD dislocations\n", - "\\end{itemize}\n", - "\\end{block}\n", - "\\end{frame}\n", - "\n", - "\n", - "%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%\n", - "\\begin{frame}\\frametitle{Pre-computed core structures}\n", - "\\framesubtitle{J.Cho, T.Junge, JF.Molinari, G.Anciaux, AMSES 2016}\n", - "\\vspace{-0.5cm}\n", - "\\begin{block}{Core structure template of an arbitrary character angle}\\begin{center}\\includegraphics[width=7.0cm]{images/core_template_view}\n", - "\\end{center}\n", - "\\vspace{-0.2cm}\n", - "\\pause\n", - "\\begin{itemize}\\item Total 8 character angles $\\theta$ were considered ($0^{\\circ}\\leq\\theta\\leq90^{\\circ}$).\n", - "\\item The obtained core structures are validated by analytic model (Peiers-Nabarro method).\n", - "\\item The core displacements are stored in template forms.\n", - "\\end{itemize}\n", - "\\end{block}\n", - "\\end{frame}\n", - "\n", - "\\begin{frame}\\frametitle{Mobility law}\n", - "\\framesubtitle{manuscript is about to be submitted.}\n", - "\\vspace{-0.5cm}\n", - "\\begin{block}{Mobility law with several characters and temperatures}\\begin{center}\\includegraphics[width=7.0cm]{images/mobility_view}\n", - "\\end{center}\n", - "\\vspace{-0.4cm}\n", - "\\pause\n", - "\\begin{itemize}\\item The various character angles $\\theta$ and temperatures (1,100,200 and 300K) were considered.\n", - "\\item The mobility law describing gliding and acceleration motions was constructed.\n", - "\\item The mobility law was implemented in DD engine (ParaDis).\n", - "\\end{itemize}\n", - "\\end{block}\n", - "\\end{frame}\n", - "\n", - "\\begin{frame}\\frametitle{Simulation engines}\n", - "%\\framesubtitle{Multi-scale modeling}\n", - "\\vspace{-0.3cm}\n", - "\\begin{center}\\includegraphics[width=5.0cm]{images/architect}\n", - "\\end{center}\n", - "\\begin{itemize}\\item The three (open-sources) codes communicate with each other in LibMultiScale (open-source) developed by Dr. Anciaux.\n", - "\\item MD-DD coupling codes are parallelized using MPI.\n", - "%\\item Currently, DD and FE are not coupled yet.\n", - "\\end{itemize}\n", - "\\end{frame}\n", - "\n", - "%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%\n", - "\\section{Test problems}\n", - "\\begin{frame}\\frametitle{Test1: Hybrid straight dislocations}\n", - "\\vspace{-0.4cm}\n", - "\\begin{block}{Modeling}\\begin{center}\\includegraphics[width=10.0cm]{images/modelingstraight}\n", - "\\end{center}\n", - "\\vspace{-0.4cm}\n", - "\\begin{itemize}\\item The various character angles $\\theta$ are considered.\n", - "\\item Several shear stresses $100MPa\\leq\\sigma\\leq1000MPa$ are applied in Burgers vector $\\vec{b}$ direction on DD domain.\n", - "\\item The corresponding strains $\\epsilon$ are applied on MD atoms, and updated every coupling step.\n", - "\\end{itemize}\n", - "\\end{block}\n", - "\\end{frame}\n", - "\n", - "\\begin{frame}\\frametitle{Simulation result}\n", - "\\framesubtitle{Mixed (30$^{\\circ}$) dislocation with 100MPa}\n", - "\\vspace{-0.5cm}\n", - "\\begin{block}{Perspective view of MD and DD dislocations}\\begin{center}\\movie[width=8cm,loop=true] {\n", - " \\includegraphics[width=8cm]{videos/straight150N100MPa.jpg}\n", - "}{videos/straight150N100MPa.avi}\n", - "\\end{center}\n", - "\\end{block}\n", - "\\end{frame}\n", - "\n", - "\\begin{frame}\\frametitle{Simulation result}\n", - "\\framesubtitle{Evolution of displacement and velocity}\n", - "\\vspace{-0.5cm}\n", - "\\begin{block}{}%Displacement and velocPerspective view of MD and DD dislocations}\n", - "\\begin{center}\\includegraphics[width=8.0cm]{images/pic0_A150.pdf}\n", - "\\end{center}\n", - "\\end{block}\n", - "All the cases, the character angles (0$^{\\circ}\\leq \\theta \\leq 90^{\\circ}$) and shear loading (100MPa $\\leq \\sigma \\leq$ 1000MPa), are successfully tested.\n", - "\\end{frame}\n", - "\n", - "\\begin{frame}\\frametitle{Simulation result}\n", - "\\framesubtitle{Details matter}\n", - "\\begin{block}{}%Displacement and velocPerspective view of MD and DD dislocations}\n", - "\\begin{center}\\includegraphics[width=10.0cm]{images/Result2.pdf}\n", - "\\end{center}\n", - "\\end{block}\n", - "\\vspace{0.5cm}\n", - "All the parameters (core templates, mobility law and frequencies of updates) have to be correctly defined.\n", - "\\end{frame}\n", - "\n", - "\n", - "\n", - "\\begin{frame}\\vspace{-0.4cm}\n", - "\\frametitle{Test2: Hybrid dislocation loop}\n", - "\\begin{block}{Modeling}\\begin{center}\\includegraphics[width=0.7\\textwidth]{images/modelingloop}\n", - "\\end{center}\n", - "\\vspace{-0.3cm}\n", - "\\begin{itemize}\\item Along the $\\Gamma_1$ and $\\Gamma_2$, mainly edge and screw dislocation core templates are applied, respectively.\n", - "\\item At $\\Gamma_3$ and $\\Gamma_4$, arbitrary character angles cross $\\to$ interpolations between two core templates.\n", - "\\end{itemize}\n", - "\n", - "\\end{block}\n", - "\\end{frame}\n", - "\n", - "\\begin{frame}\\frametitle{Simulation result}\n", - "\\framesubtitle{Shear stress 500MPa}\n", - "\\vspace{-0.3cm}\n", - "\\begin{block}{Displacement in Burgers and Dislocations of MD and DD}\\begin{center}\\movie[width=10cm,loop=true] {\n", - " \\includegraphics[width=10cm]{videos/loop500MPaPartialDetection.jpg}\n", - "}{videos/loop500MPaPartialDetection.avi}\n", - "\\end{center}\n", - "\\end{block}\n", - "\\end{frame}\n", - "\n", - "%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%\n", - "\\section{Application: Frank-Read source in Al-Mg alloy}\n", - "\n", - "\\begin{frame}\\frametitle{Alloy design}\n", - "\\vspace{-0.5cm}\n", - "\\begin{block}{Multi-length-scales problem}%% \\begin{center}\n", - "%% \\includegraphics[width=1.0\\textwidth]{images/dislocation}\n", - "%% \\end{center}\n", - "%% \\begin{center}\n", - "%% \\begin{tabular}{|l|l|}\n", - "%% \\hline\n", - "%% Type &Length scales of main mechanics\\\\ \\hline\n", - "%% Work hardening &Micro scale\\\\\n", - "%% Grain boundary hardening &Nano \\& Micro scales\\\\ \n", - "%% Solid solution hardening &Nano \\& Micro scales\\\\\\hline\n", - "%% \\end{tabular}\n", - "%% \\end{center}\n", - "\\begin{center}\\includegraphics[width=0.7\\textwidth]{images/hardening0}\n", - "\\end{center}\n", - "\\vspace{-0.2cm}\n", - "\\begin{itemize}\\item Perturbation of (slow) dislocation motions due to solutes\n", - "\\item Elastic interactions in dislocation forest\n", - "\\item Dislocation nucleation processes\n", - "%\\item Obstructions at grain-boundary: DD-FE coupling is needed.\n", - "\\end{itemize}\n", - "%Long-range elastic fields and non-linear atomistic force fields should be considered in micro and nano scales, respectively.\n", - "\\end{block}\n", - "\\end{frame}\n", - "\n", - "\\begin{frame}\\frametitle{Frank-Read source in Al-5\\%Mg alloy}\n", - "\\vspace{-0.4cm}\n", - "\\begin{block}{Modeling}\\begin{center}\\includegraphics[width=8.0cm]{images/modelingfrsource}\n", - "\\end{center}\n", - "\\vspace{-0.5cm}\n", - "\\begin{itemize}\\item Nucleation source: double Frank-Read source\n", - "\\item 5\\% Magnesium solutes are randomly distributed in MD.\n", - "\\item Total 700K atoms in MD domain.\n", - "%\\item FiTotal 700$\\cdot$10E+3 atoms are emplyed in MD domain.\n", - "\\end{itemize}\n", - "\\end{block}\n", - "\\end{frame}\n", - "\n", - "\\begin{frame}\\frametitle{Simulation result (on-going)}\n", - "\\framesubtitle{Shear stress 700MPa}\n", - "\\vspace{-0.4cm}\n", - "\\begin{block}{MD and DD dislocations in perspective and top views}\\begin{center}\\movie[width=10cm,loop=true] {\n", - " \\includegraphics[width=10cm]{videos/images0001.jpg}\n", - "}{videos/images.avi}\n", - "\\end{center}\n", - "\\end{block}\n", - "\\end{frame}\n", - "\n", - "\n", - "%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%\n", - "\\section{Conclusions}\n", - "\\begin{frame}\\frametitle{Conclusions}\n", - "\\begin{block}{Highlights of CADD3D}\\begin{itemize}\\item Unique capability to handle dislocation dynamics coupled between MD and DD\n", - "\\item Natural dislocation nucleation in DD\n", - "%\\item Dislocation dynamic problems, which start from MD, comparable to experiments \n", - "\\item MD dislocation dynamics without influences of image dislocations through periodic boundary conditions\n", - "\\end{itemize}\n", - "\\end{block}\n", - "\\begin{block}{Outlook}\\begin{itemize}\\item Immediate possible problems: crack tips \\& single-arm Frank-Read sources\n", - "\\item New developments: Coupling DD+MD allows to study exciting problems in a field of material science (e.g., indentation)\n", - "\\end{itemize}\n", - "\\end{block}\n", - "\\end{frame}\n", - "\n", - "\\begin{frame}\\frametitle{Schematic modeling of micro indentation}\n", - "\\begin{center}\\includegraphics[width=10.0cm]{images/indetation}\n", - "\\end{center}\n", - "\\end{frame}\n", - "\n", - "%Close the document\n", - "\\end{document}\n" - ] - } - ], - "metadata": { - "hide_input": false, - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.13" - }, - "toc": { - "colors": { - "hover_highlight": "#DAA520", - "running_highlight": "#FF0000", - "selected_highlight": "#FFD700" - }, - "moveMenuLeft": true, - "nav_menu": { - "height": "12px", - "width": "252px" - }, - "navigate_menu": true, - "number_sections": true, - "sideBar": true, - "threshold": 4, - "toc_cell": false, - "toc_section_display": "block", - "toc_window_display": false, - "widenNotebook": false - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/examples/test.ptex b/examples/test.ptex deleted file mode 100644 index ffa10d5..0000000 --- a/examples/test.ptex +++ /dev/null @@ -1,19 +0,0 @@ -\documentclass[9pt]{beamer} - -\begin{python}{header} -import os -\end{python} - - -\title{Test of ptex format} -\begin{document} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\maketitle -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\begin{frame}{Test} - \py{os.getcwd()} -\end{frame} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\end{document} diff --git a/scripts/slides b/scripts/slides index 9866465..f2c5261 100755 --- a/scripts/slides +++ b/scripts/slides @@ -1,109 +1,109 @@ #!/usr/bin/python3 """ This executable permits to generate an advanced presentation from a Jupyter notebook. The capabilities are: - a server of reveal content - a pptx (under developement) - a beamer tex file (TODO) """ ################################################################ import argparse import os import Slides.count_slides as count_slides import Slides.cell_manager as cell_manager ################################################################ def getNotebookFilenames(slides_file): """ When a directory is provided to the executable, a file named 'slides' is searched for with the expected list of ipython notebooks. The list of notebooks to consider is then returned. """ if not os.path.isfile(slides_file): raise Exception("Cannot find slides file") f = open(slides_file) - slides = [l.strip() for l in f.readlines() if l != ""] + slides = [_l.strip() for _l in f.readlines() if _l != ""] return slides ################################################################ def main(): parser = argparse.ArgumentParser(description='Slide launcher') parser.add_argument( "--execute", action='store_true', help=('Requests to execute all the notebooks launching ' 'the slides server')) parser.add_argument("--no_count", action='store_false', help="Requests not to count slides generated") parser.add_argument("notebooks", nargs='*', help="The notebooks to associate in a presentation") parser.add_argument( "--internet", action='store_true', help="Weather the http server should serve on the internet") parser.add_argument("--html", action='store_true', help="only produce a html file") parser.add_argument("--beamer", action='store_true', help="produce a beamer/latex file and the pdf") parser.add_argument("--add_cell_number", action='store_true', help="add the cell number before each cell") parser.add_argument("--select_cells", type=int, nargs='*', help="Provides a list of cells to select") parser.add_argument("--font_size", type=str, default='25px', help="Provides the font size of the presentation") arguments = parser.parse_args() if len(arguments.notebooks) == 1: if os.path.isdir(arguments.notebooks[0]): slides_path = arguments.notebooks[0] slides_file = os.path.join(slides_path, 'slides') arguments.notebooks = getNotebookFilenames(slides_file) else: _file = arguments.notebooks[0] f, ext = os.path.splitext(_file) if ext == '.sld': arguments.notebooks = getNotebookFilenames(_file) if arguments.execute: for n in arguments.notebooks: cell_manager.executeNotebook(n) try: cell_manager.mergeNotebooks(arguments.notebooks, add_cell_number=arguments.add_cell_number, select_cells=arguments.select_cells) except cell_manager.NotFoundNotebooks: print('Could not find the notebooks to treat: check path provided') return if arguments.no_count: nb_slides = count_slides.countSlides(['talk.ipynb']) print("*" * 20) print("You generated a talk with {0} slides".format(nb_slides)) print("*" * 20) if arguments.html: cell_manager.generateHTML(font_size=arguments.font_size) elif arguments.beamer: cell_manager.generateBeamer(font_size=arguments.font_size) elif arguments.internet: cell_manager.launchSlideServer(options="--ServePostProcessor.ip='*'", font_size=arguments.font_size) else: cell_manager.launchSlideServer(font_size=arguments.font_size) ################################################################ if __name__ == "__main__": main()