From: John Stone (johns_at_ks.uiuc.edu)
Date: Tue Jan 24 2012 - 15:23:04 CST

Here's a little script that does this for all atoms in a structure, using
the "readcharmmpar" plugin that's already included with VMD. The script
loops over all of the unique atom types in your structure, and tries to
find them in one of the CHARMM parameter files you specify, or in the
CHARMM parameter file included with the readcharmmpar plugin by default,
if you don't specify them. You can call it like this:
  set_radii_from_charmm_par top

Here's the little script, I welcome improvements:

package require readcharmmpar

proc set_radii_from_charmm_par { molid args } {
  global env

  # If no parameter files are specified, use the default parameter
  # file included with the readcharmmpar plugin.
  if { [llength $args] < 1 } {
    set parfiles [list [file join $env(CHARMMPARDIR) "par_all27_prot_lipid_na.inp" ]]
  } else {
    set parfiles $args
  }

  set paramsetlist {}
  foreach file $parfiles {
    lappend paramsetlist [::Pararead::read_charmm_parameters $file]
  }

  set allsel [atomselect $molid all]
  set typelist [lsort -uniq [$allsel get type]]
  $allsel delete

  foreach type $typelist {
    set typesel [atomselect $molid "type $type"]
    if { [$typesel num] > 0 } {
      for {set paridx 0} {$paridx < [llength $paramsetlist]} {incr paridx} {
        set vdwparams [::Pararead::getvdwparam [lindex $paramsetlist $paridx] $type]
        if {[llength $vdwparams] > 0} {
          set Rmin2_14 [lindex $vdwparams 1]
          set R [expr $Rmin2_14 * 1.0]
          puts "Setting VdW radii for '$type' to $R"
          $typesel set radius $R
          break;
        }
      }
    }
    $typesel delete
  }
}

