Re: Graphene pdb/psf files cannot be read by psfgen

From: Axel Kohlmeyer (
Date: Thu Feb 16 2012 - 00:09:13 CST

On Feb 16, 2012, at 12:59 AM, Wanzhi Qiu <> wrote:

Hi Axel,

The concern which prompted me to use autopsf plugin is as follows.

I have 2 structures S1.pfs/pdb and S2.psf/pdb and would like to combine
then into one single structure and use the combined one in NAMD simulation.
This structure combining can be done by using the MergeStructure Plugin of
VMD, or using a script like the combine.tcl.

The thing is that, as read in, this merge only
preserves exiting bonds in S1 and S2, but does NOT generate new bonds. If
there should be bonds between atoms across S1 and S2 in the combined
structure, this information will be missing..

Why should there be bonds??

Therefore I was hoping that using autopsf might prevent this information

There is no loss of information.

Now I understand that autopsf is not suitable for handling graphene, I'll
have to work out some other ways for generating psf for the combined
structure, if my concern on the information loss of MergeStructure Plugin
is valid.

The problem is that you have to know the chemistry and structure of your
system and not trust some random computer program without thinking. Tools
like psfgen don't know chemistry, but just apply information from a
database (the topology file) through matching residue and atom names
according to certain naming conventions. That is all.


Thank you for your kind help.


*From:* Axel Kohlmeyer <>
*To:* Wanzhi Qiu <>
*Cc:* "" <>
*Sent:* Thursday, 16 February 2012 4:13 PM
*Subject:* Re: namd-l: Graphene pdb/psf files cannot be read by psfgen

On Feb 16, 2012, at 12:04 AM, Wanzhi Qiu <> wrote:

Hi Axel,

Your script fixed the problem! Thank you very much for your help!

Another thing I encounter which might be a related issue is that, when I
load the graphene pdb file (with the segment fix) and try to use the VMD
"Automatic PSF builder" GUI to generate the corresponding psf file, it
fails at the step "Create chains" with following error message:

You don't need to do that. The topology file used in autopsf doesn't have
an entry for graphene.

The nanotube builder automatically already generates angles, dihedrals via
the topotools plugin, and assigns as atom type the one for benzene ring
carbon atoms.

Autopsf has detected 24 unparametrized components.
1: GRA 1 atoms,
2: GRA 1 atoms,
24: GRA 1 atoms,

where the number of atoms in the graphene is 24, and the default
top_all27_prot_lipid.inp is used.

Could someone also point out what I might be doing wrong here.

For unusual compounds you will always have to do thongs manually. Plugins
like autopsf are written to make standard task easy, but by the same token
they may get into trouble when you try something less conventional.


Many thanks and best regards,


*From:* Axel Kohlmeyer <>
*To:* Wanzhi Qiu <>
*Cc:* Cruz-Chu Eduardo Roberto <>; "" <>
*Sent:* Thursday, 16 February 2012 1:57 PM
*Subject:* Re: namd-l: Graphene pdb/psf files cannot be read by psfgen

On Wed, Feb 15, 2012 at 9:50 PM, Wanzhi Qiu < <>> wrote:
> Hi Axel,
> I have two structures each with psf/pdb files and would like to combine
> into one single structure.
> The graphene psf/pdb fiels are generated as outlined in my previous email.
> The other pair of psf/pdb didn't show any problem here. The psfgen is not
> directly called in my combining process, but in-directly in the script I
> used for the combining. The complete script (combine.tcl) is list below:

thanks. that makes things much easier.

> ++++++++++
> # Input:
> set psf0 graphene.psf
> set pdb0 graphene.pdb
> set psf1 other.psf
> set pdb1 other.pdb
> # Output:
> set finalPsf c.psf
> set finalPdb c.pdb
> # Load the topology and coordinates.
> package require psfgen
> resetpsf
> readpsf $psf0
> coordpdb $pdb0
> readpsf $psf1
> coordpdb $pdb1
> # Write the combination.
> writepdb $finalPdb
> writepsf $finalPsf
> ++++++++++
> When issuing "source combine.tcl" in the Tkconsole, produces following:
> psfgen) clearing structure, preserving topology and aliases
> psfgen) reading structure from psf file
> graphene.psf
> psfgen) error reading atoms
> MOLECULE DESTROYED BY FATAL ERROR! Use resetpsf to start over.
> Follow-on trials reveal that commands "readpsf graphene.psf" and "coordpdb
> graphene.pdb" in the Tkconsole both fail. BTW, I guess the default
> file top_all27_prot_lipid.inp is involved here, don't know whether this is
> right or how to check which topology file is actually used.

ok. i've looked this over and it seems that psfgen mistakenly
misidentifies the file format because it doesn't contain a segment id.

and you please try the following commands

mol new graphene.psf waitfor all
mol addfile graphene.pdb waitfor all

