From: Ryan Woltz (rlwoltz_at_ucdavis.edu)
Date: Tue Apr 01 2025 - 16:15:12 CDT

Dear community,

           I previously asked about changing the order or atoms to be saved
and got great feedback, however, there were single pdbs.

https://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/34623.html

        Using this method I was able to save the psf file I want in a
different order but now I need to also update the dcd. Here is the
situation. I have 4 binding sites of a lipid that involve 3 out of the 4
possible chains. We are looking at a channel that has a circular chain
naming i.e. A <-> B <-> C <-> D <-> A <-> B etc. The binding site has these
residues in this order where X= the main chain for binding. In the below
example X would be D, X+1 would be A, and X-1 would be C.

set cluster1 [atomselect 0 "(sequence ALVVAVVARKLELTKAEK and segname
PRO{X}) or (sequence SVKMEQRKLSDQANTLV and segname PRO{X+1}) or (sequence
INFNTRFVMKTLMTICPGTVLLV and segname PRO{X+1}) or (resname SAPI24 and resid
313)"]

I would eventually have cluster1-4 going around the channel. However, each
selection has a different psf and dcd order. So If I load the cluster1.psf
with the cluster2.dcd the bonds are not correct because selection orders
wouldn't be the same since it saves in the order the indexes were read and
not selected.

       Ultimately, I'm looking to combine all 4 binding sites so I can
treat all 4 sites as a single clustering algorithm as we think the sites
are symmetrical. Additionally, trajectories are 9K frames.

       I think I have 3 solutions but think they are a lot of data to
manage and not sure if there is a easier way.

1. use topotools selection2mol to create a pdb of each frame and then each
binding site in the correct order. Create a psf file as the masterfiles and
load the pdbs in the order they need to be to reconstruct the trajectory
then save as a dcd. But would I lose any information and the storage to do
this might be high? I suspect I wouldn't lose information since the psf
contains the information and the dcd contain the coordinates?
2. create a dcd and psf for each selection then recombine in the order I
want things saved into 4 different molecules. After the selections been
loaded in the proper order for each site I'd merge the mols together? This
is still a bit troublesome how I can do this with all 4 sites though but if
I load in the proper order maybe it'll all merge well?

Does anyone have a better method as I'm doing a lot of simulations and this
could get really messy if I'm trying to juggle too much data and temp files.

Here is the starting script I have which writes the psf file well and just
need to figure out how to do the same for the dcd:

proc merge_structures {seg1 seg2 seg3 clusternum } {

set sellist [list $seg1 $seg2 $seg3]
#Make a new molecule that does respect the order.
set newmol [::TopoTools::selections2mol $sellist]
#Write out to a file
animate write psf newmol$clusternum.psf $newmol
animate write dcd newmol$clusternum.dcd $newmol
}

set cluster1 [list [atomselect 0 "sequence ALVVAVVARKLELTKAEK and segname
PROE" [atomselect 0 "sequence SVKMEQRKLSDQANTLV and segname PROC"]
[atomeselect 0 "sequence INFNTRFVMKTLMTICPGTVLLV and segname PROG"]
[atomselect 0 "resname SAPI24 and resid 313"]]
set cluster2 [list [atomselect 0 "sequence ALVVAVVARKLELTKAEK and segname
PROG" [atomselect 0 "sequence SVKMEQRKLSDQANTLV and segname PROE"]
[atomeselect 0 "sequence INFNTRFVMKTLMTICPGTVLLV and segname PROA"]
[atomselect 0 "resname SAPI24 and resid 445"]]
set cluster3 [list [atomselect 0 "sequence ALVVAVVARKLELTKAEK and segname
PROA" [atomselect 0 "sequence SVKMEQRKLSDQANTLV and segname PROG"]
[atomeselect 0 "sequence INFNTRFVMKTLMTICPGTVLLV and segname PROC"]
[atomselect 0 "resname SAPI24 and resid 281"]]
set cluster4 [list [atomselect 0 "sequence ALVVAVVARKLELTKAEK and segname
PROC" [atomselect 0 "sequence SVKMEQRKLSDQANTLV and segname PROA"]
[atomeselect 0 "sequence INFNTRFVMKTLMTICPGTVLLV and segname PROE"]
[atomselect 0 "resname SAPI24 and resid 292"]]

merge_structures [lindex $cluster1 0] [lindex $cluster1 1] [lindex
$cluster1 2] 1
merge_structures [lindex $cluster2 0] [lindex $cluster2 1] [lindex
$cluster2 2] 2
merge_structures [lindex $cluster3 0] [lindex $cluster3 1] [lindex
$cluster3 2] 3
merge_structures [lindex $cluster4 0] [lindex $cluster4 1] [lindex
$cluster4 2] 4

Thank you,

Ryan