Previous Thread
Next Thread
Print Thread
Page 1 of 3 1 2 3
merge-orient-trajectory.inp
#324 10/23/03 10:31 AM
Joined: Sep 2003
Posts: 4,780
Likes: 2
lennart Offline OP
Forum Member
OP Offline
Forum Member
Joined: Sep 2003
Posts: 4,780
Likes: 2
*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
Re: merge-orient-trajectory.inp
lennart #31906 05/14/13 02:27 AM
Joined: Oct 2012
Posts: 24
S
Forum Member
Offline
Forum Member
S
Joined: Oct 2012
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

Re: merge-orient-trajectory.inp
lennart #31907 05/14/13 06:31 AM
Joined: Sep 2003
Posts: 4,780
Likes: 2
lennart Offline OP
Forum Member
OP Offline
Forum Member
Joined: Sep 2003
Posts: 4,780
Likes: 2
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
Re: merge-orient-trajectory.inp
lennart #31908 05/14/13 12:10 PM
Joined: Oct 2012
Posts: 24
S
Forum Member
Offline
Forum Member
S
Joined: Oct 2012
Posts: 24
Thanks.
Can the trajectory be .dcd (NAMD) instead of .cor ?

Re: merge-orient-trajectory.inp
lennart #31909 05/14/13 12:27 PM
Joined: Sep 2003
Posts: 8,471
rmv Offline
Forum Member
Offline
Forum Member
Joined: Sep 2003
Posts: 8,471
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

Re: merge-orient-trajectory.inp
lennart #31970 05/23/13 03:18 AM
Joined: Oct 2012
Posts: 24
S
Forum Member
Offline
Forum Member
S
Joined: Oct 2012
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

Re: merge-orient-trajectory.inp
lennart #31971 05/23/13 06:33 AM
Joined: Sep 2003
Posts: 4,780
Likes: 2
lennart Offline OP
Forum Member
OP Offline
Forum Member
Joined: Sep 2003
Posts: 4,780
Likes: 2
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
Re: merge-orient-trajectory.inp
lennart #31976 05/24/13 01:14 AM
Joined: Oct 2012
Posts: 24
S
Forum Member
Offline
Forum Member
S
Joined: Oct 2012
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

Re: merge-orient-trajectory.inp
lennart #31977 05/24/13 02:45 AM
Joined: Sep 2003
Posts: 8,471
rmv Offline
Forum Member
Offline
Forum Member
Joined: Sep 2003
Posts: 8,471
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

Re: merge-orient-trajectory.inp
rmv #31978 05/24/13 03:54 PM
Joined: Oct 2012
Posts: 24
S
Forum Member
Offline
Forum Member
S
Joined: Oct 2012
Posts: 24
VMD shows 250 frames per trajectory (unmodified trajectory)

Re: merge-orient-trajectory.inp
lennart #31979 05/24/13 04:00 PM
Joined: Sep 2003
Posts: 8,471
rmv Offline
Forum Member
Offline
Forum Member
Joined: Sep 2003
Posts: 8,471
(600*(32/2))/250


Rick Venable
computational chemist

Re: merge-orient-trajectory.inp
lennart #31980 05/24/13 05:00 PM
Joined: Oct 2012
Posts: 24
S
Forum Member
Offline
Forum Member
S
Joined: Oct 2012
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)

Last edited by swmmr1928; 05/24/13 05:02 PM.
Re: merge-orient-trajectory.inp
lennart #31981 05/24/13 05:36 PM
Joined: Sep 2003
Posts: 8,471
rmv Offline
Forum Member
Offline
Forum Member
Joined: Sep 2003
Posts: 8,471
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

Re: merge-orient-trajectory.inp
lennart #31985 05/27/13 07:01 PM
Joined: Oct 2012
Posts: 24
S
Forum Member
Offline
Forum Member
S
Joined: Oct 2012
Posts: 24
My incorrect "nunit" is the cause. Thanks.

Re: merge-orient-trajectory.inp
lennart #35084 06/11/15 05:17 PM
Joined: Sep 2014
Posts: 5
N
Forum Member
Offline
Forum Member
N
Joined: Sep 2014
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

Last edited by Nixon; 06/11/15 05:38 PM.
Re: merge-orient-trajectory.inp
lennart #35085 06/11/15 05:30 PM
Joined: Sep 2014
Posts: 5
N
Forum Member
Offline
Forum Member
N
Joined: Sep 2014
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

Re: merge-orient-trajectory.inp
Nixon #35087 06/11/15 05:40 PM
Joined: Sep 2014
Posts: 5
N
Forum Member
Offline
Forum Member
N
Joined: Sep 2014
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

Re: merge-orient-trajectory.inp
lennart #35088 06/11/15 05:43 PM
Joined: Sep 2014
Posts: 5
N
Forum Member
Offline
Forum Member
N
Joined: Sep 2014
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

Last edited by Nixon; 06/11/15 05:45 PM.
Re: merge-orient-trajectory.inp
lennart #35090 06/11/15 06:09 PM
Joined: Sep 2003
Posts: 4,780
Likes: 2
lennart Offline OP
Forum Member
OP Offline
Forum Member
Joined: Sep 2003
Posts: 4,780
Likes: 2
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
Re: merge-orient-trajectory.inp
lennart #35091 06/11/15 06:15 PM
Joined: Sep 2003
Posts: 8,471
rmv Offline
Forum Member
Offline
Forum Member
Joined: Sep 2003
Posts: 8,471
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

Re: merge-orient-trajectory.inp
lennart #35093 06/15/15 08:30 AM
Joined: Sep 2014
Posts: 5
N
Forum Member
Offline
Forum Member
N
Joined: Sep 2014
Posts: 5
Thanks for the information. Its working.

Page 1 of 3 1 2 3

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.015s Queries: 56 (0.006s) Memory: 1.0958 MB (Peak: 1.3168 MB) Data Comp: Off Server Time: 2020-07-15 07:53:38 UTC
Valid HTML 5 and Valid CSS