lammps模拟实例详解.docx
《lammps模拟实例详解.docx》由会员分享,可在线阅读,更多相关《lammps模拟实例详解.docx(11页珍藏版)》请在冰豆网上搜索。
lammps模拟实例详解
#BigcolloidparticlesandsmallLJparticles
unitslj
Thiscommandsetsthestyleofunitsusedforasimulation.Itdeterminestheunitsofallquantitiesspecifiedintheinputscriptanddatafile,aswellasquantitiesoutputtothescreen,logfile,anddumpfiles.Typically,thiscommandisusedattheverybeginningofaninputscript.这个指令设定模拟的格式,它决定了在输入脚本文件和数据文件以及在屏幕上显示的输出物,日志文件和垃圾文件中所有的单元格式。
典型的是,它经常用于输入脚本的开头
Forstylelj,allquantitiesareunitless.Withoutlossofgenerality,LAMMPSsetsthefundamentalquantitiesmass,sigma,epsilon,andtheBoltzmannconstant=1.Themasses,distances,energiesyouspecifyaremultiplesofthesefundamentalvalues.Theformulasrelatingthereducedorunitlessquantity(withanasterisk)tothesamequantitywithunitsisalsogiven.Thusyoucanusethemass&sigma&epsilonvaluesforaspecificmaterialandconverttheresultsfromaunitlessLJsimulationintophysicalquantities.
对于lj格式,所有数量都是无量纲的。
不失一般性的,lammps设定了基本量质量sigmaepsilon和波尔兹曼常数=1。
你定义的质量,距离,能量是这些基本值的倍数。
公式把衰减量或者是无量纲量(用*)和单元给出的相同的量关联起来。
因此你可以用mass,sigma,epsilon值表示一个具体材料并且改变一个无量纲lj模拟的物理量的结果。
mass=massorm
distance=sigma,wherex*=x/sigma
time=tau,wheretau=t*=t(epsilon/m/sigma^2)^1/2
energy=epsilon,whereE*=E/epsilon
velocity=sigma/tau,wherev*=vtau/sigma
force=epsilon/sigma,wheref*=fsigma/epsilon
torque=epsilon,wheret*=t/epsilon
temperature=reducedLJtemperature,whereT*=TKb/epsilon
pressure=reducedLJpressure,whereP*=Psigma^3/epsilon
dynamicviscosity=reducedLJviscosity,whereeta*=etasigma^3/epsilon/tau
charge=reducedLJcharge,whereq*=q/(4piperm0sigmaepsilon)^1/2
dipole=reducedLJdipole,momentwhere*mu=mu/(4piperm0sigma^3epsilon)^1/2
electricfield=force/charge,whereE*=E(4piperm0sigmaepsilon)^1/2sigma/epsilon
density=mass/volume,whererho*=rhosigma^dim
atom_styleatomic原子类型atomic(原子的)
Definewhatstyleofatomstouseinasimulation.Thisdetermineswhatattributesareassociatedwiththeatoms.Thiscommandmustbeusedbeforeasimulationissetupviaaread_data,read_restart,orcreate_boxcommand.
定义在模拟中用到的原子类型,这个决定了与原子有关的属性,这个命令必须用在模拟被设定之前通过read_data,read_restart,orcreate_box
Atomiconlythedefaultvaluescoarse-grainliquids,solids,metals
Atomic附加属性是只是默认值用于粗粒液体,固体和金属的模拟
dimension2二维
latticesq0.01建造一个sq类型的二维晶格,lj折合密度rho*=0.01
LatticeDefinealatticeforusebyothercommands.InLAMMPS,alatticeissimplyasetofpointsinspace,determinedbyaunitcellwithbasisatoms,thatisreplicatedinfinitelyinalldimensions.Theargumentsofthelatticecommandcanbeusedtodefineawidevarietyofcrystallographiclattices.
Lattice指令定义了一个其他指令可以使用的晶格,在lammps中,一个晶格是一个空间中简单的点集,被基本原子构成的所有维度中无限复制的晶胞在所决定。
Lattice指令额参数可以被用来定义各种各样的晶格。
AlatticeisusedbyLAMMPSintwoways.First,thecreate_atomscommandcreatesatomsonthelatticepointsinsidethesimulationbox.Notethatthecreate_atomscommandallowsdifferentatomtypestobeassignedtodifferentbasisatomsofthelattice.Second,thelatticespacinginthex,y,zdimensionsimpliedbythelattice,canbeusedbyothercommandsasdistanceunits(e.g.create_box,regionandvelocity),whichareoftenconvenienttousewhentheunderlyingproblemgeometryisatomsonalattice.一个lattice明令在lammps中有两种实用方式,首先,create_atomscommand在模拟盒子内部的格点上创建原子。
注意,ecreate_atomscommand允许不同的原子类型去分配到晶格中不同的基本原子。
第二,晶格间距在x,y,z轴分量隐含在晶格中,可以被其他命令应用作为距离单元。
这个距离单元当潜在问题的几何构型是在晶格中的原子的时候经常被方便的使用。
Alatticeconsistsofaunitcell,asetofbasisatomswithinthatcell,andasetoftransformationparameters(scale,origin,orient)thatmaptheunitcellintothesimulationbox.Thevectorsa1,a2,a3aretheedgevectorsoftheunitcell.Thisisthenomenclaturefor"primitive"vectorsinsolid-statecrystallography,butinLAMMPStheunitcelltheydeterminedoesnothavetobea"primitivecell"ofminimumvolume.一个晶格由晶胞,晶胞内部的基本原子构成的集合,一个将晶胞绘制入模拟盒子的基本参数构成的集合构成。
矢量a1,a2,a3是晶胞的棱矢量,在固态物理学里面用术语primitive矢量来表示。
但是在lammps中不一定要用最小体积的原胞来定义晶胞
Lattice应用:
latticestylescalekeywordvalues
style=noneorscorbccorfccorhcpordiamondorsqorsq2orhexorcustom
scale=scalefactorbetweenlatticeandsimulationbox
forstylenone:
scaleisnotspecified(noranyoptionalarguments)
forallotherstyles:
scale=reduceddensityrho*(forLJunits)
scale=latticeconstantindistanceunits(fornon-LJunits)
Latticesofstylesqandsq2are2dlatticesthatdefineasquareunitcellwithedgelength=1.0.Thismeansa1=100anda2=010.Asqlatticehas1basisatomatthelower-leftcornerofthesquare.Asq2latticehas2basisatoms,oneatthecornerandoneatthecenterofthesquare.
sqandsq2格式的晶格是一个2维晶格这个晶格定义了一个棱长为1.0的直角晶胞的2维晶胞。
这意味着a1=100,a2=010。
一个sq晶格在正方形左下角有一个基本的原子。
Sq2则有两个基本原子,一个在角落另一个在正方形的中心。
Forunitstylelj,thescaleargumentistheLennard-Jonesreduceddensity,typicallywrittenasrho*.LAMMPSconvertsthisvalueintothemultiplicativefactorviatheformula"factor^dim=rho/rho*",whererho=N/VwithV=thevolumeofthelatticeunitcellandN=thenumberofbasisatomsintheunitcell(describedbelow),anddim=2or3forthedimensionalityofthesimulation.Effectively,thismeansthatifLJparticlesofsizesigma=1.0areusedinthesimulation,thelatticeofparticleswillbeatthedesiredreduceddensity.对于li单元,scale是Lennard-Jones折算密度,典型写为rho*。
Lammps通过公式"factor^dim=rho/rho*"将这个值转变为倍增因子。
Rho=N/V,v=晶格单元的体积,n=晶胞中基本原子的数量,dim根据模拟的维度等于2或者3。
实际上这表明如果在模拟中使用的lj粒子的sigma=1.0,那么晶格中的粒子将会有预期的折算密度。
regionboxblock030030-0.50.5
在空间xlo=0,xhi=30,ylo=0,yhi=30,zlo=—0.5,zhi=0.5的范围内创建区域。
RegionThiscommanddefinesageometricregionofspace.Variousothercommandsuseregions.Forexample,theregioncanbefilledwithatomsviathecreate_atomscommand.Oraboundingboxaroundtheregion,canbeusedtodefinethesimulationboxviathecreate_boxcommand.Orthesurfaceoftheregioncanbeusedasaboundarywallviathefixwall/regioncommand.Region指令定义了一个几何空间。
许多的其他的指令都用这条指令,比如,空间可以被原子充满通过create_atomscommand。
或者是一个区域周围的边界盒子可以被用来定义迷你盒子通过create_boxcommand.或者空间表面可以作为一个边界框使用通过指令thefixwall/region.
Aboxvalueselectsstandarddistanceunitsasdefinedbytheunitscommand,e.g.Angstromsforunits=realormetal.Alatticevaluemeansthedistanceunitsareinlatticespacings.Thelatticecommandmusthavebeenpreviouslyusedtodefinethelatticespacingswhichareusedasfollows:
一个box值选用被units明令定义的距离标准单位。
如A对应的units=realormetal.一个lattice值意味着距离单元在晶格间距内。
Lattice指令必须已经在之前被用于定义晶格间距如:
Forstyleblock,thelatticespacingindimensionxisappliedtoxloandxhi,similarlythespacingsindimensionsy,zareappliedtoylo/yhiandzlo/zhi.
对于block格式,晶格间距在x轴上被应用于xloandxhi。
y,z轴情况相似。
create_box2box在上述空间内建在一个有两种原子类型的模拟箱
Thiscommandcreatesasimulationboxbasedonthespecifiedregion.Thusaregioncommandmustfirstbeusedtodefineageometricdomain.这条指令在被指定的区域内创建一个模拟盒子,因此一个region指令必须首先被用来定义一个几何区域。
TheargumentNisthenumberofatomtypesthatwillbeusedinthesimulation.参数n是在模拟中使用到的原子类型。
create_atoms1box
Thiscommandcreatesatomsonalattice,orasingleatom,orarandomcollectionofatoms,asanalternativetoreadingintheircoordinatesexplicitlyviaaread_dataorread_restartcommand.Asimulationboxmustalreadyexist,whichistypicallycreatedviathecreate_boxcommand.Beforeusingthiscommand,alatticemustalsobedefinedusingthelatticecommand.Theonlyexceptionsareforthesinglestylewithunits=boxortherandomstyle这条指令在晶格中创造原子,或者创造一个简单原子,或是创造一个随即收集的原子,作为读取他们明确坐标的替代物,通过read_dataorread_restart指令,一个模拟盒子必须已经存在,盒子可以通过create_box指令创建。
在用这条指令之前,一个晶格也必须用lattice指令定义。
Fortheboxstyle,thecreate_atomscommandfillstheentiresimulationboxwithatomsonthelattice.Ifyoursimulationboxisperiodic,youshouldinsureitssizeisamultipleofthelatticespacings,toavoidunwantedatomoverlapsattheboxboundaries.Ifyourboxisperiodicandamultipleofthelatticespacinginaparticulardimension,LAMMPSiscarefultoputexactlyoneatomattheboundary(oneithersideofthebox),notzeroortwo.对于box格式,create_atoms指令将整个模拟盒子用晶格上的原子填充。
如果模拟盒子是周期性的,你必须确保它的大小是一个晶格间距的整数倍以避免边界上不必要的原子重叠。
若箱在特定的维度是周期性的,并且它的大小是一个晶格间距的整数倍,lammps就会在边界两侧各放一个原子。
setgroupalltype/fraction20.962398
setstyleIDkeywordvalues...
Setoneormorepropertiesofoneormoreatoms.Sinceatompropertiesareinitiallyassignedbytheread_data,read_restartorcreate_atomscommands,thiscommandchangesthoseassignments.Thiscanbeusefulforoverridingthedefaultvaluesassignedbythecreate_atomscommand(e.g.charge=0.0).Itcanbeusefulforalteringpairwiseandmolecularforceinteractions,sinceforce-fieldcoefficientsaredefinedintermsoftypes.ItcanbeusedtochangethelabelingofatomsbyatomtypeormoleculeIDwhentheyareoutputindumpfiles.Itcanbeusefulfordebuggingpurposes;i.e.positioninganatomatapreciselocationtocomputesubsequentforcesorenergy.设定一个或多个原子的一个或多个属性。
自从原子属性被read_data,read_restartorcreate_atoms指令所分配,这个命令改变他们的参数。
这个对于通过create_atomscommand来重置默认值是很有用处的。
当力场参数依据类型被定义后,这条指令对于变更成对的或是分子的相互作用力是有用的。
该指令可以被用来改变原子的标识通过在他们在dumpfiles中输出的时候改变原子类型或是分子id来完成。
这条指令也对调试目标是有用的。
定位一个特定的原子的位置,计算后来的力量或能量。
Thestylegroupselectsalltheatomsinthespecifiedgroup.Thestyleregionselectsalltheatomsinthespecifiedgeometricregion.Group格式选择所有的原子在指定的群里。
Region格式选择在制定几何区域内德所有原子。
Keywordtype/fractionsetstheatomtypeforafractionoftheselectedatoms.Theactualnumberofatomschangedisnotguaranteedtobeexactlytherequestedfraction,butshouldbestatisticallyclose.Randomnumbersareusedinsuchawaythataparticularatomischangedornotchanged,regardlessofhowmanyprocessorsa