Page 1 of 3 1 2 3 >
Topic Options
#324 - 10/23/03 06:31 AM merge-orient-trajectory.inp
lennart Offline

Forum Member

Registered: 09/25/03
Posts: 4688
Loc: ~ 59N, 15E
*FILENAME: merge-orient-trajectory.inp
*PURPOSE: merge trajectories, orienting wrt initial protein coordinates, and removing solvent
*AUTHOR: Lennart Nilsson, Karolinska Institutet, October 2003
*
!unix environment variable CHM_HOME points to CHARMM installation directory
read rtf card name $CHM_HOME/toppar/top_all22_prot.inp
read para card name $CHM_HOME/toppar/par_all22_prot.inp
read psf card name my_psf.psf
read coor card name my_reference.crd
! put reference coordinates into comparison set as well
coor copy comp
! Initial trajectory
open unit 51 read unform name traj_1.cor
open unit 52 read unform name traj_2.cor
! New, merged trajectory
open unit 81 write unform name traj_orient_nosolv.cor

merge first 51 nunit 2 output 81 skip 500 - ! one frame/ps is all we need
sele segid prot end orient mass sele segid prot .and. .not. hydrogen end
! first selection picks up those atoms that will be written to new trajectory
! second selection is used in the least squares re-orienting of each frame

! save new psf that is compatible with the new trajectory
delete atom sele .not. segid prot end

write psf card name new_psf.psf
* psf after deleting everything but the protein segment
*
_________________________
Lennart Nilsson
Karolinska Institutet
Stockholm, Sweden

Top
#31906 - 05/13/13 10:27 PM Re: merge-orient-trajectory.inp [Re: lennart]
swmmr1928 Offline
Forum Member

Registered: 10/07/12
Posts: 24
I only want to remove water. Can I remove these lines:

sele segid prot end orient mass sele segid prot .and. .not. hydrogen end
! first selection picks up those atoms that will be written to new trajectory
! second selection is used in the least squares re-orienting of each frame

Top
#31907 - 05/14/13 02:31 AM Re: merge-orient-trajectory.inp [Re: lennart]
lennart Offline

Forum Member

Registered: 09/25/03
Posts: 4688
Loc: ~ 59N, 15E
No.
This is the merge command you need:
merge first 51 nunit 2 output 81 skip 500 sele segid prot end
_________________________
Lennart Nilsson
Karolinska Institutet
Stockholm, Sweden

Top
#31908 - 05/14/13 08:10 AM Re: merge-orient-trajectory.inp [Re: lennart]
swmmr1928 Offline
Forum Member

Registered: 10/07/12
Posts: 24
Thanks.
Can the trajectory be .dcd (NAMD) instead of .cor ?

Top
#31909 - 05/14/13 08:27 AM Re: merge-orient-trajectory.inp [Re: lennart]
rmv Online   content

Forum Member

Registered: 09/17/03
Posts: 8259
Loc: 39 03 48 N, 77 06 54 W
File extensions are not important for CHARMM, only VMD, and for that app, .cor implies a formatted coordinate file, not a trajectory.

If the trajectory you wish to process has a protein and the initial PSF was not made with CHARMM and exported as an X-PLOR PSF, there may be problems, esp. with any subsequent analysis using CHARMM.
_________________________
Rick Venable
computational chemist


Top
#31970 - 05/22/13 11:18 PM Re: merge-orient-trajectory.inp [Re: lennart]
swmmr1928 Offline
Forum Member

Registered: 10/07/12
Posts: 24
I want to merge 94 trajectory files, but this cannot be done in one script without exceeding 99 unit numbers. I merged into 3 parts and then tried to merge the 3 parts. The default skip is 2ooo, but I changed it to 8ooo because I want it compressed.

I get an error when combining the files:
"At line 959 of file dynio.f
Fortran runtime error: End of file"

The script to combine


stream toppar.str

read psf card name "/export/lustre_1/dpc/sim1/w-dpc-1.psf"
open unit 2 card read name "/export/lustre_1/dpc/sim1/w-dpc-1.pdb"
read coor pdb resid unit 2

! put reference coordinates into comparison set as well
coor copy comp

open unit 50 read unform name traj_part1.cor
open unit 51 read unform name traj_part2.cor
open unit 52 read unform name traj_part3.cor

open unit 40 write unform name traj_part1_2_3.cor

merge first 50 nunit 3 output 40 skip 8000

Top
#31971 - 05/23/13 02:33 AM Re: merge-orient-trajectory.inp [Re: lennart]
lennart Offline

Forum Member

Registered: 09/25/03
Posts: 4688
Loc: ~ 59N, 15E
You can open more than 99 files; I recommend starting with unit numbers above 100.

The error message you get means that there is less data in one of the three files than what is indicated in its header. Are the files OK? Perhaps something went wrong in the preceding merge?

It is best to post the complete output.
_________________________
Lennart Nilsson
Karolinska Institutet
Stockholm, Sweden

