Here is a way to run jobs on cluster in a continuous fashion. This example addresses NAMD jobs but should also work for others.
This web log is my online notebook for software tips and hacks to make my life and hopefully that of someone else just a little bit easy. Should you find any mistakes or have any useful suggestions, please do not hesitate to write to me. Peace! Pavan Ghatty
Showing posts with label namd. Show all posts
Showing posts with label namd. Show all posts
Thursday, May 10, 2012
Thursday, April 26, 2012
Extracting coordinates of protein from a simulation
set dir [pwd]
mol new ${dir}/ache.psf type {psf}
mol addfile ${dir}/ache.pdb type {pdb} waitfor all
mol addfile ${dir}/acheminnpt.dcd type {dcd} waitfor all
set molnum 0
set skip 1
set backframe0 [atomselect $molnum backbone frame 0]
for {set i 0} {$i < [molinfo $molnum get numframes]} {incr i $skip} {
set pro [atomselect $molnum protein frame $i]
# Change 'protein' to "resid N to Z" to suit your needs.
set back [atomselect $molnum backbone frame $i]
set trans_mat [measure fit $back $backframe0]
$pro move $trans_mat
set k [expr $i/$skip]
$pro writedcd ${dir}/dcd/project-pdb-$k.dcd
}
Now generate a protein-only psf file. At this stage you should have n number of dcd files. To join them all in to one dcd file,
mol new ${dir}/ache_protein.psf
set pro_frames [expr [molinfo $molnum get numframes]/$skip ]
for {set j 0} {$j < $pro_frames} {incr j 1} {
mol addfile ${dir}/dcd/project-pdb-$j.dcd
}
set top [molinfo top]
animate write dcd {${dir}/dcd/project_protein.dcd} beg 0 end [expr $pro_frames - 1] skip 1 [molinfo top]
The last step is where the individual files are stitched together.
mol new ${dir}/ache.psf type {psf}
mol addfile ${dir}/ache.pdb type {pdb} waitfor all
mol addfile ${dir}/acheminnpt.dcd type {dcd} waitfor all
set molnum 0
set skip 1
set backframe0 [atomselect $molnum backbone frame 0]
for {set i 0} {$i < [molinfo $molnum get numframes]} {incr i $skip} {
set pro [atomselect $molnum protein frame $i]
# Change 'protein' to "resid N to Z" to suit your needs.
set back [atomselect $molnum backbone frame $i]
set trans_mat [measure fit $back $backframe0]
$pro move $trans_mat
set k [expr $i/$skip]
$pro writedcd ${dir}/dcd/project-pdb-$k.dcd
}
Now generate a protein-only psf file. At this stage you should have n number of dcd files. To join them all in to one dcd file,
mol new ${dir}/ache_protein.psf
set pro_frames [expr [molinfo $molnum get numframes]/$skip ]
for {set j 0} {$j < $pro_frames} {incr j 1} {
mol addfile ${dir}/dcd/project-pdb-$j.dcd
}
set top [molinfo top]
animate write dcd {${dir}/dcd/project_protein.dcd} beg 0 end [expr $pro_frames - 1] skip 1 [molinfo top]
The last step is where the individual files are stitched together.
Tuesday, March 27, 2012
NAMD sample scripts
http://www.ks.uiuc.edu/Research/namd/2.7/ug/node64.html
This file demonstrates the analysis of a DCD trajectory file using NAMD. The file pair.pdb contains the definition of pair interaction groups; NAMD will compute the interaction energy and force between these groups for each frame in the DCD file. It is assumed that coordinate frames were written every 1000 timesteps. See Sec. 12.1 for more about pair interaction calculations.
This file demonstrates the analysis of a DCD trajectory file using NAMD. The file pair.pdb contains the definition of pair interaction groups; NAMD will compute the interaction energy and force between these groups for each frame in the DCD file. It is assumed that coordinate frames were written every 1000 timesteps. See Sec. 12.1 for more about pair interaction calculations.
# initial config
coordinates alanin.pdb
temperature 0
# output params
outputname /tmp/alanin-analyze
binaryoutput no
# integrator params
timestep 1.0
# force field params
structure alanin.psf
parameters alanin.params
exclude scaled1-4
1-4scaling 1.0
switching on
switchdist 8.0
cutoff 12.0
pairlistdist 13.5
stepspercycle 20
# Atoms in group 1 have a 1 in the B column; group 2 has a 2.
pairInteraction on
pairInteractionFile pair.pdb
pairInteractionCol B
pairInteractionGroup1 1
pairInteractionGroup2 2
# First frame saved was frame 1000.
set ts 1000
coorfile open dcd /tmp/alanin.dcd
# Read all frames until nonzero is returned.
while { ![coorfile read] } {
# Set firstTimestep so our energy output has the correct TS.
firstTimestep $ts
# Compute energies and forces, but don't try to move the atoms.
run 0
incr ts 1000
}
coorfile close
Subscribe to:
Posts (Atom)