vmd教程 forces-tutorial(7)
发布时间:2021-06-05
发布时间:2021-06-05
vmd教程 forces-tutorial
1TCLFORCES
proccalcforces{}{
globalatomsnumatomslinaccelloadcoordscoords
loadmassesmasses
setcomsum"0.00.00.0"
settotalmass0.0
foreachatom$atoms{
setforce[vecscale$masses($atom)$linaccelnamd]
addforce$atom$force
settmp[vecscale$masses($atom)$coords($atom)]
setcomsum[vecadd$comsum$tmp]
}
setinvmass[expr1.0/$totalmass]
print"Centerofmass=[vecscale$invmass$comsum]"
}7
Thescriptstartswiththeglobalcommand,whichimportsthevariablesnamedsothattheycanbeaccessedinthecalcforcescommand.
Nextwecallthecommandloadcoords.ThissetsthevariablecoordstoaTclarrayofcoordinatesoftheatomsthathavebeenaddedusingaddatom.Inthiscase,ofcourse,thatisalltheatomsofthesystem.ArrayelementsinTclareaccessedusingparentheses.Similarly,loadmassesretrievestheatomicmasses,puttingtheminanarraynamedmasses.
Thenweloopthroughtheatoms,applyingthespeci edforcetoeachusingtheaddforcecommand.Alongtheway,wealsocalculatethecenterofmassoftheprotein.WeseetwomoreTclcommandsinactionshere:vecaddandvecscale.Theseaddtwovectorsandmultiplyavectorbyascalar,respectively.
6Becausethesystemissosmall,youcanrunitonyourdesktoporlaptopwithouttrouble,andseetheproteinmove.Runthe lepush.namd.Withanormalinstallation,youwoulddothiswiththecommand
namd2push.namd>
push.logCoordinates.CoordinatesintclForcesarenotwrappedaround
theunitcell.Ifyouneedwrappedcoordinatesforwhateverreason,
youmustwrapthemyourselfusingtheperiodiccelldimensionsand
origin.
7Afterthis nishes,wewanttoseehowtheproteinwasa ected.WewillnowuseVMD’sMultiPlotplugintoviewtheresults.Openthe leplot.tclinyourfavoritetexteditor,andchangethe rstlinetobethelocationofthelog leyoujustcreated,e.g.
setlogpush.log
ifyounamedthelog lepush.log.Torunthescript,eithertype
上一篇:社会实践基地的概况