Top
#31976 - 05/23/13 09:14 PM Re: merge-orient-trajectory.inp [Re: lennart]
swmmr1928 Offline
Forum Member

Registered: 10/07/12
Posts: 24
In that case i will use the units above 100 and avoid this idea. The problem maybe was skipping.

One more question:
Say i merge X trajectories-default skip is 2ooo, but I use 32ooo. I load in VMD and it shows a total of 1438 frames. At frame 600, something interesting happens. What trajectory file did this occur in?
(600/1438)*X

Top
#31977 - 05/23/13 10:45 PM Re: merge-orient-trajectory.inp [Re: lennart]
rmv Online   content

Forum Member

Registered: 09/17/03
Posts: 8259
Loc: 39 03 48 N, 77 06 54 W
The number of frames per file is needed.

It's easier to determine if (requested_SKIP/default_SKIP) divides evenly into the number of frames per file.
_________________________
Rick Venable
computational chemist


Top
#31978 - 05/24/13 11:54 AM Re: merge-orient-trajectory.inp [Re: rmv]
swmmr1928 Offline
Forum Member

Registered: 10/07/12
Posts: 24
VMD shows 250 frames per trajectory (unmodified trajectory)

Top
#31979 - 05/24/13 12:00 PM Re: merge-orient-trajectory.inp [Re: lennart]
rmv Online   content

Forum Member

Registered: 09/17/03
Posts: 8259
Loc: 39 03 48 N, 77 06 54 W
(600*(32/2))/250
_________________________
Rick Venable
computational chemist


Top
#31980 - 05/24/13 01:00 PM Re: merge-orient-trajectory.inp [Re: lennart]
swmmr1928 Offline
Forum Member

Registered: 10/07/12
Posts: 24
If I plug into that formula frame 1468 (the last frame of the merge traj, which should be the last trajectory), (1468*(32/2))/250=94 I should expect 110=150-40=(final traj in merge)-(initial traj in merge)


Edited by swmmr1928 (05/24/13 01:02 PM)

Top
#31981 - 05/24/13 01:36 PM Re: merge-orient-trajectory.inp [Re: lennart]
rmv Online   content

Forum Member

Registered: 09/17/03
Posts: 8259
Loc: 39 03 48 N, 77 06 54 W
Not 1438 frames, as indicated above?

No. of files = 1 + (last-first), so in principle you've merged 111 files. The expected total from the merge, assuming no errors should be

111*250*(2/32) or 1734 frames

It doesn't add up; you're going to have to actually look at the output log files.
_________________________
Rick Venable
computational chemist


Top
#31985 - 05/27/13 03:01 PM Re: merge-orient-trajectory.inp [Re: lennart]
swmmr1928 Offline
Forum Member

Registered: 10/07/12
Posts: 24
My incorrect "nunit" is the cause. Thanks.

Top
#35084 - 06/11/15 01:17 PM Re: merge-orient-trajectory.inp [Re: lennart]
Nixon Offline
Forum Member

Registered: 09/03/14
Posts: 5
My reference structure has one atom less than the trajectory. The reference and the trajectory structures are different protein where it differs with one extra ion in it.

I need to merge 150 .crd files (883 atoms) into a single .dcd file after least square fitting it with a reference structure (882 atoms).

i was using the modified merge-orient-trajectory in the basic script. The error is number of atoms mismatch. I need to write all the atoms present in the .crd to the dcd. So , please help me.

Is it possible


Edited by Nixon (06/11/15 01:38 PM)

Top
#35085 - 06/11/15 01:30 PM Re: merge-orient-trajectory.inp [Re: lennart]
Nixon Offline
Forum Member

Registered: 09/03/14
Posts: 5
MY code is below

bomlev -1
set dcd = ./dcd
set fid = cg.polar
set refdir = /home/nixon/phd/nw_flucts/proa/

read rtf card name top.inp
read para card name par.inp
read psf card name @refdir/@fid.psf
read coor card name @refdir/@fid.crd

! put reference coordinates into comparison
coor copy comp

! New, merged trajectory
open write unit 160 file name merged.dcd
traj iwrite 160 nwrite 1 nfile 149 skip 1
* trajectory of merged crd files
*

set 1 1
set 2 11
LABEL LOOP1
open read unit @2 form name @dcd/cg.@1.crd
read coor card unit @2
close unit @2
traj write
incr 1 BY 1
incr 2 by 1
IF 1 LT 150 GOTO LOOP1

define mysel sele segid PROA .and. .not. resname A299 end

merge first 11 nunit 149 output 160 skip 1 - ! one frame/ps is all we need
sele segid PROB end orient mass sele mysel end

stop

Top
#35087 - 06/11/15 01:40 PM Re: merge-orient-trajectory.inp [Re: Nixon]
Nixon Offline
Forum Member

Registered: 09/03/14
Posts: 5
[quote=Nixon]MY code is below

