Lammps Tutorial Oct06
Transcript of Lammps Tutorial Oct06
LAMMPS 2-1
LAMMPS TutorialCNF Fall Workshop, Oct 2006
Steve Plimpton, Sandia National [email protected], lammps.sandia.gov
1. Input and Output2. 11 example problems3. Parameters to change4. Adding a "feature" to LAMMPS
LAMMPS 2-2
LAMMPS Philosophy
• LAMMPS is a parallel MD kernelkeep the kernel simple and fastavoid non-parallel operations
• LAMMPS doesn't do many pre- and post-processing tasks:other codes already do itlimited development resourcesaren't parallel operations
LAMMPS 2-3
LAMMPS doesn't ...
• Build molecular systemsuse a builder code or write out your own config filecan build lattices, grain boundaries, etc
• Assign force-field coefficients auto-magicallyonly hard for molecules, use another MD code
• Compute lots of diagnostics on-the-flyoften better left to post-processingyou can add it if you want it
• Visualize your outputmany packages do thisVMD, Rasmol, Raster3d, AtomEye, Ensight, ...
• LAMMPS package includes auxiliary tools for some of these tasks• Python-based Pizza.py package distributed separately:
www.cs.sandia.gov/~sjplimp/pizza.html
LAMMPS 2-4
LAMMPS has no GUI
LAMMPS 2-5
LAMMPS Input
• Reads an input script (ASCII text)• One command per line• Command name + arguments
atom_style molecularread_data water.datafix 1 all nverun 10000
• lammps.sandia.gov has link to command doc pages• examples sub-dir has many sample input scripts
LAMMPS 2-6
LAMMPS Output
• log.lammps contains what is printed to screenthermodynamic info
• "dump" command outputs snapshots of atom propertiesdefault format is simple: id, type, x, y, zother supported formats: XYZ, DCD, XTCconversion tools: PDB, Ensight, XYZ, VTK
Rasmol, Raster3d, SVG, etc
LAMMPS 2-7
Viz of LAMMPS Snapshots
• xmovieauxiliary tool distributed with LAMMPSvery fast, simple viz2d projection of 3d systemsreads default dump format% /usr/local/bin/xmovie -scale dump.melt
• VMDlearning about this afternoon3d hi-quality vizdump 1 all xyz 100 dump.melt% vmd (load xyz file thru GUI)
LAMMPS 2-8
Running an Example Problem
• All problems in examples sub-directory• Copy entire dir to your space to run & modify
cp -r /usr/local/bin/lammps/examples/indent .cd indent; cp /usr/local/bin/lmp_linux .
• Each example problem reads:in.* input scriptdata.* input data file (optional)
• % lmp_linux -echo screen < in.indent (serial)• % mpirun -np 2 lmp_linux -in in.indent (parallel)• Each example problem produces:
log.lammps logfile output (see examples)dump.* series of snapshots
• LAMMPS doc pages at /usr/local/bin/lammps/doc/Manual.htmlsee Section_commands.html
• % /usr/local/bin/xmovie -scale dump.indent
LAMMPS 2-9
11 Example Problems
• crack: crack growth in a LJ crystal (2d)• flow: Couette/Poisseuille flow between walls (2d)• friction: rubbing of 2 irregular surfaces (2d)• indent: crystal response to spherical indenter (2d)• melt: LJ lattice (3d)• micelle: self-assembly of tiny lipid molecules (2d)• min: energy minimization of LJ melt (2d)• obstacle: flow around obstacles (2d)• peptide: small peptide chain in water (3d)• pour: granular particle pour and flow (2d/3d)• shear: shear of a metal slab with void (quasi-3d)
LAMMPS 2-10
Crack Problem
• Tensile pull on 2d LJ solid• Initial slit crack between red/green
neigh_modify exclude 2 3• Uniform gradient pull
velocity ramp commandelse shock waves or worse
• Need large system & slow pullelse defects other than crack
• Biggest computational test problemrun in parallel
• Options to play with:pull ratepair-wise cutoffturn off velocity rampchange NULL 0.0 in fix 2
LAMMPS 2-11
Flow Problems
Couette flow Poisseuille flow
Options to play with: wall velocity, force kick, temperature
LAMMPS 2-12
Friction Problem
• 2 non-uniform surfaces2d LJ hex lattice
• Region commandsto build geometry
• Options to play with:add/change asperities
sizeseparationshape
x-velocitymultiple passes
LAMMPS 2-13
Indent Problem
• 2d LJ solidperiodic in xfree upper y surface
• Spherical indenterdownward push, remove
• Defect creation and healing• Options to play with:
speed & depth of indentsize of indentersize of system
LAMMPS 2-14
Melt Problem
• 3d LJ solidperiodic in x,y,z
• Melt an fcc lattice• Options to play with:
temperaturefix nvt or npt
LAMMPS 2-15
Micelle Problem
• Simple lipid model• 2d self-assembly
vesiclesbilayers
• Hydrophilic head• Hydrophobic tail• Monomer solvent• Options to play with:
timestep size# of timestepspair-wise coeffsturn off special bondssystem size: micelle2d.f
LAMMPS 2-16
Minimization Problem
• Melt of 2d LJ solid• Followed by
energyminimization
• Returns to hexlattice butwith defects
• Options to play with:size of systemmelt temperatureminimize tolerance
LAMMPS 2-17
Obstacle Problem
• 2d LJ flow around obstacle(s)• Poisseuille “kick” added to atoms
pressure-gradient flow• Top surface applies pressure• Obstacle creation
delete_atoms commandfix indent command
• Options to play with:size of force kicksize of systemsize & position of obstaclesadd a new obstacle
LAMMPS 2-18
Peptide Problem
• Full-atom model of 5-mer Met-enkaphalinCHARMM force-field, PPPM CoulombicsSHAKE bond/angle constraints
• 2 fmsec timestep so can’t simulate for long!• To see bonds: xmovie –scale dump.bonds dump.peptide• Options to play with:
timestep size, turn off SHAKE, add fix drag command
LAMMPS 2-19
Pour Problem
• 3d (or 2d) pour of granular particlesinto empty boxunder gravity
• Change gravity directionto induce chute flow
• Options to play with:vol fraction for pour# of particles to pourspring constant for atomsdirection of gravity
LAMMPS 2-20
Shear Problems
• Fixed-end shear in fcc NiEAM potentialquasi-3d
non-periodic XY slabthin in Z, periodic
• Defect formation with andwithout void
• Options to play with:size of systemshear rateturn off velocity rampcomment in/out voidadd another void
LAMMPS 2-21
Extra Credit: Add new Feature to LAMMPS
• Grab your own copy of LAMMPS source filescp -r /usr/local/bin/lammps/src .
• Add 2 new files with your feature (from lammps/examples/triangle)region_triangle.cpp & region_triangle.halso region.cpp (one extra line needed, my mistake)
• Edit style_user.hinclude "region_triangle.h" #ifdef RegionIncludeRegionStyle(triangle,RegTriangle) #ifdef RegionClass
• Re-build LAMMPSmake linux
• Try it outedit examples/obstacle/in.obstacle to use triangular obstaclesedit examples/friction/in.friction to use triangular asperitiesregion 1 triangle x1 y1 x2 y2 x3 y3run and visualize
LAMMPS 2-22
region_triangle.cpp
• 35 lines of code
• constructor(int narg, char **arg)reads arguments: x1 y1 x2 y2 x3 y3determines extent = bounding box
• match(double x, double y, double z):determine if (x,y) is inside triangle (2d only)3 positive cross products inside
LAMMPS 2-23
Region triangle for Friction Problem
• examples/friction/in.friction• Replace: region lo-asperity sphere 32 7 0 8
region hi-asperity sphere 18 15 0 8• With: region lo-asperity triangle 26 7 32 14 38 7
region hi-asperity triangle 12 15 24 15 18 8