From: CHARLES MCCALLUM (cmccallum_at_me.com)
Date: Fri Nov 24 2023 - 19:23:05 CST

Hi Bill, it has been a while since you posted and I’m not sure anyone has helped.
How are you running this script? Within VMD with a “source..” or using a shell command (vmd -dispdev text -e xxx.tcl)?
I’m not sure why quotes wouldn’t work for you.

Best
Mike

> On Nov 3, 2023, at 8:58 AM, Bill McIntyre <bill_mcintyre378_at_outlook.com> wrote:
>
> Hello everyone,
>
> I have a script for cyclicizing a linear peptide loaded into VMD as a PDB file (thanks Josh) and it runs perfectly when I execute each command manually one-by-one in TKCon, but when I make a .tcl file containing all commands in the file (one command per line) and try to execute the whole script in TKCon (source myScript.tcl), certain lines of code appear to be completely ignored and so the script ends up not doing what it was doing well manually (it should output a psf and a pdb file). Would someone please give me their thoughts as to why this is happening? Below is my script:
>
> resetpsf
> package require psfgen
> topology top_all36_prot.rtf
>
> #My 20231029 addition to handle renaming things
> pdbalias residue HIS HSD
> pdbalias atom ILE CD1 CD
>
> segment C {
> pdb file.pdb
> first none
> last none
> }
>
> #I need to know the first and last residue numbers
> mol new file.pdb
> set sel [atomselect top {name CA}] # Previously this was: set sel [atomselect top "name CA"] but script got hung up at this point until I changed the quotes to curly braces
> set firstresid [lindex [$sel get resid] {0}]
> set lastresid [lindex [$sel get resid] {end}]
>
> #Apply the patch
> patch LINK C:$lastresid C:$firstresid C:1 C:2
>
> #Add coordinates and do the rest of the psf building.
> coordpdb file.pdb C
> regenerate angles dihedrals
> guesscoord
> writepsf out.psf
> writepdb out.pdb

--
Mike McCallum
Morada/Stockton CA, USA
cmccallum at me ^dot^ com