vmd教程 forces-tutorial
2TCLBC202TclBC
InaNAMDcon guration le,onesetsupthesimulationparameters,suchasthetemperature,pressure,orauniformelectric eld,forthemolecularsystemasawhole.Inmanycases,though,youwillneedtoimposeboundaryconditions,applyanon-uniformelectric eld,orselectivelyapplyforcestoagroupofatomsofthegiventypeorlocatedinaparticulararea.Forthispurpose,youcanuseatclBC(whichstandsforTclBoundaryConditions)script.AtclBCscriptiswrittenintheTclprogramminglanguage,arudimentaryknowledgesofwhichwouldbeenoughformosttasks.Thescriptwillbeinterpretedline-by-line,thereforeslowingdownthesimulation,sometimesconsiderably.Forthisreasonyouwillwanttokeepyourscriptssimpleand
e cient.tclBCversustclForces.tclBCandtclForcesarebothscripting
interfacesthatallowtogetinformationabouttheatoms’positions
andapplyforcestoselectedatomsduringaNAMDsimulation.In
bothscripts,theforcecanbecalculatedindividuallyforeachatom,
dependingonitsuniqueIDnumberanditscurrentposition.The
maindi erencebetweentclBCandtclForcesisthatanindepen-
dentinstanceoftclBCisrunningoneachprocessor,andonlyatoms
formingthepatchtreatedbythatprocessorarevisibletothegiven
instanceoftclBC.ThisfeaturemakestclBCmoree cientthan
tclForces,whichisrunonjustoneCPU,butalsolimitsitsca-
pabilities.Ifyouneedtoapplyforcestoeachatomirrespectiveof
thepositionofotheratoms,usetclBC.Ontheotherhand,ifyou
havetoconsidermutualpositionsoftwoormoreatomsorgather
informationaboutthewholesystem,youwillneedtclForces.
ThewaythecoordinatesofatomsarewrappedaroundperiodicboundariesinatclBCscriptiscontrolledusingthecommandwrapmode,whichthatmayhaveoneofthefollowingarguments:
patchisthedefaultmode:theatom’scoordinatesareconsideredasthepositioninNAMD’sinternalpatchdatastructure.Thisisingeneraldi erentfromanatom’scoordinatesrelativetotheglobalorigin,sopatchmodeshouldnotbeusedunlessyouknowwhatyouaredoing.
Inmodeinput,theatom’scoordinatescorrespondtoitspositionintheinput lesofthesimulation.
Inmodecell,theatom’sequivalentpositionintheunitcellcenteredonthecellOriginisused.
Inmodenearest,theatom’sequivalentpositionnearesttothecellOriginisused.
Formostpurposes,modecellisagoodchoice.