FW: vmd-l: Stand-alone VMD ?

From: Mark Cunningham (cunningham_at_utpa.edu)
Date: Thu Feb 16 2012 - 15:45:55 CST

To the NAMD-L list:

There was a recent interchange on the VMD-L list about writing pdb
files from NAMD and scripting solutions from VMD that are not really
necessary. At the suggestion of one of the correspondents, I'm
forwarding a copy of a script that I use to run NAMD, one that I admit
I stole in large part from somewhere on the NAMD site and have subsequently
modified. In particular, because I run on multiple machines and have different
usernames and home directories on each, I create a NAMD_TOPPAR environment
variable on each machine to point to the local directory that contains the
CHARMM files. As M. Maroun points out, essentially all of the hard-coded
numbers "below the line" could be replaced with tcl variables defined "above
the line."

My usage reflects putting things "above the line" that are likely to change
in an equilibration/production sequence for a single system. Box sizes and
the like don't change within such a sequence (because the box size in a
restart is obtained from the .xsc file) but an equally reasonable strategy
would be to declare all numbers in the top as tcl variables that get
expanded later.

I also adopted the strategy of naming files root_01 ... root_nn. One of my
early mentors used to call things ionize, minimize, equilibrate, production, etc.
but I could never remember which came first. Now, the sequence is clear (04
comes before 05) but it remains a really good idea to write a descriptive
header because in a year when you get enough data to write the paper, you
won't remember what the 07 file did.

I hope this is helpful.

Mark

-----Original Message-----
From: R. Charbel Maroun [mailto:charbel.maroun_at_inserm.fr]
Sent: Thursday, February 16, 2012 9:01 AM
To: Mark Cunningham
Subject: RE: vmd-l: Stand-alone VMD ?

Hi,

Thanks a lot for your enlightening message. First because you
dissipate the doubts concerning the coor and pdb files ambiguity in
the NAMD script and then because of your very logical and clear
approach to a NAMD script.

If I may, you may generalize more your script by defining also the
fftx, ffty and fftz variables for PMEGridSize from the checkfft.str
file, and the cell dimensions from the step5_assembly.str file, as
shown in CHARMM-GUI.

I think you should post your reply to me in the NAMD forum.

Thanks again,

Charbel
-----------------------------------------
R. Charbel MAROUN, Ph.D., H.D.R.
Centre Interdisciplinaire de
Recherche en Biologie (CIRB)
CNRS UMR 7241/INSERM U1050
Collège de France
11 Place Marcelin Berthelot
75005 PARIS
Tél: +33 1 44 27 14 91
Fax: +33 1 44 27 14 76
e-mail charbel.maroun_at_inserm.fr
         charbel.maroun_at_college-de-france.fr

Mark Cunningham <cunningham_at_utpa.edu> a écrit :

