vmd教程 forces-tutorial
1TCLFORCES
foreachatom$atomsmass$masses{
setlinforce[vecscale$mass$linaccelnamd]
setr[vecsub$coords($atom)$com]
setx[lindex$r0]
sety[lindex$r1]
setrho[exprsqrt($x*$x+$y*$y)]
setphi[expratan2($y,$x)+$MPI/2]
if{$atom==1}{
print"atom$atom:
}phi=$phi"16
setangdir"[exprcos($phi)][exprsin($phi)]0.0"
setangmag[expr$angaccel*$rho*$mass]
setangforce[vecscale$angmag$angdir]
setforce[vecadd$linforce$angforce]
addforce$atom$force
}
}
13Nowrunthesimulation,justasyouhaveinpreviousexamples:
namd2rot-b-short.namd>rot-b-short.log
Ifyouhaveaccesstoacluster,runitonthecluster—refertolocalin-structionsforhowthisisdone.Thissimulationwillrunforjust100steps,sothatthebenchmarktimesareprinted.Inthenextsection,wewillseehowtoimprovethisperformance.
Ifyouareinterested,examinethe lesrot-b-long.logandrot-b-long.dcdintheexample-outputdirectory,whichwereproducedwithaslightlylongersimulation.WhenloadingthetrajectoryinVMD,usethePSFcommon/ubiquitinsolvate.psf
1.5Example4:ImprovingE ciency
Inmostcases,it’sunnecessarytorecalculatetheforcevaluesappliedateachtimestep.Dependingonthesituation,onemaybeabletorecalculateevery1000steps,savingalotofcomputationale ortandthereforeincreasingthespeedofthesimulation.Inthissection,wewillseehowtodothat.
1Changetothedirectoryforces-tutorial-files/tclForcesFiles/rot-c.2OpentheNAMDcon guration le,rot-c-short.namd.Thenewlinethistimeis
setforcesRecalcFreq10
Asitsnameimplies,thisparametersetshowoftenourforceswillberecalculated.