psf generation for multiple trehalose molecules

From: Ritu Arora (
Date: Sun Nov 08 2020 - 18:24:15 CST

Dear All,

I wish to run a simulation of 150 molecules of trehalose. I adapted a psfgen script from earlier NAMD threads, but I am not able to get the script working. The trial script for the carbohydrate section of my system follows:

package require psfgen
topology top_all36_carb.rtf
mol new carb_only.pdb
set sel [atomselect top 'all']
for {set i 0} {$i<150} {incr i} {
segment L$i {
residue 1 AGLC
residue 2 AGLC
pdbalias atom 'AGLC 1' O1 1O1
pdbalias atom 'AGLC 1' C1 1C1
pdbalias atom 'AGLC 2' C1 2C1
patch 11aa L$i:1 L$i:2
$sel set segname L$i
$set moveby [list 1 1 1]
$set writepdb tmp.pdb
regenerate angles dihederals
coordpdb L$i tmp.pdb
writepdb $name.pdb
writepsf $name.psf

The confusion is that there are two AGLCs in trehalose and each has either resid 1 or 2, rather than sequential increments for whole molecule of trehalose. The pdbalias command also seems to be wrong.

I also tried to split the two fragments of trehalose in two separate pdbs:

pdbalias atom 'AGLC 1' O1 1O1
pdbalias atom 'AGLC 2' C1 2C1

for {set i 0} {$i < 150} {incr i} {
segment TRE1$i {pdb output/carb1.pdb }

segment TRE2$i {pdb output/carb2.pdb }

patch 11aa TRE1$i:1 TRE2$i:2
coordpdb output/carb1.pdb TRE1$i
coordpdb output/carb2.pdb TRE2$i
I would be thankful for any suggestions to improvise the script.


This archive was generated by hypermail 2.1.6 : Thu Dec 31 2020 - 23:17:14 CST