📄 xmd-12.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML><HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE>XMD - Molecular Dynamics Program: Techniques and Examples </TITLE> <LINK HREF="xmd-13.html" REL=next> <LINK HREF="xmd-11.html" REL=previous> <LINK HREF="xmd.html#toc12" REL=contents></HEAD><BODY><A HREF="xmd-13.html">Next</A><A HREF="xmd-11.html">Previous</A><A HREF="xmd.html#toc12">Contents</A><HR><H2><A NAME="techniques"></A> <A NAME="s12">12. Techniques and Examples </A></H2><H2><A NAME="ss12.1">12.1 Creating a B2 Lattice</A></H2><P>Lattices are created with the FILL command (although they can alsobe created using the DUP command).The following code will create a B2 lattice with a unit cell length of2.88, oriented with the [100], [010], [001] latticedirections in the (x,y,z) space directions.<P><BLOCKQUOTE><CODE><PRE>## create a b2 lattice using atoms types 1 and 2## make repeating boxbox 4 4 4## Use fill command to generate atom positions#fill particle 21 1/4 1/4 1/42 3/4 3/4 3/4fill go## scale lattice to 2.88 unit cell lengths#scale 2.88</PRE></CODE></BLOCKQUOTE><P><P><P>This will create a lattice of 4 by 4 by 4 cubic unit cells, each with a type 1 atom at the corner and a type 2 inthe center. The MOVE command centers the particles within the repeating boundaries. This is useful forminimizing the wrapping that occurs when particles pass through a box wall. By centering the particles in thebox, position the outlying atoms as far from the boundaries as possible.<P><H2><A NAME="ss12.2">12.2 Creating an L12 Lattice</A></H2><P>The following code will create a B2 lattice with a unit cell length of2.88, oriented with the <100>, <010>, <001> lattice directions in the(x,y,z) space directions. The L12 lattice is an FCC lattice with oneatoms species on the corners and the other on the faces, for exampleNi3Al. The following code will create a L12 lattice with a unit celllength of 4.183 oriented with the [100], [010], [001] lattice directionsin the (x,y,z) space directions.<P><BLOCKQUOTE><CODE><PRE>## CREATE A L12 LATTICE USING ATOM TYPES 1 AND 2## make repeating box#box 4 4 4## Generate atom positions#fill particle 41 1/4 1/4 1/42 1/4 3/4 3/42 3/4 1/4 3/42 3/4 3/4 1/4fill go## Scale lattcie to 4.183 unit cell length#scale 4.183</PRE></CODE></BLOCKQUOTE><P><P><H2><A NAME="ss12.3">12.3 Creating a B2 Lattice in <110> <1-10> <001> Orientation</A></H2><P>We will recreate the B2 lattice from a previous example,but this time in a different orientation.First, the box size must be changed to fit the repeatingboundary conditions of the new orientation (if we hadfree surfaces in all directions, this wouldn't be necessary).We will choose the orientation [111], [1-10] and [11-2] forthe x, y and z directions. In this orientation, the repeatdistances for the B2 lattice aresqrt(3)/2, sqrt(2) and sqrt(6) assuming a unit cell length of one(the repeat distance is the minimum separation between two atoms inthe specified directions).The repeating box choosen must be a multiple of these distances,and the distance for each box direction must match the corrspondingorientation vector.<BLOCKQUOTE><CODE><PRE>## create a b2 lattice using atoms types 1 and 2## make repeating boxbox 4*sqrt(3)/2 4*sqrt(2) 2*sqrt(6)## Use fill command to generate atom positions#fill particle 21 1/4 1/4 1/42 3/4 3/4 3/4fill orient 1 1 1 1 -1 0 1 1 -2fill go## scale lattice to 2.88 unit cell lengths#scale 2.88</PRE></CODE></BLOCKQUOTE><P><P><H2><A NAME="ss12.4">12.4 Finding the Optimum Time Step</A></H2><P>As explained above in the THEORY section under TIME STEP SIZE (see page3), there is an optimum time step size when conducting a moleculardynamics simulation. Physically this time step size is about 0.0333 to0.01 of the smallest vibrational period in the simulation. The smallestvibrational period depends most strongly on the potential used, and lessstrongly on the particular lattice structure and temperature. Theoptimum time step is found through trial and error, the testing donewith an adiabatic simulation. Below we have the input for such a trialand error simulation.<P><BLOCKQUOTE><CODE><PRE>## Trial and error to find optimum time step size## Read potential for nialread /cmd/nial.pot## Make repeating box and lattice (in units of a0)#box 6 6 6fill particle 21 1/4 1/4 1/42 3/4 3/4 3/4fill go## Scale up to units of angstroms (2.8712 unit cell)#scale 2.8712## Save energies from every dynamics step in file "timestep.e'#esave 1 timestep.e## Set particle masses (in atomic mass units)#select type 1mass 58.71select type 2mass 26.982## Set adiabtic simulation at starting temperature of 200K#clamp offitemp 200## Vary time step## Set initial timestep size variablecalc stepsize = 4e-16# Do 6 separate runs of 20 steps eachrepeat 6 # Set timestep size using dtime command dtime stepsize # 20 steps of dynamics (energies are written to tempstep.e file) cmd 20 # Double the time step size calc stepsize = 2 * stepsizeend</PRE></CODE></BLOCKQUOTE><P><P>The command ESAVE writes out four columns of numbers to the output file:the time step, the total energy, the potential energy and the kineticenergy. In practice the total system energy (the second column) willfluctuate, particularly at the first 10 or so steps of a simulation(before the higher time derivatives have had a chance to beinitialized during the course of the integration). The user needs tojudge for himself what amount of fluctuation is tolerable. In the pastfluctuations of about 1 part per 5000 of the total system energy pertwenty time steps have been allowed. It is useful to plot the value ofthe total energy versus time step to gauge when the system becomesunstable.<P><H2><A NAME="ss12.5">12.5 Initialize the Temperature</A></H2><P>Initializing the energy can be done with a single command, the ITEMP command.However it is necessary to keep in mind how the redistribution of kineticenergy into the system can affect the simulation. Most often, a lattice isstarted with all of the atoms perfectly in place, which is the lowest possibleenergy position for that lattice. When kinetic energy is added to this perfectlattice, about half of it goes into the potential energy needed to place theatoms off their perfect positions. After a short period of time (say 200 timesteps) the temperature of the lattice will be half of the temperature when theITEMP command was first issued.<P><H2><A NAME="ss12.6">12.6 Finding the Equilbrium Lattice Constant</A></H2><P>Often one wants to simulate a specific lattice structure, but is unsureof the exact lattice constant, or of the temperature dependence of lattice constant. Of course, in the case of a tetragonal ororthorhombic lattice, there are 2 or 3 lattice constants.It is important use the correct lattice constant when doing simulations,otherwise the system will be under stress. Since materials expand withincreasing temperature, the lattice constant must be determined forevery simulation temperature. So how do you find the equilibriumlattice constant(s) as a function of temperature? The easiest way is touse the PRESSURE CLAMP command.<P><P>This command allows the simulation box to adjust its size in accordancewith an applied pressure (typically zero pressure) and the latticemotion. By writting out the box size using the BSAVE command, you canmonitor the box size as a function of time step, and determine theaverage box size(s). Here is an example where we calculate the boxsize for Copper at 600 degrees Kelvin.<P><BLOCKQUOTE><CODE><PRE>## Finding the equilibrium lattice constant at 600K for Copper## Read potential for nialread /cmd/cu.pot## Make repeating box and lattice (in units of a0)#box 6 6 6fill particle 41 1/4 1/4 1/41 1/4 3/4 3/41 3/4 1/4 3/41 3/4 3/4 1/4fill go## Scale up to units of angstroms (3.61)#scale 3.61## Save box size from every dynamics step in file "constant.b'#bsave 10 constant.b## Set particle masses (in atomic mass units)#select type 1mass 63.55## Set time step size#dtime 5e-15## Set temperature clamp and starting temperature at 600K#clamp 600itemp 600## Set pressure clamp#pressure clamp 1.37## Equilibrate for 10000 steps##cmd 10000</PRE></CODE></BLOCKQUOTE><P><P>The file constant.b will contain the x, y and z box sizes every 10steps. For this example the box size increases at the simulation startuntil its 600K equilibrium value is reached, and then it fluctuatesaround this value. One can average the x, y and z box sizes together toobtain the average box size (after equilibrium is reached). In ourexample the box size is 6 times the lattice constant (note in theexample the box is made up of 6x6x6 unit cells).<P><P>If one is simulating a tetragonal or orthorhombic lattice one should usethe PRESSURE ORTHORHOMBIC option, so that the x, y and z box sizes canvary independently. By default, the ratio between the x, y and z boxsizes are preserved.<P><H2><A NAME="ss12.7">12.7 Calculating the Surface Energy</A></H2><H2><A NAME="ss12.8">12.8 Simulating a Crack</A></H2><HR><A HREF="xmd-13.html">Next</A><A HREF="xmd-11.html">Previous</A><A HREF="xmd.html#toc12">Contents</A></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -