Simulation Methods in Physics I WS 2016/2017
Overview
 Type
 Lecture (2 SWS) and Tutorials (2 SWS)
 Lecturer
 Prof. Dr. Christian Holm
 Course language
 English
 Location and Time
 Lecture: Thu, 14:00  15:30; ICP, Allmandring 3, Seminar Room (room 01.079)
 Tutorials: tba.
 Prerequisites
 We expect the participants to have basic knowledge in classical and statistical mechanics, thermodynamics, and partial differential equations, as well as knowledge of a programming language (Python and C).
The lecture is accompanied by handson tutorials which will take place in the CIPPool of the ICP, Allmandring 3 (room 01.033). They consist of practical exercises at the computer such as small programming tasks, simulations, visualization and data analysis. The tutorials build upon each other, therefore continuous attendance is expected.
Lecture
Scope
The first part of the course intends to give an overview about modern simulation methods used in physics today. The focus of the lecture will be to introduce different approaches to simulating a problem, hence we will not go too to deep into specific details but rather try to cover a broad range of methods. In more detail, the lecture will consist of:
 Molecular Dynamics
 The first problem that comes to mind when thinking about simulating physics is solving Newtons equations of motion for particles with given interactions. From that perspective, we first introduce the most common numerical integrators. This approach quickly leads us to Molecular Dynamics (MD) simulations. Many of the complex problems of practical importance require us to take a closer look at statistical properties, ensembles and the macroscopic observables.
 The goal is to be able to set up and run real MD simulations for different ensembles and understand and interpret the output.
 Error Analysis
 Autocorrelation, Jackknifing, Bootstrapping
 Monte Carlo Simulations
 Since their invention, the importance of Monte Carlo (MC) sampling has grown constantly. Nowadays it is applied to a wide class of problems in modern computational physics. We want to present the general idea and theory behind MC simulations and show some more properties using simple toy models such as the Ising model.
 Critical exponents
 Finitesize scaling, universality concept, how to determine critical exponent with lattice spin models
Course Material
Date  Subject  Resources  Remarks 

20161020  Course Content, Organization, Introduction  
20161027  MD: Integrators  
20161103  Basics of Statistical Mechanics  
20161110  MD: Potentials, Units  
20161117  MD  continued  
20161124  PBC, celllists, Observables  
20161201  RDF, D, Brownian motion  
20161208  GreenKubo, Langevin Dynamics, Thermostats  
20161215  Error Analysis  
20161222  B.Sc. / M.Sc. thesis @ ICP: information & research topics  Slides  
20170112  Thermostats, Barostats  
20170119  MonteCarlo Method  
20170126  MonteCarlo and Critical Phenomena  
20170202  Finite Size Scaling  
20170209  Binder Parameters 
Script
A preliminary version of the script can be downloaded here (929 kB).
If you find any kind of mistake / error / typo / bad formatting / etc. in the script (you surely will!), please send an email to Johannes Zeman.
Recommended literature

Daan Frenkel and Berend Smit.
"Understanding Molecular Simulation".
Academic Press, San Diego, 2002.
[DOI] 
Mike P. Allen and Dominik J. Tildesley.
"Computer Simulation of Liquids".
Oxford Science Publications, Clarendon Press, Oxford, 1987.

D. C. Rapaport.
"The Art of Molecular Dynamics Simulation".
Cambridge University Press, 2004.

D. P. Landau and K. Binder.
"A guide to Monte Carlo Simulations in Statistical Physics".
Cambridge, 2005.

M. E. J. Newman and G. T. Barkema.
"Monte Carlo Methods in Statistical Physics".
Oxford University Press, 1999.
Useful online resources
 Thermostats: Philippe H. Hünenberger, Thermostat Algorithms for Molecular Dynamics Simulations, Adv. Polym. Sci. (2005) 173:105–149.
 Error analysis: W. Janke, Statistical Analysis of Simulations:Data Correlations and Error Estimation, Quantum Simulations of Complex ManyBody Systems:
From Theory to Algorithms, Lecture Notes, (2002).
 Be careful when using Wikipedia as a resource. It may contain a lot of useful information, but also a lot of nonsense, because anyone can write it.
Tutorials
Location and Time
 The tutorials take place in the CIPPool on the first floor of the ICP (Room 01.033, Allmandring 3) on
 Thursday 11:3013:00 (Tutor: Michael Kuron)
 Friday 14:0015:30 (Tutor: Florian Weik)
 Michael Kuron's tutorial on 20170126 is cancelled. His tutorial on 20170209 is moved to 20170220 at 10:30.
Worksheets
Topic  Deadline  Worksheet  Further Resources 

0. First steps with Linux, Python, and C  no submission required  Worksheet 0 (269 KB)  PythonTutorial.ipynb (33 KB) (nbviewer), NumPyTutorial.ipynb (120 KB) (nbviewer). 
1. Integrators  20161114 12:00  Worksheet 1 (288 KB)  solar_system.pkl.gz (496 bytes) cannonball_template.png (70 KB)

2. Statistical mechanics and Molecular Dynamics  20161128 12:00  Worksheet 2 (333 KB)  Templates.tar.gz (6 KB) Cython Introduction (398 KB)

3. Molecular Dynamics and Observables  20161212 12:00  Worksheet 3 (326 KB)  templates.tar.gz (4 KB)

4. Error Analysis, Langevin Thermostat  20170109 12:00  Worksheet 4 (233 KB)  templates.tar.gz (8.63 MB)

5. Other Thermostats, MonteCarlo  extended: 20170130 12:00  Worksheet 5 (223 KB) 

6. Ising Model and Finite Size Scaling  20170206 12:00  Worksheet 6 (226 KB)  templates.tar.gz (4 KB) 
General Remarks
 For the tutorials, you will get a personal account for the ICP machines.
 For the reports, we have a nice latextemplate.tex (7 KB).
 You can do the exercises in the CIPPool when it is not occupied by another course. The pool is accessible on all days, except weekends and late evenings.
 If you do the exercises in the CIPPool, all required software and tools are available.
 If you want to do the exercises on your own computer, the following tools are required. All of these packages should be readily available from your OS distribution, if it is not Windows.
 Python
 The following Python packages:
 IPython
 NumPy
 SciPy
 matplotlib
 A C compiler (e.g. GCC)
 We only have experience with Unix/Linux machines. Although most tools will probably also work on Windows, we cannot guarantee it, and we can also not help you to get it running there.
Handinexercises
 The worksheets are to be solved in groups of two or three people. We will not accept handinexercises that only have a single name on it.
 A written report (between 5 and 10 pages) has to be handed in for each worksheet. We recommend using LaTeX to prepare the report.
 You have two weeks to prepare the report for each worksheet.
 The report has to be sent to your tutor via email.
 Most participants need 50% of the points in the handsin exercises to be admitted to the oral examination (see Examination for details).
What happens in a tutorial
 The tutorials take place every week.
 The new worksheet will be available for download on the days before the tutorial.
 In the first tutorial after you received a worksheet, the solutions of the previous worksheet will be presented (see below) and the new worksheet will be discussed.
 In the second tutorial after you received the worksheet, there is time to work on the exercises and to ask questions.
 You will have to hand in the reports on Monday after the second tutorial.
 In the third tutorial after you received the worksheet, the solutions will be discussed:
 The tutor will ask a team to present their solution.
 The tutor will choose one of the members of the team to present each task.
 This means that each team member should be able to present any task.
 At the end of the term, everybody should have presented at least once.
Documentation
Linux
 Linux Cheat Sheet (2.27 MB) (source (42 KB))  the most important linux commands on a single page
Python
 Use the existing documentation of Python itself! To get help on the command
print
, use
pydoc print
 Or use the Web browser to read it. Start
pydoc p 4242
 and visit the page http://localhost:4242
 http://python.org/doc/  the official Python documentation (including tutorials etc.)
 Byte_of_Python.pdf (546 KB)  the free eBook "A byte of Python" [1], also available in German[2]