bomlev -1
set dcd = ./dcd
set fid = cg.polar
set refdir = /home/nixon/phd/nw_flucts/proa/

read rtf card name top.inp
read para card name par.inp
read psf card name @refdir/@fid.psf
read coor card name @refdir/@fid.crd

! put reference coordinates into comparison
coor copy comp

! New, merged trajectory
open write unit 160 file name merged.dcd
traj iwrite 160 nwrite 1 nfile 149 skip 1
* trajectory of merged crd files
*

set 1 1
set 2 11
LABEL LOOP1
open read unit @2 form name @dcd/cg.@1.crd
read coor card unit @2
close unit @2
traj write
incr 1 BY 1
incr 2 by 1
IF 1 LT 150 GOTO LOOP1

define mysel sele segid PROA .and. .not. resname A299 end

merge first 11 nunit 149 output 160 skip 1 - ! one frame/ps is all we need
sele segid PROB end orient mass sele mysel end

stop

Top
#35088 - 06/11/15 01:43 PM Re: merge-orient-trajectory.inp [Re: lennart]
Nixon Offline
Forum Member

Registered: 09/03/14
Posts: 5
I get this error

At line 2111 of file /c37b2/source/dynamc/cvio.src (unit = 11, file = 'fort.11')
Fortran runtime error: End of file

And this is the final part of my log file output

CHARMM> IF 1 LT 150 GOTO LOOP1
Comparing "149" and "150".
IF test evaluated as true. Performing command

CHARMM> open read unit @2 form name @dcd/cg.@1.crd
Parameter: 2 -> "159"
Parameter: DCD -> "./DCD"
Parameter: 1 -> "149"
VOPEN> Attempting to open::./dcd/cg.149.crd::
OPNLGU> Unit159 opened for READONLY access to ./dcd/cg.149.crd

CHARMM> read coor card unit @2
Parameter: 2 -> "159"
SPATIAL COORDINATES BEING READ FROM UNIT159
TITLE> * FRAME 4000 FROM /HOME/NIXON/PHD/NW_FLUCTS/3CM5/MONO_3CM5/POLAR/DCD/CG.149.DCD
TITLE> *

** WARNING ** For atom in coordinate file, the residue number is out of range, and is thus ignored:

IRES= 300 RESNAME= A300 TYPE= A883
*** LEVEL 1 WARNING *** BOMLEV IS -1

** WARNING ** Coordinates were overwritten for 882 atoms.

** MESSAGE ** 1 atoms in coordinate file were outside the specified sequence range.
*** LEVEL 2 WARNING *** BOMLEV IS -1

CHARMM> close unit @2
Parameter: 2 -> "159"
VCLOSE: Closing unit 159 with status "KEEP"

CHARMM> traj write

149 COORDINATE SETS STARTING FROM
STEP NO 1 FOR EVERY 1 STEPS
WRITTEN ON UNIT 160

VCLOSE: Closing unit 160 with status "KEEP"

CHARMM> incr 1 BY 1
Parameter: 1 <- "150"

CHARMM> incr 2 by 1
Parameter: 2 <- "160"

CHARMM> IF 1 LT 150 GOTO LOOP1
Comparing "150" and "150".
IF test evaluated as false. Skipping command

CHARMM>

CHARMM> define mysel sele segid 3cg7 .and. .not. resname A299 end
SELRPN> 881 atoms have been selected out of 882

CHARMM>

CHARMM> merge first 11 nunit 149 output 160 skip 1 - ! one frame/ps is all we need
CHARMM> sele segid 3cm5 end orient mass sele mysel end


Edited by Nixon (06/11/15 01:45 PM)

Top
#35090 - 06/11/15 02:09 PM Re: merge-orient-trajectory.inp [Re: lennart]
lennart Offline

Forum Member

Registered: 09/25/03
Posts: 4688
Loc: ~ 59N, 15E
merge first 11
unit 11 is not a trajetctory - as far as I can see this is one of the 150 coordinate files.
_________________________
Lennart Nilsson
Karolinska Institutet
Stockholm, Sweden

Top
#35091 - 06/11/15 02:15 PM Re: merge-orient-trajectory.inp [Re: lennart]
rmv Online   content

Forum Member

Registered: 09/17/03
Posts: 8259
Loc: 39 03 48 N, 77 06 54 W
It looks like you may be intermixing TRAJ I/O commands with MERGE commands.

Note also that SKIP values are in integration steps, not time units.

When reading trajectory files, the number and ordering of atoms must match exactly what is in the PSF. The MERGE command does allow the writing of a subset of atoms, but requires another trajectory as input data.
_________________________
Rick Venable
computational chemist


Top
#35093 - 06/15/15 04:30 AM Re: merge-orient-trajectory.inp [Re: lennart]
Nixon Offline
Forum Member

Registered: 09/03/14
Posts: 5
Thanks for the information. Its working.

Top
Page 1 of 3 1 2 3 >

Moderator:  chmgr, John Legato, petrella