On Sun, Jan 22, 2012 at 09:27:30PM -0000, Cosseddu, Salvatore wrote:
> Dear Elia
>
> If you use AUTOPSF I presume you are using CHARMM FF. If you are
> interested in using as VdW radii the R_min/2 parameters, take a look to
> https://github.com/s-cosseddu/VMD-scripts
> It's the test folder I made when I was first setting github. It happened
> that in those days I was working on a parser for CHARMM FF par files. This
> is the only script you will find there (I had no time to upload more).
>
> The version uploaded on github does exactly what I said before: put Rmin/2
> from your FF file (CHARMM format) in the VMD radius field for each atom.
>
> Usage: from TkConsole
>
> source parseCHARMMpar.tcl
> ::parseCHARMMpar::VdWassign <molID> <CHARMM parameter file>
>
> molID could be "top" (i.g. if there is only one loaded molecule) or the
> number on the left of the loaded molecule on the VMD main window.
>
> try if it helps
>
> Regards
>
> --
> Salvatore Cosseddu
> PhD student
> Centre for Scientific Computing and School of Engineering
> University of Warwick
> Coventry CV4 7AL
> United Kingdom
>
> email: S.M.Cosseddu_at_warwick.ac.uk
>
> -----Original Message-----
> From: owner-vmd-l_at_ks.uiuc.edu on behalf of Zumot, Elia Nabil
> Sent: Sat 21/01/2012 01:55
> To: John Stone
> Cc: Axel Kohlmeyer; vmd-l_at_ks.uiuc.edu
> Subject: RE: vmd-l: ionic radii of sodium and chloride
>
> Hi John,
>
> All my pdb and psf files were generated with VMD(1.8.7 or 1.9) and the
> AutoPSF plugin.
> Also, all my simulations were run by NAMD (2.7 or 2.8) (thus, dcd and
> restart.coor files).
> resnames here are SOD and CLA.
>
> I'm assuming the values that you will tell me about are the ones that will
> be multiplied by the scaling factor set by the user in the "sphere scale"
> in the "graphical representations" window for display?
>
> And if use the tcl command:
> $sel set radius 1.0
> Does this mean a radius of 1 Angstrom or a scaling of 1?
>
> Thanks a lot
>
> Elia
>
> Elia Zomot, PhD
> Computational and Systems Biology Department
> School of Medicine, University of Pittsburgh
> 3083 BST3, 3501 Fifth Ave, Pittsburgh, PA 15213
> Voice: 412 624 8699 - Fax: 412 648 3163
> enz1_at_pitt.edu
> ________________________________________
> From: John Stone [johns_at_ks.uiuc.edu]
> Sent: Friday, January 20, 2012 3:05 PM
> To: Zumot, Elia Nabil
> Cc: Axel Kohlmeyer; vmd-l_at_ks.uiuc.edu
> Subject: Re: vmd-l: ionic radii of sodium and chloride
>
> Hi Elia,
> The way VMD assigns atomic properties (e.g. radii, masses, etc) depends
> greatly upon what file formats you used when you loaded the structure into
> VMD. Some file formats provide VMD with explicit values for all of the
> key atomic properties, other file formats provide nothing but the atom
> name and coordinates. In the cases where the files loaded do not contain
> an atomic property such as the radius, VMD has to "guess" this information
> using some combination of the atomic properties that the file does
> specify.
> Some VMD molecule file reader plugins also contain their own atomic
> property lookup tables because they are able to do a better job at
> guessing
> than VMD can because they have access to file-format-specific details that
> VMD doesn't know about. So, the particular strategy that is used for a
> given
> structure depends directly on the details of what files you loaded, what
> file formats they were stored in, and what information was contained
> therein.
>
> If you me us more about what files you're loading, I can tell you how the
> radii are getting assigned.
>
> Axel's suggestion is a simple way to address the immediate problem by
> overriding the auto-assigned radii with an atom selection command.
>
> Cheers,
> John
>
> On Fri, Jan 20, 2012 at 11:57:19AM -0500, Zumot, Elia Nabil wrote:
> > Thank you Axel.
> >
> > Could you direct me to the file that contains the atomic radii that are
> displayed in VMD?
> >
> > (I have found the PeriodicTable.C file but it contains the correct ionic
> radii)
> >
> > Best
> >
> > Elia
> >
> >
> >
> >
> > Elia Zomot, PhD
> > Computational and Systems Biology Department
> > School of Medicine, University of Pittsburgh
> > 3083 BST3, 3501 Fifth Ave, Pittsburgh, PA 15213
> > Voice: 412 624 8699 - Fax: 412 648 3163
> > enz1_at_pitt.edu
> > ________________________________________
> > From: Axel Kohlmeyer [akohlmey_at_gmail.com]
> > Sent: Thursday, January 19, 2012 10:12 PM
> > To: Zumot, Elia Nabil
> > Cc: vmd-l_at_ks.uiuc.edu
> > Subject: Re: vmd-l: ionic radii of sodium and chloride
> >
> > On Jan 19, 2012, at 10:03 PM, "Zumot, Elia Nabil" <enz1_at_pitt.edu> wrote:
> >
> > > Dear VMDers,
> > >
> > > Any reason why VMD shows sodium ions to be bigger than chloride when
> it should be the other way around?
> > >
> > > In crystals the radius of Na+ is 0.095 nm and that of Cl- 0.181 nm.
> > >
> >
> > That is because VMD cannot tell the difference between an element and
> > an ion or a chlorine or chloride and a carbon.
> >
> > If you don't like VMD's choices you can always write a little script
> > that changes it or use a file format that does contain the radius
> > information in a way that VMD supports reading it.
> >
> > VMD is very deliberately a very dumb and ignorant software that relies
> > on you to provide it with the proper information. It does not even try
> > to be smart (for the most part, that is).
> >
> > Axel
> >
> >
> >
> > >
> > > Thanks
> > >
> > > Elia Zomot
> > >
> > >
> > >
> > > Elia Zomot, PhD
> > > Computational and Systems Biology Department
> > > School of Medicine, University of Pittsburgh
> > > 3083 BST3, 3501 Fifth Ave, Pittsburgh, PA 15213
> > > Voice: 412 624 8699 - Fax: 412 648 3163
> > > enz1_at_pitt.edu
>
> --
> NIH Resource for Macromolecular Modeling and Bioinformatics
> Beckman Institute for Advanced Science and Technology
> University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> http://www.ks.uiuc.edu/~johns/ Phone: 217-244-3349
> http://www.ks.uiuc.edu/Research/vmd/ Fax: 217-244-6078

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/       Fax: 217-244-6078