NumPy
 first of all, try to use
pydoc numpy
 http://numpy.scipy.org/  the homepage of NumPy contains a lot of documentation
 Script of the lecture "Physik auf dem Computer" (German) (3.42 MB)  Numerics in Python using Numpy
LaTeX
Running Python on your own computer
If you want to solve the problems on your own computer, you need to install Python along with a few extensions. This works differently depending on your operating system.
Debian und Ubuntu Linux
sudo aptget update sudo aptget install python pythonnumpy pythonscipy \ pythonmatplotlib ipython ipythonnotebook gcc g++ \ cython mkdir p ~/.config/matplotlib echo 'backend: TkAgg' > ~/.config/matplotlib/matplotlibrc
OpenSUSE Linux
sudo zypper install python pythonnumpy pythonscipy \ pythonmatplotlib IPython gcc pythonCython mkdir p ~/.config/matplotlib echo 'backend: TkAgg' > ~/.config/matplotlib/matplotlibrc
Mac OS X
First, install the C compiler:
xcodeselect install xcodebuild license accept
Now download and install MacPorts. Next, you can install the Python packages.
sudo port selfupdate sudo port install python27 py27numpy py27scipy \ py27matplotlib py27ipython py27jupyter py27cython sudo port select python python27 sudo port select ipython py27ipython sudo port select cython cython27
Windows
For Windows, we recommend Anaconda Python, an allinone package that includes all required Python modules. You will also need to install a compatible C compiler (Visual Studio 2008 Express Edition and, if you are running 64bit Windows, Windows SDK 2008 (select "Installation Options", "Developer Tools", "Visual C++ Compilers", "Install the Visual C++ 9.0 Compilers)).
Examination
Depending on the module that this lecture is part of, there are differences on how to get the credits for the module:
 BSc/MSc Physik, Modul "Simulationsmethoden in der Physik" (36010) and Erasmus Mundus International Master FUSIONEP

 Obtain 50% of the possible points in the handin excercises of this lecture and the second part of the lecture as a prerequisite for the examination (USLV)
 60 min of oral examination (PL)
 After the lecture "Simulation Methods in Physics II" in summer term (i.e. Summer 2016)
 Contents: both lectures and the excercises of "Simulation Methods in Physics I"
 International MSc Physics, Elective Module "Simulation Techniques in Physics I, II" (240918005)

 Obtain 50% of the possible points in the handin excercises of this lecture as a prerequisite for the examination
 30 min of oral examination (PL) about the lecture and the excercises
 BSc/MSc SimTech, Modul "Simulationsmethoden in der Physik für SimTech I" (40520)

 Obtain 50% of the possible points in the handin excercises of this lecture as a prerequisite for the examination (USLV)
 40 min of oral examination (PL) about the lecture and the excercises
 MSc Chemie, Modul "Simulationsmethoden in der Physik für Chemiker I" (35840)

 The marks for the module are the marks obtained in the excercises (BSL)
C++ Course
The Computer Science department is offering a weeklong C++ course at the end of this semester. We recommend all students that plan on participating the Advanced Simulation Methods lecture in summer semester 2018 to take this course. We also recommend it to all students that are considering doing a master's or bachelor's thesis at the ICP. Current bachelor students might be able to take this course as Schlüsselqualifikation  but please contact the organizing Professor beforehand to ensure that this is actually the case. Master students will be able to take this course as One Course (2 SWS) in an Application Field of Simulation Methods as part of the Fortgeschrittene Simulationsmethoden (Schwerpunkt) module, pending a change of the Modulhandbuch. Note that even current bachelor students can already take the course in 2017 if they intend to enroll in the master programme (starting in fall 2017) and take Advanced Simulation Methods (in summer 2018). All students will need to present their _Schein_ at the Advanced Simulation Methods exam in order to prove that they successfully participated in the C++ course and completed all required exercises.