From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Tue Jun 15 2010 - 11:31:40 CDT

On Tue, 2010-06-15 at 09:22 -0700, Rabab Toubar wrote:
> Hi Axel,
> I have another problem now, using your suggested tcl script
> #load .gro and .psf file into vmd
> set mol1 [mol new pr.psf waitfor all]
> set mol2 [mol new pr.gro waitfor all]
>
> set sel1 [atomselect $mol1 all]
> set sel2 [atomselect $mol2 water]
> set sel3 [atomselect $mol2 CL]

the last selection is wrong.

> # Recalculate bonds
> mol2 bondsrecalc $mol2
> topo retypebonds
>
> # merge selections into new molecule.
> package require topotools
> ::TopoTools::selections2mol "$sel1 $sel2 $sel3"
>
> # write out new molecule
> animate write psf axel_new.psf
>
> this gives me the correct number of atoms in the system, but with no charges for the protein, but if I use ::TopoTools::selections2mol "$sel1 $sel2" the charges are correct, but obviously I have no chloride ions
>
> I tried to look into the topotools plugin and everything in the script looks OK for me

of course the scripts are ok, but it you feed them garbage,
they'll also produce garbage. if $sel3 does not contain a
reference to a proper atom selection then they'll fail.

you have to very closely watch the output of the script.
there have to be error messages and for as long as you
are ignoring them, there is nothing that the topotools
script can do about it.

PEBCAC!

axel.

