Re: psfgen - pdbalias when using readpsf

From: Vermaas, Joshua (
Date: Thu Dec 15 2016 - 15:26:11 CST

Wouldn't that be dangerous here though? I'm not sure what exactly you
want this to do. The 3 histidine states have different connectivity (and
charges), which is why they have different resnames in the first place.
I assume you want to be sneaky and replace the connectivity with a
single connectivity (represented by your HIS residue), which means that
just renaming the residues won't do what you want. If it were me, I'd
just go with the most expedient choice, which I think is to rewrite each
segment to a pdb and just rebuild the psf the normal way. Something like:

set seglist [lsort -unique [[atomselect top "all"] get segname]]

foreach segname $seglist {
    [atomselect top "segname $segname"] writepdb $segname.pdb
    segment $segname {
        pdb $segname.pdb
    coordpdb $segname.pdb $segname ; #This one might need to be
reversed... I always forget which argument comes first.
regenerate angles dihedrals

This is a tremendously abusive way of doing it, but it lets the pdbalias
residue commands do what they need to do, and saves you from needing to
add new stuff to psfgen.


On 12/15/2016 02:05 PM, Peter Freddolino wrote:
> Actually I think there is an easier way now. It looks like the molfile plugins finally preserve all of the psf information, so you ought to be able to load it using the normal vmd mol new commends, rename the residues, make at aomselection, and then do $sel writepsf
> But I canít guarantee that this works ó I just remember that it used to not preserve any of the angles/dihedrals/etc. but now it appears to.
> Best,
> Peter
>> On Dec 15, 2016, at 3:48 PM, Brian Radak <> wrote:
>> Thanks Peter,
>> So is there no way to do this internally? There's no general way to rebuild a PSF on-the-fly without knowing all of the segments beforehand and having them in separate PDBs - right?
>> I guess I can always add a "renameresidue" command (although boy is that ugly) similar to the "renameatom" command. Probably better would be to create a "rename" command that can be used variously as "rename atom" or "rename residue". And here I thought I was done futzing up psfgen after 2.12 was released!
>> Brian
>> On 12/15/2016 02:40 PM, Peter Freddolino wrote:
>>>> On Dec 15, 2016, at 3:28 PM, Brian Radak <> wrote:
>>>> I'm not sure that "pdbalias residue" is doing what is expected - can someone enlighten me?
>>>> I am reading a pre-made psf/pdb/coor/vel set from files, but want to change some of the topologies that are used. Specifically I want every instance of the standard C36 residues HSD, HSE, and HSP to become HIS (a new topology that I made and loaded an RTF for). This is essentially the same thing as opening the PSF and PDB and running sed to replace HSD/HSD/HSP with HIS. I thought the following would do what I want:
>>>> pdbalias residue HSD HIS
>>>> pdbalias residue HSE HIS
>>>> pdbalias residue HSP HIS
>>>> readpsf <blah>
>>>> writepsf <some new psf>
>>>> writepdb <some new pdb>
>>>> but this does not seem work as I wanted it to (the output pdb still contains HSD residues in my test). Does pdbalias only work when using the segment command? If so, is that a bug or a feature?
>>> Yes it does only work when using segment commands, and this is a feature. pdbalias only applies to entries being read from topology files. The set of commands that you have never use topology files, they just read and then re-write existing information from a psf. Using sed or totally rebuilding the psf with that aliasing in place would probably be a cleaner way to accomplish what youíre trying to do here.
>>> Quoting the psfgen manual (
>>> pdbalias residue
>>> Purpose:
>>> Provide translations from residues found in PDB files to proper residue names read in from
>>> topology definition files. Proper names from topology files will be used in generated PSF and PDB
>>> files.
>>>> Brian
>>>> --
>>>> Brian Radak
>>>> Postdoctoral Appointee
>>>> Leadership Computing Facility
>>>> Argonne National Laboratory
>>>> 9700 South Cass Avenue, Bldg. 240
>>>> Argonne, IL 60439-4854
>>>> (630) 252-8643
>> --
>> Brian Radak
>> Postdoctoral Appointee
>> Leadership Computing Facility
>> Argonne National Laboratory
>> 9700 South Cass Avenue, Bldg. 240
>> Argonne, IL 60439-4854
>> (630) 252-8643

This archive was generated by hypermail 2.1.6 : Tue Dec 27 2016 - 23:22:44 CST