Seminar 1: Efficient Algorithms for Molecular Dynamics Simulation Andrew Noske.

Slides:



Advertisements
Similar presentations
Time averages and ensemble averages
Advertisements

Simulazione di Biomolecole: metodi e applicazioni giorgio colombo
Reactive and Potential Field Planners
How to setup the initial conditions for a Molecular Dynamic Simulation
The A-tree: An Index Structure for High-dimensional Spaces Using Relative Approximation Yasushi Sakurai (NTT Cyber Space Laboratories) Masatoshi Yoshikawa.
Parameterizing a Geometry using the COMSOL Moving Mesh Feature
Transfer FAS UAS SAINT-PETERSBURG STATE UNIVERSITY COMPUTATIONAL PHYSICS Introduction Physical basis Molecular dynamics Temperature and thermostat Numerical.
Computational simulation of Molecular dynamics Talk given at the theory group, School of Physics, USM 31 Oct pm.
A Digital Laboratory “In the real world, this could eventually mean that most chemical experiments are conducted inside the silicon of chips instead of.
Survey of Molecular Dynamics Simulations By Will Welch For Jan Kubelka CHEM 4560/5560 Fall, 2014 University of Wyoming.
LINCS: A Linear Constraint Solver for Molecular Simulations Berk Hess, Hemk Bekker, Herman J.C.Berendsen, Johannes G.E.M.Fraaije Journal of Computational.
Effectively Indexing Uncertain Moving Objects for Predictive Queries School of Computing National University of Singapore Department of Computer Science.
Computational Solid State Physics 計算物性学特論 第2回 2.Interaction between atoms and the lattice properties of crystals.
Colligative Properties are those properties of a liquid that may be altered by the presence of a solute. Examples vapor pressure melting point boiling.
Raster Based GIS Analysis
Planning under Uncertainty
1Notes. 2 Building implicit surfaces  Simplest examples: a plane, a sphere  Can do unions and intersections with min and max  This works great for.
Accessing Spatial Data
Due to Monday Holiday (Presidents Day 2/18), 2/14 Thursday DL Section (1,3,4) cancelled. (DL Section 7,10 meet as normal) 2/15 Friday DL Section 2,5,6.
1cs426-winter-2008 Notes  Course project: Will be due at the end of the term You can do it in pairs Create an animation that combines an algorithm for.
1cs533d-term Notes  list Even if you’re just auditing!
1 A Novel Binary Particle Swarm Optimization. 2 Binary PSO- One version In this version of PSO, each solution in the population is a binary string. –Each.
Quiz 4 8:30-8:50am TODAY Have your calculator ready. Cell phone calculator NOT allowed. Closed book Quiz 1 & 2 grade available on the course website (last.
Chapter 4 Numerical Solutions to the Diffusion Equation.
Molecular Dynamics Classical trajectories and exact solutions
Joo Chul Yoon with Prof. Scott T. Dunham Electrical Engineering University of Washington Molecular Dynamics Simulations.
Monte Carlo Methods in Partial Differential Equations.
CS 4730 Physical Simulation CS 4730 – Computer Game Design.
Fast Subsequence Matching in Time-Series Databases Christos Faloutsos M. Ranganathan Yannis Manolopoulos Department of Computer Science and ISR University.
1 CE 530 Molecular Simulation Lecture 7 David A. Kofke Department of Chemical Engineering SUNY Buffalo
1 Statistical Mechanics and Multi- Scale Simulation Methods ChBE Prof. C. Heath Turner Lecture 11 Some materials adapted from Prof. Keith E. Gubbins:
Molecular Dynamics Simulations
Room 2032 China Canada Winnipeg Manitoba.
ChE 452 Lecture 24 Reactions As Collisions 1. According To Collision Theory 2 (Equation 7.10)
02/25/05© 2005 University of Wisconsin Last Time Meshing Volume Scattering Radiometry (Adsorption and Emission)
Javier Junquera Molecular dynamics in the microcanonical (NVE) ensemble: the Verlet algorithm.
Molecular Dynamics Simulation Solid-Liquid Phase Diagram of Argon ZCE 111 Computational Physics Semester Project by Gan Sik Hong (105513) Hwang Hsien Shiung.
Molecular Dynamics Collection of [charged] atoms, with bonds – Newtonian mechanics – Relatively small #of atoms (100K – 10M) At each time-step – Calculate.
Molecular Dynamics A brief overview. 2 Notes - Websites "A Molecular Dynamics Primer", F. Ercolessi
Chicago, July 22-23, 2002DARPA Simbiosys Review 1 Monte Carlo Particle Simulation of Ionic Channels Trudy van der Straaten Umberto Ravaioli Beckman Institute.
Scheduling Many-Body Short Range MD Simulations on a Cluster of Workstations and Custom VLSI Hardware Sumanth J.V, David R. Swanson and Hong Jiang University.
Basics of molecular dynamics. Equations of motion for MD simulations The classical MD simulations boil down to numerically integrating Newton’s equations.
A Quantitative Analysis and Performance Study For Similar- Search Methods In High- Dimensional Space Presented By Umang Shah Koushik.
School of Mathematical Sciences Life Impact The University of Adelaide Instability of C 60 fullerene interacting with lipid bilayer Nanomechanics Group,
ALGORITHM IMPROVEMENTS AND HPC 1. Basic MD algorithm 1. Initialize atoms’ status and the LJ potential table; set parameters controlling the simulation;
STAR Sti, main features V. Perevoztchikov Brookhaven National Laboratory,USA.
Physical principles of nanofiber production Theoretical background (2) Surface tention and electrical bi- layer D. Lukáš
Nearest Neighbor Queries Chris Buzzerd, Dave Boerner, and Kevin Stewart.
Molecular Modelling - Lecture 2 Techniques for Conformational Sampling Uses CHARMM force field Written in C++
ChE 452 Lecture 25 Non-linear Collisions 1. Background: Collision Theory Key equation Method Use molecular dynamics to simulate the collisions Integrate.
Chapter 9: Molecular-dynamics Integrate equations of motion-- classical! Discrete form of Newton’s second law Forces from interaction potential For a simple.
Flexible Spanners: A Proximity and Collision Detection Tool for Molecules and Other Deformable Objects Jie Gao, Leonidas Guibas, An Nguyen Computer Science.
Reaction-Diffusion Systems Reactive Random Walks.
LAW OF UNIVERSAL GRAVITATION F G gravitational force (in two directions) G universal gravitation constant 6.67x Nm 2 kg -2 r distance between the.
Monte Carlo method: Basic ideas. deterministic vs. stochastic In deterministic models, the output of the model is fully determined by the parameter values.
Interacting Molecules in a Dense Fluid
R-Trees: A Dynamic Index Structure For Spatial Searching Antonin Guttman.
Chapter 16 Kinetic Theory of Gases. Ideal gas model 2 1. Large number of molecules moving in random directions with random speeds. 2. The average separation.
Laser-Assisted Particle Removal
D. M. Ceperley, 2000 Simulations1 Neighbor Tables Long Range Potentials A & T pgs , Today we will learn how we can handle long range potentials.
CIVET seminar Presentation day: Presenter : Park, GilSoon.
Computational Physics (Lecture 11) PHY4061. Variation quantum Monte Carlo the approximate solution of the Hamiltonian Time Independent many-body Schrodinger’s.
Overview of Molecular Dynamics Simulation Theory
Implementing Simplified Molecular Dynamics Simulation in Different Parallel Paradigms Chao Mei April 27th, 2006 CS498LVK.
On Spatial Joins in MapReduce
Course Outline Introduction in algorithms and applications
Chapter 9: Molecular-dynamics
Large Time Scale Molecular Paths Using Least Action.
Molecular Dynamics(MD)
Hydrogen Oxidation by MD Simulations
Presentation transcript:

Seminar 1: Efficient Algorithms for Molecular Dynamics Simulation Andrew Noske

About the Project Part of TOMSK (Towards Molecular Structure Kinetics) Build an “engine layer” for particle simulations

About Molecular Simulations Real molecules obey quantum laws… but can approximate with classical laws. e.g.: Newton’s law: force=mass*acceleration e.g.: Newton’s law: force=mass*acceleration Molecular Dynamics (MD): integrates equations of motion of atoms each timestep. Cannot predict precisely what will happen: generates statistical prediction. Cannot predict precisely what will happen: generates statistical prediction.

Chosen Interaction Model Lennard Jones Potential Pair Equation: I will use this to simulate atoms in a stable liquid. NOTE: Will be easy to overwrite/change interaction model & add statistical analysis functions (e.g.: calc Temperature).

Simulating Liquids PBC on 2D box Range search on box with PBC Microscopic droplet (finite particles) Can only simulate so many 1000’s of particles. To simulate bulk liquid: I will use Periodic Bounding Condition (PBC)  (boundaries wrap around) Surface particle has less neighbors

N-body Problem N-body problem: all (N) particles in a system have pair-wise interaction. Solutions: Brute force approach compare all pairs  O(N 2 ) Brute force approach compare all pairs  O(N 2 ) Better approach: approximate distant forces Better approach: approximate distant forces Lead to many specific solutions. Consider ALL Approximate

Chosen Solution Chosen approach: chose cutoff radius, and ignore particles beyond this. Involves: moving self-spatial join query (many range queries)  has numerous applications: Involves: moving self-spatial join query (many range queries)  has numerous applications: GIS, Computer graphics, etc. Ignore O-- H+ – + Permanent dipole Water molecule Argon atom (inert) Symmetrical attractive/ repulsive forces + – – – Cutoff radius (Rc) Spatial join query: NOTE: Direction forces! Single Range Query

Spatial Data Structure: Fixed Grid Reviewed many types of structures. Fixed grid most effective for uniform particle distribution. Time to build (place all points into index) = O(N) Time to build (place all points into index) = O(N) cell index = atom coordinate / cellLen (along each dimension) Cell List technique Cutoff radius (r c ) Fixed grid cellLen boxLen rcrc NOTE: cells per side (CPS)=5

Scientific Process Using Visual C++ console application. Am using OO principles. Am using OO principles. Have read “Effective C++” & now reading “More Effective C++”. Have read “Effective C++” & now reading “More Effective C++”. Testing process: Run a series of simulations in batch… Run a series of simulations in batch… Output results to CSV… including: Output results to CSV… including: grid parameters, clock tics elapsed,  primary focus distance calculates, & more Analyze/graph CSV using Excel. Analyze/graph CSV using Excel. Can be time consuming!  Can be time consuming! 

Simulation Steps Set-up: #1) Setup grid structure #1) Setup grid structure #2) Setup atoms in offset lattice #2) Setup atoms in offset lattice #3) Assign random velocities. #3) Assign random velocities.Iterate: #1) Build grid (assign all atoms to cells). #1) Build grid (assign all atoms to cells). #2) Build neighbor list (for each atom in each cell: find neighbors).  can take 95% of time #2) Build neighbor list (for each atom in each cell: find neighbors).  can take 95% of time #3) Calculate force and move atoms  implements interaction model (can change). #3) Calculate force and move atoms  implements interaction model (can change). #4) Wrap atoms back into cell boundaries. #4) Wrap atoms back into cell boundaries. #5) Increment timestep. #5) Increment timestep.

Finding Good Neighbours q “Love thy neighbour” -- the bible q q Atom list approach: For each atom: check which cells are within rc of atom Cell list approach: Predetermine which cells are within rc of each cell NOTE: Volume sphere = 52% of it’s bounding cube

Optimization Trick: Half-sphere Query i j i j Normal approach: Search sphere Faster approach: Search upper hemi-sphere NOTE: will capture each neighbor twice (once from each end)

Smaller Optimization Tricks i j Early elimination if distance between atoms along any dimension > rc. Don’t calculate sqrt: Lennard-Jones can be done using dist 2 Lennard-Jones can be done using dist 2 NOTE: if (dist 2 <= cutoffRadius 2 )  is in range NOTE: if (dist 2 <= cutoffRadius 2 )  is in range Determine optimal # of cells per size. Is cell length = cutoff radius optimal? Is cell length = cutoff radius optimal?

Idea: Using MBRs in cells For each cell, maintain a Minimum Bounding Rectangle (MBR) around it’s atoms. For any cell JUST tipped by rc, check atom is inside rc of MBR before considering atoms exhaustively. For any cell JUST tipped by rc, check atom is inside rc of MBR before considering atoms exhaustively. This cell is just tipped” MBR NOTE: can also be used in conjunction with “sub grid” NOTE: can also be used in conjunction with “sub grid”

Improving Cache Hits through Spatial Locality Spatial locality principle: objects close to referred ones will probably be requested again in the future. Unsorted atoms  means many cache misses. Unsorted atoms  means many cache misses

Space Filling Curves Space-filling curve: A line passing through every point in a space, in some order (according to some algorithm). Resort atom periodically (group by cells & order using curve). Resort atom periodically (group by cells & order using curve). Improves CPU performance “>50% in 2D moving point query”  worth trying. Improves CPU performance “>50% in 2D moving point query”  worth trying. Row-wise Hilbert curve Gray curve Z-ordering

Verlet Neighbour List Choose a “skin radius” greater than rc. Build the “verlet neighbor list” using skin radius Next few iterations: update list; check which neighbour pairs are inside rc. Refinement: only rebuild list when: sum of 2 max displacement (of any 2 atoms) > skin “thickness” RlRl 7 7' 6' 3 RcRc Cut-off sphere Skin Skin/verlet radius (Rv) 2 max displacements since rebuild

Some Verlet Specific Ideas Don’t check displacement each iteration: check at decreasing periods. Don’t update distances of atoms outside cut-off sphere each iteration: check more frequently as it gets closer. Determine optimal skin radius RlRl 7 7' 6' 3 RcRc Cut-off sphere Skin Skin/verlet radius (Rv) 2 max displacements since rebuild 5

Performance vs. Accuracy Some techniques that will improve performance, but decrease “accuracy”: Don’t always rebuild/update neighbor list when necessary. Don’t always rebuild/update neighbor list when necessary. Increasing timestep Increasing timestep Decreasing cutoff radius Decreasing cutoff radius I can graph these by testing against a control. larger timestep small timestep smaller rc large rc

Progress Basic grid is implemented Thesis started. Several graphs obtained. Added front end: Uses MFC (Microsoft Foundation Class) using OpenGL. Uses MFC (Microsoft Foundation Class) using OpenGL. Demonstrates building on engine layer. Demonstrates building on engine layer. Lets me see particles animate (& work out problems) Lets me see particles animate (& work out problems) Code messy Code messy Is still MUCH to implement & test.

Conclusion Molecular dynamics : an (approximated) simulation of real world particle behaviour. Periodic Bounding Condition used for “bulk” liquid Periodic Bounding Condition used for “bulk” liquid Best existing approach: Verlet list, using cell list & fixed grid to build. Verlet list, using cell list & fixed grid to build. Ideas for improvement: Minimal half cell list templates. Minimal half cell list templates. MBRs inside cells. MBRs inside cells. Space filling curves. Space filling curves. Thesis may resemble a guide to implementing/optimizing moving spatial join queries. Still much to be done RlRl 7' 6' 3 RcRc rcrc

Thank You… Any Questions?

Revised Goal Implement engine as efficient as possible. How it should work: Pass in minimum parameters: Pass in minimum parameters: # atoms, offset, max velocity & box size (or load atom data from file). cutoff radius Engine should set remaining details to optimal. Including: Engine should set remaining details to optimal. Including: cells per side, verlet radius, subgrid? mbr? algorithm? etc. rcrc EXTRA SLIDE

Idea: Sub Grid “Sub grid adjacency list template guide”: break each cell into (imaginary) sub-grid. When considering an atom, check with sub-cell it belongs to, that sub-cell will refine which adjacent cells to search. When considering an atom, check with sub-cell it belongs to, that sub-cell will refine which adjacent cells to search. NOTE: My primary focus is: reducing time per iteration… but main memory requirements (& setup time) also important. My primary focus is: reducing time per iteration… but main memory requirements (& setup time) also important. Choosing cell length equal to rc is typical. But is it optimal? Choosing cell length equal to rc is typical. But is it optimal? No one method/metric is likely to be optimal in ALL cases  too many parameters. No one method/metric is likely to be optimal in ALL cases  too many parameters. EXTRA SLIDE