From: Diego Gomes (diego.enry_at_gmail.com)
Date: Tue Nov 07 2023 - 09:19:01 CST

Hi Bill,
your script is working for me.
The only change I made was to reposition "resetpsf" after "package require
psfgen" but that wasn't really an issue.

To help you debug it, can you share your VMD output as I'm doing below?

Friendly regards,
Diego

csm-beijing:~/tmp$ vmd -dispdev text
> rlwrap: Command not found.
> Info) VMD for LINUXAMD64, version 1.9.4a55 (October 19, 2021)
> Info) http://www.ks.uiuc.edu/Research/vmd/
> Info) Email questions and bug reports to vmd_at_ks.uiuc.edu
> Info) Please include this reference in published work using VMD:
> Info) Humphrey, W., Dalke, A. and Schulten, K., `VMD - Visual
> Info) Molecular Dynamics', J. Molec. Graphics 1996, 14.1, 33-38.
> Info) -------------------------------------------------------------
> Info) Multithreading available, 24 CPUs, ISA dispatch enabled.
> Info) CPU features: SSE2 SSE4.1 AVX AVX2 FMA F16 HT
> Info) Free system memory: 117GB (93%)
> Info) Creating CUDA device pool and initializing hardware...
> Info) Unable to load NVML library, GPU-CPU affinity unavailable.
> Info) Detected 1 available CUDA accelerator::
> Info) [0] NVIDIA RTX A5000 64 SM_8.6 1.7 GHz, 24GB RAM SP32 KT AE2 ZC
> Info) Detected 1 available TachyonL/OptiX ray tracing accelerator
> Info) Compiling OptiX shaders on 1 target GPU...
> Info) Dynamically loaded 3 plugins in directory:
> Info) /cm/shared/apps/vmd/lib/vmd/plugins/LINUXAMD64/molfile
> /home/dgomes/github/CaFE_Plugin/cafe1.0/
> /cm/shared/apps/vmd/lib/vmd/scripts/tcl8.5
> /cm/shared/apps/vmd/lib/vmd/scripts /cm/shared/apps/vmd/lib/lib
> /Projects/johns/tcl/8.5.6/lib_LINUXAMD64/lib
> /cm/shared/apps/vmd/lib/vmd/scripts/vmd
> /cm/shared/apps/vmd/lib/vmd/plugins/LINUXAMD64/tcl
> /cm/shared/apps/vmd/lib/vmd/plugins/noarch/tcl
> vmd > cat script.vmd
> #resetpsf
> package require psfgen
> resetpsf
> 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}]
> 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
>
> vmd > play script.vmd
> 2.0
> psfgen) clearing structure, preserving topology and aliases
> psfgen) reading topology file top_all36_prot.rtf
>
> psfgen) >>>>>>>>CHARMM36 All-Hydrogen Topology File for Proteins <<<<<<
> psfgen) >>>>> Includes phi, psi cross term map (CMAP) correction <<<<<<<
> psfgen) >>>>>>>>>>>>>>>>>>>>>>>>>> May 2011 <<<<<<<<<<<<<<<<<<<<<<<<<<<<
> psfgen) All comments to the CHARMM web site: https://urldefense.com/v3/__http://www.charmm.org__;!!DZ3fjg!9FaFzmOmMR-C0mxjmtigTz820Z4und896GKIZM6QKG8WzrVGyl-q8DdZqWrKbLugiytaEtR2IEC7oAKbMav6$
> psfgen) parameter set discussion forum
> psfgen)
> psfgen) Created by CHARMM version 36 1
> psfgen) cross-term entries present in topology definitions
> psfgen) aliasing residue HIS to HSD
> psfgen) aliasing residue ILE atom CD1 to CD
> psfgen) building segment C
> psfgen) reading residues from pdb file file.pdb
> psfgen) extracted 3 residues from pdb file
> psfgen) setting patch for first residue to NONE
> psfgen) setting patch for last residue to NONE
> Info: generating structure...
> psfgen) Info: skipping improper N-C-CA-HN at beginning of segment.
> psfgen) Info: skipping cross-term C-N-CA-C-N-CA-C-N at beginning of
> segment.
> psfgen) Info: skipping conformation C-N-CA-C at beginning of segment.
> psfgen) Info: skipping conformation C-CA-N-HN at beginning of segment.
> psfgen) Info: skipping bond C-N at end of segment.
> psfgen) Info: skipping improper C-CA-N-O at end of segment.
> psfgen) Info: skipping cross-term C-N-CA-C-N-CA-C-N at end of segment.
> psfgen) Info: skipping conformation CA-C-N-CA at end of segment.
> psfgen) Info: skipping conformation N-CA-C-O at end of segment.
> psfgen) Info: skipping conformation N-CA-C-N at end of segment.
> segment complete.
> Info) Using plugin pdb for structure file file.pdb
> Info) Using plugin pdb for coordinates from file file.pdb
> Info) Determining bond structure from distance search ...
> Info) Analyzing structure ...
> Info) Atoms: 30
> Info) Bonds: 29
> Info) Angles: 0 Dihedrals: 0 Impropers: 0 Cross-terms: 0
> Info) Bondtypes: 0 Angletypes: 0 Dihedraltypes: 0 Impropertypes: 0
> Info) Residues: 3
> Info) Waters: 0
> Info) Segments: 1
> Info) Fragments: 1 Protein: 1 Nucleic: 0
> Info) Finished with coordinate file file.pdb.
> 0
> atomselect0
> 1
> 3
> psfgen) applying patch LINK to 4 residue(s)
>
> psfgen) reading coordinates from pdb file file.pdb for segment C
> psfgen) regenerating all angles
> psfgen) regenerating all dihedrals
> psfgen) Info: guessing coordinates for 0 atoms (0 non-hydrogen)
> psfgen) Info: writing psf file out.psf
> psfgen) total of 30 atoms
> psfgen) total of 30 bonds
> psfgen) total of 54 angles
> psfgen) total of 75 dihedrals
> psfgen) total of 6 impropers
> psfgen) total of 0 explicit exclusions
> psfgen) total of 1 cross-terms
> psfgen) Info: psf file complete.
> psfgen) Info: writing pdb file out.pdb
> psfgen) Info: pdb file complete.
> vmd > quit
> Info) VMD for LINUXAMD64, version 1.9.4a55 (October 19, 2021)
> Info) Exiting normally.
>

On Fri, Nov 3, 2023 at 11:44 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*
>

-- 
Diego Enry B. Gomes, PhD
Department of Physics at Auburn University &
NIH Center for Macromolecular Modeling and Visualization
Leach Science Center - Ste. 3182 - Auburn, AL
dgomes_at_auburn.edu