> Thanks
> Rabab Toubar
>
>
>
> --- On Tue, 6/15/10, Axel Kohlmeyer <akohlmey_at_gmail.com> wrote:
>
> > From: Axel Kohlmeyer <akohlmey_at_gmail.com>
> > Subject: Re: vmd-l: top2psf.tcl
> > To: "Rabab Toubar" <rtoubar_at_yahoo.com>
> > Cc: "vmd-l" <vmd-l_at_ks.uiuc.edu>
> > Date: Tuesday, June 15, 2010, 11:31 AM
> > On Tue, Jun 15, 2010 at 11:14 AM,
> > Rabab Toubar <rtoubar_at_yahoo.com>
> > wrote:
> > > Using the tcl script you sent me, I am getting 11628
> > atoms, bonds present, & the protein is charged but not
> > the water (I believe I'm getting the protein charges from
> > the top file)
> > > 11628 !NATOM
> > > 1 MAIN 1 ASP N NL 0.129000
> > 14.0067 0
> > > 2 MAIN 1 ASP H1 H 0.248000
> > 1.0080 0
> > >
> > > modifying the .tcl script so as to add ions that are
> > found in my simulations, I am losing bonds and charges but
> > having the correct number of atoms 11632..So I am just
> > curious what is going on.
> > >
> > > #load .gro and .psf file into vmd
> > > set mol1 [mol new myfile.psf waitfor all]
> > > set mol2 [mol new myfile.gro waitfor all]
> > > set sel1 [atomselect $mol1 all]
> > > set sel2 [atomselect $mol2 water]
> > > set sel3 [atomselect $mol3 ion]
> >
> > this one cannot work. there is no $mol3.
> >
> > set sel3 [atomselect $mol2 ion]
> >
> > to reset the charges and/or other properties,
> > all you have to do is to build the proper selections
> > and then set the values before combining them.
> > for example.
> >
> > set sel4 [atomselect $mol2 "type OW"]
> > $sel4 set charge -0.84
> > set sel5 [atomselect $mol2 "type HW"]
> > $sel5 set charge 0.42
> >
> > and so on.
> >
> > cheers,
> > axel.
> >
> > > # merge selections into new molecule.
> > > package require topotools
> > > ::TopoTools::selections2mol "$sel1 $sel2 $sel3"
> > >
> > > # write out new molecule
> > > animate write psf combined.psf
> > >
> > > 11632 !NATOM
> > > 1 1 ASP N N
> > 0.000000 14.0070 0
> > > 2 1 ASP H1 H1
> > 0.000000 1.0080 0
> > >
> > > Thanks, bondsrecalc made the bonds appear in the psf,
> > and sorry for the email format & the cc; it was
> > unintended.
> > >
> > > Rabab
> > >
> > > --- On Tue, 6/15/10, Axel Kohlmeyer <akohlmey_at_gmail.com>
> > wrote:
> > >
> > > From: Axel Kohlmeyer <akohlmey_at_gmail.com>
> > > Subject: Re: vmd-l: top2psf.tcl
> > > To: "Rabab Toubar" <rtoubar_at_yahoo.com>
> > > Date: Tuesday, June 15, 2010, 10:48 AM
> > >
> > > On Tue, Jun 15, 2010 at 10:38 AM, Rabab Toubar <rtoubar_at_yahoo.com>
> > wrote:
> > >>
> > >> Hi Axel,
> > >>
> > >> using "animate" I get the correct number of atoms,
> > but all the charges are set to zeros, and I have no bonds
> > >> 11632 !NATOM
> > >> 1 1 ASP N
> > N 0.000000 14.0070
> > 0
> > >> 2 1 ASP H1
> > H1 0.000000 1.0080
> > 0
> > >> 3 1 ASP H2
> > H2 0.000000 1.0080
> > 0
> > >
> > > well, you cannot have what is not there. a .gro file
> > has
> > > not information about atom charges, so there are not
> > > in the resulting .psf file.
> > >
> > >> 0 !NBOND: bonds
> > >> 0 !NTHETA: angles
> > >> 0 !NPHI: dihedrals
> > >> 0 !NIMPHI: impropers
> > >> 0 !NDON: donors
> > >> 0 !NACC: acceptors
> > >>
> > >> the second "untested" method worked well but not
> > including the ions. It had the charges for the atoms and
> > everything. So I tried to modify the tcl script by adding a
> > 3rd selection "set sel3 [atomselect $mol3 ion]" when I got
> > zero charges and zero bonds as the 1st case. I donot
> > understand why; any guesses?
> > >
> > > it it not clear what you did.
> > >
> > >
> > > not sure why you are not getting any bonds.
> > > you can try loading the .gro file and then do
> > > mol bondsrecalc $mol
> > > topo retypebonds
> > >
> > > that should trigger the internal flags in VMD
> > > to write out bonds.
> > >
> > > you have to manually set any charges that are not
> > > given through input in case you want them set in the
> > .psf.
> > >
> > > you have to remember this is not psfgen where this is
> > > all read from a parameter database, you are doing all
> > > steps by hand.
> > >
> > > cheers,
> > > axel.
> > >
> > > p.s.: please turn off html format mails to mailing
> > lists and always
> > > keep the list in cc.
> > > i usually don't respond to questions send to me
> > directly that don't concern me
> > > personally, or else i would have no time to get
> > anything done. thanks.
> > >
> > >> However, when I added the Cl- manually the psf
> > generation went well and loaded in VMD
> > >>
> > >> Thanks a lot for your help :)
> > >>
> > >> Rabab Toubar
> > >>
> > >>
> > >> --- On Tue, 6/15/10, Axel Kohlmeyer <akohlmey_at_gmail.com>
> > wrote:
> > >>
> > >> From: Axel Kohlmeyer <akohlmey_at_gmail.com>
> > >> Subject: Re: vmd-l: top2psf.tcl
> > >> To: "Rabab Toubar" <rtoubar_at_yahoo.com>
> > >> Cc: "vmd-l" <vmd-l_at_ks.uiuc.edu>
> > >> Date: Tuesday, June 15, 2010, 9:59 AM
> > >>
> > >> On Tue, Jun 15, 2010 at 9:49 AM, Rabab Toubar
> > <rtoubar_at_yahoo.com>
> > wrote:
> > >> >
> > >> > I need the .psf file as we have in house
> > codes used for analysis and these use .psf and .dcd as in
> > case of NAMD.
> > >>
> > >> > I tried to load the .gro or .pdb files and
> > save coordinates as psf, but this is not an option in the
> > drop down menu in vmd; is there a way I can do it in tcl?
> > >>
> > >> of course:
> > >>
> > >> animate write psf myfile.psf
> > >>
> > >> > I do have disulfide bonds- if this what you
> > meant by unusual bonds.
> > >> >
> > >> > In the meantime I will try in gromacs to get
> > the .top file from the .gro and see if this would work to
> > get the .psf.
> > >>
> > >> one possible alternative (untested):
> > >>
> > >> #load .gro and .psf file into vmd
> > >> set mol1 [mol new myfile.psf waitfor all]
> > >> set mol2 [mol new myfile.gro waitfor all]
> > >> set sel1 [atomselect $mol1 all]
> > >> set sel2 [atomselect $mol2 water]
> > >>
> > >> # merge selections into new molecule.
> > >> package require topotools
> > >> ::TopoTools::selections2mol "$sel1 $sel2"
> > >>
> > >> # write out new molecule
> > >> animate write psf combined.psf
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> > Thanks
> > >> > Rabab Toubar
> > >> >
> > >> >
> > >> > --- On Tue, 6/15/10, Axel Kohlmeyer <akohlmey_at_gmail.com>
> > wrote:
> > >> >
> > >> > From: Axel Kohlmeyer <akohlmey_at_gmail.com>
> > >> > Subject: Re: vmd-l: top2psf.tcl
> > >> > To: "Rabab Toubar" <rtoubar_at_yahoo.com>
> > >> > Cc: "vmd-l" <vmd-l_at_ks.uiuc.edu>
> > >> > Date: Tuesday, June 15, 2010, 9:29 AM
> > >> >
> > >> > On Tue, Jun 15, 2010 at 9:21 AM, Rabab Toubar
> > <rtoubar_at_yahoo.com>
> > wrote:
> > >> > >
> > >> > > Thanks Axel for your reply
> > >> > >
> > >> > > My .top file has no waters, as it is the
> > initial .top file I get using grompp, and it has a total of
> > 357 atoms (attached).
> > >> > >
> > >> > > The md gro file has 11632, and it
> > contains waters.
> > >> >
> > >> > well, you cannot load multiple files into the
> > same VMD
> > >> > "molecule" that have different number of
> > atoms.
> > >> >
> > >> > > I can visualize the molecule using .pdb
> > or .gro file with the .trr, but I need to have a psf files
> > for further analyses, so can I possibly include waters in
> > the top file? or may be delete it from the .trr file?
> > >> >
> > >> > what exactly do you need the .psf file for?
> > >> >
> > >> > the one generated from the .top file is only
> > minimal
> > >> > and only contains the bonding information and
> > atom
> > >> > names. that is suitable for visualization in
> > VMD, but
> > >> > not much more. in most cases, you can
> > generate the
> > >> > same kind of file by loading a .gro or .pdb
> > file and saving
> > >> > the result in a .psf file. only if you have
> > unusual bonding,
> > >> > you'd need to read it from the .top file.
> > >> >
> > >> > cheers,
> > >> > axel.
> > >> >
> > >> >
> > >> >
> > >> > >
> > >> > > Thanks
> > >> > > Rabab Toubar
> > >> > >
> > >> > >
> > >> > > --- On Sun, 6/13/10, Axel Kohlmeyer
> > <akohlmey_at_gmail.com>
> > wrote:
> > >> > >
> > >> > > From: Axel Kohlmeyer <akohlmey_at_gmail.com>
> > >> > > Subject: Re: vmd-l: top2psf.tcl
> > >> > > To: "Rabab Toubar" <rtoubar_at_yahoo.com>
> > >> > > Cc: "vmd-l" <vmd-l_at_ks.uiuc.edu>
> > >> > > Date: Sunday, June 13, 2010, 8:19 AM
> > >> > >
> > >> > > > However when I load the psf file in
> > vmd, I got the following:
> > >> > > >
> > >> > > > "psfplugin) WARNING: no angles
> > defined in PSF file.
> > >> > > > psfplugin) WARNING: no dihedrals
> > defined in PSF file.
> > >> > > > psfplugin) WARNING: no impropers
> > defined in PSF file.
> > >> > > > psfplugin) no cross-terms defined
> > in PSF file.
> > >> > > > Info) Analyzing structure ...
> > >> > > > Info) Atoms: 357
> > >> > > > Info) Bonds: 365
> > >> > > > Info) Angles: 0 Dihedrals:
> > 0 Impropers: 0 Cross-terms: 0
> > >> > > > Info) Bondtypes: 0
> > Angletypes: 0 Dihedraltypes: 0 Impropertypes: 0
> > >> > > > Info) Residues: 36
> > >> > > > Info) Waters: 0
> > >> > > > Info) Segments: 1
> > >> > > > Info) Fragments: 1
> > Protein: 1 Nucleic: 0"
> > >> > >
> > >> > > that is to be expected after the debug
> > output from above.
> > >> > >
> > >> > > > And when I load the trr file from
> > GMX, I get the following:
> > >> > > >
> > >> > > > "ERROR) BaseMolecule: attempt to
> > init atoms while structure building in progress!
> > >> > > > ERROR) Invalid number of atoms in
> > file: 11632
> > >> > > > Info) Using plugin trr for
> > coordinates from file /home/Desktop/gmx/pr_md_1.trr
> > >> > > > ERROR) Incorrect number of atoms
> > (11632) in
> > >> > > > ERROR) coordinate file
> > /home/Desktop/gmx/pr_md_1.trr
> > >> > > > Info) Finished with coordinate file
> > /home/Desktop/gmx/pr_md_1.trr."
> > >> > >
> > >> > > either the .trr file doesnt match the
> > .top file, or there is something
> > >> > > else wrong, that is impossible to debug
> > without having access
> > >> > > to those files. have you tried loading a
> > matching.gro file?
> > >> > > how many atoms does it have?
> > >> > >
> > >> > > cheers,
> > >> > > axel.
> > >> > >
> > >> > > > PS I am using the preprocessed top
> > file like Axel suggested in an earlier post
> > >> > > >
> > >> > > > Any suggestions would be much
> > appreciated
> > >> > > > Thanks
> > >> > > > Rabab Toubar
> > >> > >
> > >> > >
> > >> > >
> > >> > > --
> > >> > > Dr. Axel Kohlmeyer akohlmey_at_gmail.com
> > >> > > http://sites.google.com/site/akohlmey/
> > >> > >
> > >> > > Institute for Computational Molecular
> > Science
> > >> > > Temple University, Philadelphia PA,
> > USA.
> > >> > >
> > >> > >
> > >> >
> > >> >
> > >> >
> > >> > --
> > >> > Dr. Axel Kohlmeyer akohlmey_at_gmail.com
> > >> > http://sites.google.com/site/akohlmey/
> > >> >
> > >> > Institute for Computational Molecular
> > Science
> > >> > Temple University, Philadelphia PA, USA.
> > >> >
> > >>
> > >>
> > >>
> > >> --
> > >> Dr. Axel Kohlmeyer akohlmey_at_gmail.com
> > >> http://sites.google.com/site/akohlmey/
> > >>
> > >> Institute for Computational Molecular Science
> > >> Temple University, Philadelphia PA, USA.
> > >>
> > >
> > >
> > >
> > > --
> > > Dr. Axel Kohlmeyer akohlmey_at_gmail.com
> > > http://sites.google.com/site/akohlmey/
> > >
> > > Institute for Computational Molecular Science
> > > Temple University, Philadelphia PA, USA.
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> > --
> > Dr. Axel Kohlmeyer akohlmey_at_gmail.com
> > http://sites.google.com/site/akohlmey/
> >
> > Institute for Computational Molecular Science
> > Temple University, Philadelphia PA, USA.
> >
>
>
>
>

-- 
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com
http://sites.google.com/site/akohlmey/
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.