set topologyFilePath {/NAMD/toppar} ; # Folder with topology/parameters files set structureFileNameBase {mscl_c-o-int_cls_popc_hex_salt_adw} set startupFileNameBase {equil-rsold-g10_mscl_c-o-int_cls_popc_hex_salt_adw_00000} ; # Starting coordinates filename, only for the first simulation cycle. For the following cycles it will be replaced by the output/restart filename of the previous cycle set outputFileNameBase {sim-g10_mscl_c-o-int_cls_popc_hex_salt_adw} ; # Output filenames will be constructed with this filename base, plus addition of the first timestep of the simulation cycle set firstTimestep 0 ; # The very first timestep - for every next simulation cycle it will be set to the value of the last timestep of the previous simulation cycle set lastTimestep 3000000 ; # The very last timestep - the final timestep of the last simulation cycle set numsteps 200000 ; # The whole simulation will be divided into cycles. Every simulation cycle will be not longer than this length set workingFolder {/simulations/mscl_c-o-int/sim-g10_cls} ; # The folder for all the simulation files set simStatusFileName {sim_status.txt} ; # Status file containing the first timestep of the last simulation cycle set logOutputFiles 1 # _____________________________ Estimate simulation status # Check if status file exists if {[file exists $simStatusFileName] == 0} { # Status file does not exist. Initialize status parameters puts "Status file does not exist. Initializing status parameters." # Make a copy for the log, if necessary if {$logOutputFiles == 1} { set fileLook [open $simStatusFileName.log w] puts $fileLook "# Autogenerated minimization status file log" puts $fileLook "firstTimestepCycle\tTimeStamp" close $fileLook } set firstTimestepCycle $firstTimestep set suffixIn {} } else { # status file exists. Read it puts "Reading status file..." set fileLook [open $simStatusFileName r] # read status file and recognize data while {[gets $fileLook line] >= 0} { set lineRecognize [lindex $line 0] switch -regexp $lineRecognize { "^firstTimestepCycle$" { # First Timestep from the previous simulation puts "$line" set firstTimestepCycle [lindex $line 1] } default { } } } close $fileLook # Check if the previous simulation finished successfully set suffixIn [format "_%0[string length $lastTimestep]i" [expr {$firstTimestepCycle}]] if {[file exists $outputFileNameBase$suffixIn.xsc]==1} { # Previous simulation cycle finished successfully. Read the final timestep from there set fileLook [open $outputFileNameBase$suffixIn.xsc r] while {[gets $fileLook line] >= 0} { set lineRecognize [lindex $line 0] } close $fileLook set firstTimestepCycle $lineRecognize } else { # Previous simulation cycle was not finished successfully. Try to read the restart file from the crushed simulation puts "Previous simulation cycle was not finished successfully. Restarting the crushed simulation" if {[file exists $outputFileNameBase$suffixIn.restart.xsc]==1} { # Previous simulation cycle made the restart file set fileLook [open $outputFileNameBase$suffixIn.restart.xsc r] while {[gets $fileLook line] >= 0} { set lineRecognize [lindex $line 0] } close $fileLook set firstTimestepCycle $lineRecognize set suffixIn [append suffixIn ".restart"] } else { # No restart file found. Leaving firstTimestep as it was for the previous simulation cycle } } } # _____________________________ Decide, if the last simulation step was reached if {$firstTimestepCycle>=$lastTimestep} { # the last simulation step was reached. Create the mark of the finished simulation puts "Target simulation step reached!" set fileLook [open $simStatusFileName.end w] puts $fileLook "# Autogenerated minimization status file" puts $fileLook "firstTimestepCycle\t$firstTimestepCycle" close $fileLook } else { # _____________________________ Record firstTimestep into status file and log file # Save simulation status file set fileLook [open $simStatusFileName w] puts $fileLook "# Autogenerated minimization status file" puts $fileLook "firstTimestepCycle\t$firstTimestepCycle" close $fileLook # Make a copy for the log, if necessary if {$logOutputFiles == 1} { set fileLook [open $simStatusFileName.log a] puts $fileLook "$firstTimestepCycle\t[clock format [clock seconds] -format %c]" close $fileLook } # _____________________ Perform the next cycle of simulation # calculate numstepsCycle set numstepsCycle [expr {($firstTimestepCycle+$numsteps)>$lastTimestep?$lastTimestep:($firstTimestepCycle+$numsteps)}] # Define filename for the initial coordinates etc. files - restartFileNameBase if {$firstTimestepCycle==$firstTimestep} { # This is the very first simulation cycle set restartFileNameBase $startupFileNameBase } else { # There were simulation cycles before set restartFileNameBase $outputFileNameBase } # Define output number suffix set suffixOut [format "_%0[string length $lastTimestep]i" [expr {$firstTimestepCycle}]] # _____________________________ Set simulation parameters structure $structureFileNameBase.psf coordinates $structureFileNameBase.pdb bincoordinates $restartFileNameBase$suffixIn.coor binvelocities $restartFileNameBase$suffixIn.vel # # Alternative for the binvelocities for the first step - temperature # if {$firstTimestepCycle==$firstTimestep} { # # This is the very first simulation cycle # temperature 310 # } else { # # There were simulation cycles before # binvelocities $restartFileNameBase$suffixIn.vel # } extendedSystem $restartFileNameBase$suffixIn.xsc parameters $topologyFilePath/par_all27_prot_lipid_cer.inp paraTypeCharmm on # constraints on # consRef mscl_c-o-int_cls_popc_hex_salt_cor_rsbb.pdb # consKFile mscl_c-o-int_cls_popc_hex_salt_cor_rsbb.pdb # consKCol B outputName $outputFileNameBase$suffixOut XSTfile $outputFileNameBase$suffixOut.xst outputEnergies 500 outputTiming 500 outputPressure 10 dcdFreq 500 restartFreq 10000 xstFreq 500 wrapAll on wrapNearest on numsteps $numstepsCycle firstTimestep $firstTimestepCycle timestep 1 nonBondedFreq 2 fullElectFrequency 4 stepsPerCycle 20 switching on switchDist 8.5 cutoff 10 pairlistdist 11.5 cellBasisVector1 117.035 0.0 0.0 cellBasisVector2 58.5169 98.4776 0 cellBasisVector3 0.0 0.0 136 cellOrigin 00.00 00.00 -7.50 Pme on PmeGridsizeX 110 PmeGridsizeY 110 PmeGridsizeZ 136 exclude scaled1-4 1-4scaling 1.0 langevin on langevinDamping 10 langevinTemp 310 langevinHydrogen no langevinPiston on langevinPistonTarget 1.01325 langevinPistonPeriod 200 langevinPistonDecay 100 langevinPistonTemp 310 SurfaceTensionTarget 10 useGroupPressure yes useFlexibleCell yes DCDUnitCell yes pressureProfile on pressureProfileSlabs 130 pressureProfileFreq 100 }