set sel [atomselect top all]
$sel set segid SHT
animate write psf graphene1.psf waitfor all
animate write pdb graphene1.psf waitfor all
$sel delete

and then use the newly generated files
for your psfgen merge script.

that will hopefully do the trick.
if yes, i'll adjust the nanotube builder
plugin accordingly, so it will be fixed
with the next release of VMD.


> Thank you!
> Wanzhi
> ________________________________
> From: Axel Kohlmeyer < <>>
> To: Wanzhi Qiu < <>>
> Cc: Cruz-Chu Eduardo Roberto < <>>;
> " <>" < <>>
> Sent: Thursday, 16 February 2012 1:13 PM
> Subject: Re: namd-l: Graphene pdb/psf files cannot be read by psfgen
> On Wed, Feb 15, 2012 at 9:06 PM, Wanzhi Qiu < <>> wrote:
>> Hi Eduardo and All,
>> Thanks for your reply. Yes you are right psf should be read before
>> pdb. Unfortunately this doesn't solve the problem. Same error messages
>> still returned when issuing readpsf/coordpdb commands from Tkconsole.
>> psf/psb files have no problem in being loaded to VMD via "mol load"
>> command.
>> I guess there might be some formatting issues in the psf/pdb files
>> generated
>> this way - starting with the Carbon Nanostructure Builder, then select
>> all,
>> then issue "$all writepdb/psf" commands.
>> Could you please enlighten me on what might be wrong here.
> you have to differentiate between input for psfgen
> and regular VMD. the do maintain two different
> "states". please provide the *complete* list of
> commands for psfgen and a description of what
> it is that you overall want to do with this.
> it is often difficult to debug these things without context.
> thanks,
> axel.
>> Kind regards,
>> wanzhi
>> ________________________________
>> From: Cruz-Chu Eduardo Roberto < <>>
>> To: Wanzhi Qiu < <>>
>> Cc: " <>" < <>>
>> Sent: Wednesday, 15 February 2012 10:06 PM
>> Subject: Re: namd-l: Graphene pdb/psf files cannot be read by psfgen
>> readpsf command must go before coordpdb; that is:
>> readpsf graphene.psf
>> coordpdb graphene.pdb
>> then you add other molecules
>> readpsf smth.psf
>> coordpdb smth.pdb
>> and output the final structure
>> writepsf final.psf
>> writepdb final.pdb
>> a more detailed explanation is provided in the psfgen user guide,
>> available
>> in the website.
>> Regards;
>> Eduardo
>> On Feb 15, 2012, at 8:14 AM, Wanzhi Qiu wrote:
>> Dear NAMDers,
>> I constructed a small graphene sheet using VMD Carbon Nanostructure
>> Builder
>> with options of Bonds, Angles etc are ticked. The result is shown on VMD
>> OpenGL window and pdb/psf files are then generated using
>> commands in Tk console. The files appear to be correct with numbers for
>> bonds, angles etc in the psf file. However, they fail when I try to
>> combine
>> the graphene with other molecules.
>> The problem is that the generated graphene.pdb/graphene.psf cannot be
>> read
>> by psfgen. In particular, the commands issued in the Tk console and error
>> messages are:
>>>coordpdb graphene.pdb
>> gives following result:
>> psfgen) reading coordinates from pdb file graphene.pdb
>> psfgen) no segment
>> psfgen) Warning: failed to set coordinate for atom C GRA:1
>> (patten repeat for all atoms)
>>>readpsf graphene.psf
>> gives following result:
>> psfgen) reading structure from psf file graphene.psf
>> psfgen) error reading atoms
>> MOLECULE DESTROYED BY FATAL ERROR! Use resetpsf to start over.
>> I suspect that the problem might be related to the residue name "GRA" in
>> the
>> pdb file. The first 3 lines of the pdb file are:
>> CRYST1 8.508 7.368 100.000 90.00 90.00 90.00 P 1 1
>> ATOM 1 C GRA X 1 0.000 0.000 0.000 0.00 0.00 C
>> ATOM 2 C GRA X 2 -0.709 1.228 0.000 0.00 0.00 C
>> Please let me know if you have any advices/comments/suggestions.
>> Many thanks,
>> Wanzhi
>> -----------
>> Wanzhi Qiu, Ph. D.
>> Senior Researcher
>> National ICT Australia
>> Department of Electrical & Electronic Engineering
>> The University of Melbourne Parkville, Victoria 3010 Australia
> --
> Dr. Axel Kohlmeyer
> <> <>
> College of Science and Technology
> Temple University, Philadelphia PA, USA.

Dr. Axel Kohlmeyer
<>   <>
College of Science and Technology
Temple University, Philadelphia PA, USA.

This archive was generated by hypermail 2.1.6 : Tue Dec 31 2013 - 23:21:40 CST