Previous Thread
Next Thread
Print Thread
merge and recenter multiple dcd's
#37216 12/06/18 06:58 PM
Joined: Oct 2017
Posts: 38
R
Rohit Offline OP
Forum Member
OP Offline
Forum Member
R
Joined: Oct 2017
Posts: 38
Hi,

I have few dcds which i want to merge and recenter.

Code:
READ PSF CARD NAME ./../eqf10/@EQHEATPSF
READ COOR PDB NAME ./../eqf10/@EQHEATPDB

open read unit 51 file name ../output/@i/unfold_1le0.job0.@i.sort.dcd
open read unit 52 file name ../output/@i/unfold_1le0.job1.@i.sort.dcd

!!!!!TRAJECTORY FIRSTU 51 NUNIT 1 IREAD BEGIN 0 STOP 10000000 SKIP 2500
!!!!!TRAJ READ

open write unit 61 file name ./../anal/recen/@i/unfold_1le0.joball.@i.recen.dcd

! Here you need the same set of image or crystal definitions as were used 
! when the trajectory was created	
crystal define CUBIc  50. 50. 50. 90.0 90.0 90.0
crystal build noper 0

! Image statemnts for those molecules that should be recentered
image byresidue sele all end
 
merge firstu 51 nunit 2 skip 0 output 61 - !!!!begin 0 stop 10000000 -
  orient recenter sele all end sele segid PRT .and. .not. hydrogen end


this script runs fine for single dcd. i want to run it on 2 or more dcd's.
but this only writes first dcd to unit 61. how can i merge these dcd's.

Last edited by Rohit; 12/06/18 06:59 PM.
Re: merge and recenter multiple dcd's
Rohit #37219 12/06/18 08:17 PM
Joined: Sep 2003
Posts: 8,479
rmv Online Content
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 8,479
Try using the NFILE option of the MERGE command, and set it to the sum of the number of frames from all files. CHARMM expects to be merging consecutive dynamics files, and can have problems if the trajectory headers are not consistent with consecutive files.

You can get some clues from TRAJ QUERY, after the files are OPENed:

TRAJ QUERY UNIT 51
TRAJ QUERY UNIT 52


Rick Venable
computational chemist

Re: merge and recenter multiple dcd's
rmv #37222 12/07/18 05:54 AM
Joined: Oct 2017
Posts: 38
R
Rohit Offline OP
Forum Member
OP Offline
Forum Member
R
Joined: Oct 2017
Posts: 38
Tried few modification but still it writes only 1 dcd to all.dcd
Code:
open read unit 51 file name ../output/@i/unfold_1le0.job0.@i.sort.dcd
open read unit 52 file name ../output/@i/unfold_1le0.job1.@i.sort.dcd
TRAJ QUERY UNIT 51
TRAJ QUERY UNIT 52
calc ntot = 2 * ?nfile

TRAJECTORY FIRSTU 51 NUNIT 2 IREAD BEGIN 0 SKIP 1
!!!!!TRAJ READ

!!!!!!!!!!open unit 61 write file name @odcd
open write unit 61 file name ./../anal/recen/@i/unfold_1le0.joball.@i.recen.dcd

! Here you need the same set of image or crystal definitions as were used 
! when the trajectory was created	
crystal define CUBIc  50. 50. 50. 90.0 90.0 90.0
crystal build noper 0

! Image statemnts for those molecules that should be recentered
image byresidue sele all end
 
merge firstu 51 nunit 2 skip 1 output 61 nfile @NTOT begin 0 stop 8000 -
  orient recenter sele all end sele segid PRT .and. .not. hydrogen end

Re: merge and recenter multiple dcd's
Rohit #37223 12/07/18 03:58 PM
Joined: Sep 2003
Posts: 8,479
rmv Online Content
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 8,479
Perhaps there's some clue in the output ...


Rick Venable
computational chemist

Re: merge and recenter multiple dcd's
rmv #37225 12/10/18 04:51 AM
Joined: Oct 2017
Posts: 38
R
Rohit Offline OP
Forum Member
OP Offline
Forum Member
R
Joined: Oct 2017
Posts: 38
I have attached log file. dcd 1 = 658 mb dcd 2 = 658 mb. after merge recenter all.dcd = 658 mb.

to check i opened it with vmd it shows 4000 frames instead of 8000 frames(4000+4000).

Attached Files
recenter_orient.job0.0.txt (12.13 KB, 142 downloads)
Last edited by Rohit; 12/10/18 06:21 AM.
Re: merge and recenter multiple dcd's
Rohit #37226 12/10/18 11:37 AM
Joined: Sep 2003
Posts: 4,783
Likes: 2
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 4,783
Likes: 2
If the problem is that the two files are not properly consecutive as expected by CHARMM you may try adding the keyword NOCHECK to the MERGE command.


