Topic Options
#37216 - 12/06/18 01:58 PM merge and recenter multiple dcd's
Rohit Offline
Forum Member

Registered: 10/25/17
Posts: 26
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.


Edited by Rohit (12/06/18 01:59 PM)

Top
#37219 - 12/06/18 03:17 PM Re: merge and recenter multiple dcd's [Re: Rohit]
rmv Online   content

Forum Member

Registered: 09/17/03
Posts: 8259
Loc: 39 03 48 N, 77 06 54 W
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


Top
#37222 - 12/07/18 12:54 AM Re: merge and recenter multiple dcd's [Re: rmv]
Rohit Offline
Forum Member

Registered: 10/25/17
Posts: 26
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

Top
#37223 - 12/07/18 10:58 AM Re: merge and recenter multiple dcd's [Re: Rohit]
rmv Online   content

Forum Member

Registered: 09/17/03
Posts: 8259
Loc: 39 03 48 N, 77 06 54 W
Perhaps there's some clue in the output ...
_________________________
Rick Venable
computational chemist


Top
#37225 - Yesterday at 11:51 PM Re: merge and recenter multiple dcd's [Re: rmv]
Rohit Offline
Forum Member

Registered: 10/25/17
Posts: 26
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).


Attachments
recenter_orient.job0.0.txt (6 downloads)



Edited by Rohit (Today at 01:21 AM)

Top
#37226 - Today at 06:37 AM Re: merge and recenter multiple dcd's [Re: Rohit]
lennart Offline

Forum Member

Registered: 09/25/03
Posts: 4688
Loc: ~ 59N, 15E
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

Top
#37227 - Today at 08:33 AM Re: merge and recenter multiple dcd's [Re: lennart]
Rohit Offline
Forum Member

Registered: 10/25/17
Posts: 26
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

Top
#37228 - Today at 11:34 AM Re: merge and recenter multiple dcd's [Re: Rohit]
rmv Online   content

Forum Member

Registered: 09/17/03
Posts: 8259
Loc: 39 03 48 N, 77 06 54 W
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


Top

Moderator:  John Legato, lennart