From: John Stone (
Date: Thu Dec 17 2020 - 00:44:32 CST

  I had to manually approve your posting due to a mismatched submission
vs. subscription email address.

Your script should instead be written with modern VMD syntax and
in particular with "waitfor all" to prevent evaluation of the dipole
moment prior to completion of file loading:
  mol new uc000.psf waitfor all
  mol addfile uc000.pdb waitfor all
  set sel [atomselect top all]
  set outfile [open dipolet.dat w]
  puts $outfile catch [measure dipole $sel -debye -masscenter]
  close $outfile

Best regards,
  John Stone

On Wed, Dec 16, 2020 at 02:04:59PM +0000, Hamish Swanson wrote:
> Hi there,
> I am trying to determine the dipole moment of a small molecule (c000
> arbitrary name) using the following .tcl script:
> > mol load psf uc000.psf #molecule psf
> > mol load pdb uc000.pdb #molecule pdb
> > set sel [atomselect top all]
> > set outfile [open dipolet.dat w] #desired output file
> name
> > puts $outfile catch [measure dipole $sel -debye -masscenter]
> > close $outfile
> VMD returns [0.0 0.0 0.0] as the dipole moment vector. However, when I
> load the molecule to VMD and repeat the procedure by hand a dipole moment
> as expected is returned by the Tk console. This gives me confidence in the
> validity of the .psf and .pdb files, I have also used these in the setup
> water box equilibration simulations previously, so I do not think they are
> the cause of the issue.
> It is my plan to determine the dipole moment for a series of molecules
> quickly, hence the script and doing this by hand is not viable.
> I am new to VMD and TCL so any input would be much appreciated.
> Thanks,
> Hamish Swanson
> PhD Student
> The University of Strathclyde
> Glasgow

NIH Center for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801           Phone: 217-244-3349