I am trying to generate a matrix of small molecules arranged at locations (x, y, z) on a cube. I already have a Tcl script that can generate the required PDB and PSF files. However, I was wondering if there is a way to merge them into a single PDB and PSF file using Tcl itself. Reproduced below is the script to generate the molecules at the given positions.
set psf adenine.xplor_ext.psf
set pdb adenine.pdb
set resname ADE
set a 3
set b 3
set d 10
# first generate in required pdb and psf files
set xend [expr $a / 2]
set xstart [expr -1 * $xend]
set yend [expr $b / 2]
set ystart [expr -1 * $yend]
set counter 1
for { set i $xstart } { $i <= $xend } { incr i } {
for { set j $ystart } { $j <= $yend } { incr j } {
mol load psf $psf
mol addfile $pdb type pdb waitfor all
set sel [atomselect top "resname $resname"]
set com [measure center $sel weight mass]
$sel moveby [vecscale -1 $com]
set xdist [expr $d * $i]
set ydist [expr $d * $j]
set transvec [list $xdist $ydist 0]
puts $transvec
$sel moveby $transvec
$sel set segname AD$counter
$sel set resid $counter
$sel writepsf adenine.$i.$j.psf
$sel writepdb adenine.$i.$j.pdb
incr counter
mol delete all
}
}
exit
From VMD, I see that the molecules are merged using a call to CHARMM program (at least that is what I could understand from the TkConsole window). But it works by calling 2 PDB files at a time, and is not necessarily what I am looking for. Any help in this regard would be much appreciated.