> M. Maroun:
>
> This is really more of a NAMD question but I think you are
> somewhat misguided in your approach. NAMD does indeed require
> a coordinates directive but if you also set binCoordinates
> and binVelocities, then the coordinates are ignored. I just
> set coordinates to the initial pdb in the sequence and there is no
> need for the scripting that you are attempting. See the script
> below, where the initial solvated system was defined in 03,
> some minimization was done in step 04 and now I am going to do
> some more dynamics in step 05. Subsequent dynamics, etc., will
> all start with the coordinates pointing to b3apo_03.pdb, using
> the structure b3apo_03.psf.
>
> Mark
>
> ------------------------------------------------------------
>
>
> #############################################################
> ## JOB DESCRIPTION ##
> #############################################################
>
> # 3q6x apo initial minimization
> # hydroxide in active site
> #############################################################
> ## ADJUSTABLE PARAMETERS ##
> #############################################################
>
> set siminp b3apo_04 ;# Input file root
> set simout b3apo_05 ;# Output files root
> set simstruct b3apo_03 ;# PSF file
>
> set simtemp 300 ;# Simulation temperature
> set simminstep 0 ;# Minimization steps
> set simdynstep 100000 ;# Dynamics steps
> set simtimestep 1.0 ;# Time step (fs)
> set simrestart true ;# Use restart files
> set simpme true ;# Particle Mesh Ewald
> set simimd false ;# Interactive MD
> set simpbc true ;# Periodic Boundary Conditions
> set simNPT false ;# Constant pressure (Nose/Hoover)
> set simfixed false ;# Fixed atoms
> set simharm true ;# Harmonically constrained atoms
>
> #############################################################
> ## EXTRA PARAMETERS ##
> #############################################################
>
> # Put here any custom parameters that are specific to
> # this job (e.g., SMD, TclForces, etc...)
>
>
> #############################################################
> ## SIMULATION PARAMETERS ##
> ## Items beyond this point generally do not change when ##
> ## working in a single system. ##
> #############################################################
>
> structure $simstruct.psf
> coordinates $simstruct.pdb
> outputname $simout
>
> # Continuing a job from the restart files
> if {$simrestart} {
> binCoordinates $siminp.restart.coor
> binVelocities $siminp.restart.vel ;# remove the
> "temperature" entry if you use this!
> extendedSystem $siminp.xsc
> } else {
> firsttimestep 0
> temperature $simtemp
> }
>
> # Force field
> paraTypeCharmm on
> parameters $env(NAMD_TOPPAR)/par_all27_prot_na.inp
> parameters $env(NAMD_TOPPAR)/par_mac.inp
>
> # Force-Field Parameters
> exclude scaled1-4
> 1-4scaling 1.0
> cutoff 12.
> switching on
> switchdist 10.
> pairlistdist 13.5
>
> # Periodic Boundary conditions
> # NOTE: Do not set the periodic cell basis if you have also
> # specified an .xsc restart file!
> if {$simpbc} {
> if {!$simrestart} {
> cellBasisVector1 70.18 0.00 0.00
> cellBasisVector2 0.00 68.53 0.00
> cellBasisVector3 0.00 0.00 102.14
> cellOrigin 0.00 0.00 0.00
> }
> wrapWater on
> wrapAll on
> }
>
> # Integrator Parameters
> numsteps $simdynstep
> timestep $simtimestep
> rigidBonds all ;# needed for 2fs steps
> nonbondedFreq 1
> fullElectFrequency 2
> stepspercycle 10
>
> #PME (for full-system periodic electrostatics)
> if {$simpme} {
> PME yes
> PMEGridSizeX 72
> PMEGridSizeY 72
> PMEGridSizeZ 108
> }
>
>
> # Constant Temperature Control
> langevin on ;# do langevin dynamics
> langevinDamping 5 ;# damping coefficient (gamma) of 5/ps
> langevinTemp $simtemp
> langevinHydrogen no ;# don't couple langevin bath to hydrogens
>
>
> # Constant Pressure Control (variable volume)
> if {$simNPT} {
> useGroupPressure yes ;# needed for 2fs steps
> useFlexibleCell no ;# no for water box, yes for membrane
> useConstantArea no ;# no for water box, yes for membrane
>
> langevinPiston on
> langevinPistonTarget 1.01325 ;# in bar -> 1 atm
> langevinPistonPeriod 100.
> langevinPistonDecay 50.
> langevinPistonTemp $simtemp
> }
>
>
> restartfreq 500 ;# 500steps = every 1ps
> dcdfreq 500
> xstFreq 500
> outputEnergies 100
> outputPressure 100
>
>
> # Fixed Atoms (set PDB beta-column to 1)
> if {$simfixed} {
> fixedAtoms on
> fixedAtomsFile myfixedatoms.pdb
> fixedAtomsCol B
> } else {
> fixedAtoms off
> }
>
> # Harmonically Constrained Atoms (set PDB occupancy-column to k)
> if {$simharm} {
> constraints on
> consref $siminp.harm
> conskfile $siminp.harm
> conskcol O
> } else {
> constraints off
> }
>
>
> # IMD Settings (can view sim in VMD)
> if {$simimd} {
> IMDon on
> IMDport 3000 ;# port number (enter it in VMD)
> IMDfreq 1 ;# send every 1 frame
> IMDwait no ;# wait for VMD to connect before running?
> }
>
> #############################################################
> ## EXECUTION SCRIPT ##
> #############################################################
>
> # Minimization
> if {$simminstep > 0} {
> minimize $simminstep
> reinitvels $simtemp
> }
>
> # Dynamics
> if {$simdynstep > 0} {
> run $simdynstep
> }
>
> -----------------------------------------------------------------------------
>
> -----Original Message-----
> From: owner-vmd-l_at_ks.uiuc.edu [mailto:owner-vmd-l_at_ks.uiuc.edu] On
> Behalf Of R. Charbel Maroun
> Sent: Monday, February 13, 2012 5:59 AM
> To: Salvatore Mario Cosseddu
> Cc: vmd-l_at_ks.uiuc.edu
> Subject: Re: vmd-l: Stand-alone VMD ?
>
> Dear Salvatore,
>
> Thanks for your reply. Indeed, "bincoordinates" is a binary coordinate
> restart file generated by an NAMD run, but "coordinates" is a pdb file
> not generated by an NAMD run, and NAMD cannot do without that file.
> So, in between NAMD runs, I have to convert coor files into pdb files.
>
> By script I meant actually a shell script and a VMD script. For the
> first one, I I came up with :
>
> #!/bin/bash
> charmrun ++local +p8 /usr/local/NAMD_2.8_Linux-x86_64/namd2
> step6.5_equilibration.inp > step65A.log;
> vmd -dispdev text -e vmd65A.com;
> charmrun ++local +p8 /usr/local/NAMD_2.8_Linux-x86_64/namd2
> step6.6_equilibration.inp > step66A.log;
> vmd -dispdev text -e vmd66A.com;
> charmrun ++local +p8 /usr/local/NAMD_2.8_Linux-x86_64/namd2
> step7.1_production.inp > step71A.log;
> vmd -dispdev text -e vmd71A.com;
>
> where vmd*.com are the VMD Tcl command files obtained by turning on
> the Log Tcl Commands option in VMD so as to be able to read coor and
> psf files from a previous run and save as pdb for the next run.
>
> Cheers,
>
> CM
>
> Salvatore Mario Cosseddu <S.M.Cosseddu_at_warwick.ac.uk> a écrit :
>
>> Dear Charbel
>>
>> This is the command
>> vmd -dispdev none
>> or
>> vmd -dispdev none
>>
>> for your purpose do you know "bincoordinates"? Have a look in the
>> NAMD guide.
>> You don't need a pdb file, NAMD can read its own binary files.
>>
>> Anyway, what do you mean by script? Bash script? Does something like
>> this look fine?
>>
>> #!/bin/sh
>>
>> ###############
>> #a lot of shell scripting here
>> ####################
>>
>> # VMD call
>> echo "animate read coor filename.coord waitfor all ;
>> [atomselect top all] writepdb filename.pdb
>> " | vmd -dispdev none -eofexit
>>
>> ###############
>> #a lot of more shell scripting here
>> ####################
>>
>> exit 0
>>
>>
>> Be careful to escape " and $
>>
>> To answer to your second question, look to this option "binaryoutput"
>> in the manual. Try if setting it as "no" is what you are looking for.
>> But you lose accuracy in case you'd like to restart your simulation.
>>
>>
>>
>> On 10/02/12 11:26, R. Charbel Maroun wrote:
>>> Hello VMDers,
>>>
>>> Is it possible to run VMD in stand-alone (non-graphical) mode ?
>>> Within a script, I just want to be able to read a .coor NAMD binary
>>> file and save it as an ASCII
>>> .pdb file for further use in NAMD.
>>>
>>> An alternative question is, how can I get NAMD to write a .pdb file
>>> after an MD ? I tried writepdb <filename> in an NAMD script and it
>>> gives the following error:
>>>
>>> ------------- Processor 7 Exiting: Called CmiAbort ------------
>>> Reason: FATAL ERROR: Setting parameter writepdb from script failed!
>>>
>>> I use VMD 1.9 and NAMD 2.8.
>>>
>>> Cheers,
>>>
>>> CM
>>>
>>>
>>>
>>> ----------------------------------------------------------------
>>> This message was sent using IMP, the Internet Messaging Program.
>>>
>>>
>>
>> --
>> Salvatore Cosseddu
>> PhD student
>>
>> Centre for Scientific Computing and School of Engineering
>> University of Warwick
>> Coventry CV4 7AL
>> United Kingdom
>>
>> email: S.M.Cosseddu_at_warwick.ac.uk
>
>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
>
>
>

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

This archive was generated by hypermail 2.1.6 : Mon Dec 31 2012 - 23:21:13 CST