Lennart Nilsson
Karolinska Institutet
Stockholm, Sweden
Re: merge and recenter multiple dcd's
lennart #37227 12/10/18 01:33 PM
Joined: Oct 2017
Posts: 38
R
Rohit Offline OP
Forum Member
OP Offline
Forum Member
R
Joined: Oct 2017
Posts: 38
They are consecutive files.

I have changed my script now.
Code:
!================================================================
! Crystal definition and cutoffs
!================================================================
set ci  10.   ! inner switching cutoff
set rc  12.   ! cutoff
set ctl 14.   ! list-cutoff
set xo  14.   ! cutoff for crystal

set 6 50.
set ang 90

crystal defi cubic @6 @6 @6 @ang @ang @ang
crystal build Noper 0
IMAGE BYRES XCEN 0.0 YCEN 0.0 ZCEN 0.0 SELE ALL END
IMAGE BYRES XCEN 0.0 YCEN 0.0 ZCEN 0.0 SELE RESNAME TIP3 END

!================================================================                         
!Set up for reading coordinate sets from trajectory and writing data                      
!================================================================                         
OPEN UNIT 51 READ UNFORMATTED NAME ../output/@i/unfold_1le0.job0.@i.sort.dcd
OPEN UNIT 52 READ UNFORMATTED NAME ../output/@i/unfold_1le0.job1.@i.sort.dcd

OPEN WRITE UNIT 19 FILE NAME ./../anal/recen/@i/unfold_1le0.joball.@i.recen.dcd
TRAJECTORY QUERY UNIT 51
CALC NTOT = ?NFILE * 2
TRAJECTORY NUNIT 2 IREAD 51 IWRITE 19 SKIP 1 NFILE @NTOT

!================================================================
!Loop for reading coordinate sets and calculating distances
!================================================================
SET i 1         ! loop index i
LABEL LOOP

TRAJECTORY READ
UPDATE
TRAJECTORY WRITE

INCREMENT i
IF i LE @NTOT GOTO LOOP

STOP


Even this gives error as follows
Code:
CHARMM>    TRAJECTORY WRITE
 TRAJ: WRITING NEXT TRAJECTORY FILE,  OPTIONS;
  SKIP=      1 NPRIV=      0 NSTEP=   8000 TRAJU=     19

  
 CHARMM>     
  
 CHARMM>    INCREMENT i
 Parameter: I <- "2"
  
 CHARMM>    IF i LE @NTOT GOTO LOOP
 Parameter: NTOT -> "8000"
 Comparing "2" and "8000".
 IF test evaluated as true.  Performing command
  
 CHARMM>     
  
 CHARMM>    TRAJECTORY READ

      ***** LEVEL -1 WARNING FROM <REATRJ> *****
      ***** INPUT TRAJECTORY NOT SET UP.
      ******************************************
      BOMLEV (  0) IS REACHED - TERMINATING. WRNLEV IS  5

Re: merge and recenter multiple dcd's
Rohit #37228 12/10/18 04:34 PM
Joined: Sep 2003
Posts: 8,479
rmv Online Content
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 8,479
Check for other messages, esp. from opening the input trajectory files.

If the files were not produced by CHARMM or have been modified by some other program, the file headers may not conform to what is expected by CHARMM, which can cause problems such as this.


Rick Venable
computational chemist

Re: merge and recenter multiple dcd's
Rohit #37229 12/10/18 07:12 PM
Joined: Sep 2003
Posts: 4,783
Likes: 2
Forum Member
Online Content
Forum Member
Joined: Sep 2003
Posts: 4,783
Likes: 2
You may of course test this by running the simulation in CHARMM.


Lennart Nilsson
Karolinska Institutet
Stockholm, Sweden
Re: merge and recenter multiple dcd's
Rohit #37232 12/11/18 08:03 AM
Joined: Oct 2017
Posts: 38
R
Rohit Offline OP
Forum Member
OP Offline
Forum Member
R
Joined: Oct 2017
Posts: 38
I have checked the above script with TRAJ and MERGE command. This works fine for DCD from Charmm but it gives error with DCD coming from NAMD.

I have Also noticed that while reading Charmm gets some extra information like number of previous steps while reading charmm dcd but this is set to 0 if dcd is read from namd.

I will have to ask in NAMD forum about this.

Thank-you,
Regards,
Rohit


Moderated by  lennart, rmv 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 5.6.33-0+deb8u1 Page Time: 0.014s Queries: 35 (0.005s) Memory: 0.9748 MB (Peak: 1.1090 MB) Data Comp: Off Server Time: 2020-08-06 15:35:49 UTC
Valid HTML 5 and Valid CSS