Re: restart a NAMD simulation after coordinate transformation in VMD (solution)

From: Vlad Cojocaru (
Date: Fri Oct 26 2007 - 09:10:10 CDT

Dear NAMD users,

I have found the solution to my problem. It was an easy one. I will
share it here in case somebody else will face the same problem.
Adding the following lines to the VMD script I posted in the first
email will solve the problem ($new_a, $new_b, and $new_c) are the new
periodic cell vectors after transformation of the coordinates with $tm1.

set a {a 0 0}
set b {0 b 0}
set c {0 0 c}
set new_a [vectrans $tm1 $a]
set new_b [vectrans $tm1 $b]
set new_c [vectrans $tm1 $c]
puts "the new periodic cell vectors are:"
puts "$new_a"
puts "$new_b"
puts "$new_c"

Sorry for sending to the list both questions and aswers to them ... But
at least with the answer there, if somebody searches the archive will
find the solution also.

Best wishes

Vlad Cojocaru wrote:

> Dear NAMD users,
> Regarding the problem mentioned in the email below, I believe that the
> error arises from the rotation of the entire periodic box during the
> coordinate transformations applied by the VMD script ... Therefore,
> the periodic cell vectors are not valid anymore ....
> Is this a correct guess ??
> If yes, could somebody give me a hint how to calculate the new cell
> vectors ... or how to avoid such a problem while transforming
> coordinates in VMD ?
> Thanks a lot
> Best regards
> vlad
> Vlad Cojocaru wrote:
>> Dear NAMD users,
>> I am trying to perform a simulation in which tclforces are used to
>> move a small part of the system with a ct velocity along a direction.
>> The center of mass of the other part of the system is constrained to
>> the initial position by applying an SMD with v=0.
>> As I read, such a procedure may be applied only if the SMD with v=0
>> is applied along x, y or z axis. I chose the x axis for that. Thus,
>> the force from tclforces will also be applied on the x axis. For that
>> I needed to apply some coordinate transformations to align the tcl
>> force direction along the x axis. I did that using the VMD script below.
>> Before running my simulation, for a test, I tried to run a standard
>> NPT simulation using the transformed coordinates (a.pdb at the end of
>> the VMD script). To my surprise, the simulation fails to even start
>> and the error "atoms moving too fast" appears right before ts=0
>> output. Now, the same simulation runs properly if instead of the
>> transformed coordinates I used the original coordinates (a_rst.coor).
>> However, the transoformed coordinates look absolutely fine when
>> loaded in VMD or other software with the corresponding topology file
>> (
>> Obviously NAMD has some problems in using the transformed coordinates
>> for the simulation. I would like to ask you if anybody has observed
>> such a behaviour before and could give me an advice on how to fix
>> this. Also, if you think of easier ways to do these tasks please let
>> me know (maybe one could do the coordinate transformations directly
>> in NAMD ...)
>> Thank you in advance for any suggestions
>> Best wishes
>> vlad
>> ---VMD script to transform coordinates ----
>> mol load parm7
>> mol addfile a_rst.coor type pdb
>> set all [atomselect top "all"]
>> set sel1 [atomselect top "resid 230"]
>> set center_sel1 [measure center $sel1]
>> set sel2 [atomselect top "name CA and resid 76 192"]
>> set center_sel2 [measure center $sel2]
>> set smd_dir [vecnorm [vecsub $center_sel2 $center_sel1]]
>> puts "Direction of force is $smd_dir"
>> set tm1 [transvecinv "$smd_dir"]
>> $all move $tm
>> unset all
>> set all [atomselect top "all"]
>> set center [measure center $all]
>> set tm2 [trans origin "$center"]
>> $all move $rm2
>> $all writepdb a.pdb
>> quit

Dr. Vlad Cojocaru
EML Research gGmbH
Schloss-Wolfsbrunnenweg 33
69118 Heidelberg
Tel: ++49-6221-533266
Fax: ++49-6221-533298
EML Research gGmbH
Amtgericht Mannheim / HRB 337446
Managing Partner: Dr. h.c. Klaus Tschira
Scientific and Managing Director: Prof. Dr.-Ing. Andreas Reuter

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:45:25 CST