From: Stefan Doerr (stefdoerr_at_gmail.com)
Date: Sun Apr 03 2016 - 12:04:32 CDT

Why do you build the chains separately and then concatenate? You can write
both directly into one psf by making a loop which calls the segment commands

foreach file{
  foreach chain $chains {
    segment $chain {pdb $name-$chain.pdb}
    coordpdb $name-$chain.pdb MAIN
  }
  guesscoord
  writepdb $file-$chain-psf.pdb
  resetpsf
}

Something like this maybe?

WARNING: I don't know what the policy is on self-promoting here on VMD-L so
if I am out of line someone please tell me and I won't do it again.

If you want to build so many systems I could suggest you try my software
https://www.htmd.org which simplifies stuff like this a bit (also is in
Python instead of TCL which I can't stand).

files = glob('*.pdb')
for f in files:
   mol = Molecule(f)
   mol.filter('not hetero')
   mol.set('segid', 'P')
   mol = segmentgaps(mol)
   charmm.build(mol, ionize=False, outdir='./somedir/')

This should build your system fine. Check the charmm.build and charmm.list
docs for parameters if you want to change forcefield.

On Sun, Apr 3, 2016 at 6:19 PM, Akshay Bhatnagar <
akshaybhatnagar2790_at_gmail.com> wrote:

> With the given script i can have the -psf.pdb file for only 1 protein
> during a run and i have 1125 PDB's.
>
> With Regards
> Akshay Bhatnagar
> PhD Student
> BITS Pilani Hyderabad Campus
>
>
> On Sun, Apr 3, 2016 at 9:47 PM, Akshay Bhatnagar <
> akshaybhatnagar2790_at_gmail.com> wrote:
>
>> Hello everyone
>>
>> I have created a small script to create psf files for multi-chain
>> proteins. the script is:
>>
>> package require psfgen
>> psfcontext reset
>> topology top_all27_prot_na.inp
>> set filelist [glob *.PDB]
>> foreach file $filelist {
>> mol new $file
>> set name [file rootname $file]
>> set selp [atomselect top "not hetero"]
>> set chains [lsort -unique [$selp get pfrag]]
>> foreach chain $chains {
>> echo $chain
>> for {set i 0} {$i <= $chain} {incr i} {
>> set sel [atomselect top "pfrag $chain"]
>> $sel writepdb $name-$chain.pdb
>> pdbalias residue HIS HSP
>> pdbalias atom ILE CD1 CD
>> pdbalias atom LYS 1HZ HZ1
>> pdbalias atom LYS 2HZ HZ2
>> pdbalias atom LYS 3HZ HZ3
>> pdbalias atom ARG 1HH1 HH11
>> pdbalias atom ARG 2HH1 HH12
>> pdbalias atom ARG 1HH2 HH21
>> pdbalias atom ARG 2HH2 HH22
>> pdbalias atom ASN 1HD2 HD21
>> pdbalias atom ASN 2HD2 HD22
>> pdbalias atom SER HG HG1
>> segment MAIN {pdb $name-$chain.pdb}
>> coordpdb $name-$chain.pdb MAIN
>> guesscoord
>> writepdb $file-$chain-psf.pdb
>> resetpsf
>> }
>> }
>> }
>> while {$chain >= 0} {
>> exec cat $file-$chain-psf.pdb >> $name-final.pdb &
>> incr chain -1
>> echo $chain
>> }
>>
>> But, the psfgen package creates the psf linked pdb files for chains in
>> the reverse order. for example, if a protein has 2 chains A and B, then it
>> creates the psf for B before chain A (chain ID 0 to last chain). Due to
>> this during concatenation of the -psf.pdb files the B chain psf.psd is
>> coming before the A chan psf.pdb files.
>>
>> Can anyone please help to create psf.pdb for chain A before chain B.
>>
>> With Regards
>> Akshay Bhatnagar
>> PhD Student
>> BITS Pilani Hyderabad Campus
>>
>>
>