Attachment 'H2O_density_plot.py'

Download

   1 #!/usr/bin/env python
   2 
   3 from Dacapo import Dacapo
   4 from ASE.Visualization.VTK import VTKPlotArray, VTKPlotAtoms
   5 
   6 atoms_dimer = Dacapo.ReadAtoms("2H2O.nc")
   7 atoms_molecule1 = Dacapo.ReadAtoms("H2Oa.nc")
   8 atoms_molecule2 = Dacapo.ReadAtoms("H2Ob.nc")
   9 
  10 calc_dimer = atoms_dimer.GetCalculator()
  11 calc_molecule1 = atoms_molecule1.GetCalculator()
  12 calc_molecule2 = atoms_molecule2.GetCalculator()
  13 
  14 
  15 dens_dimer = calc_dimer.GetDensityArray()
  16 dens_molecule1 = calc_molecule1.GetDensityArray()
  17 dens_molecule2 = calc_molecule2.GetDensityArray()
  18 
  19 dens_diff = dens_dimer - (dens_molecule1 + dens_molecule2)
  20 
  21 plot = VTKPlotArray(dens_diff, atoms_dimer.GetUnitCell())
  22 plot.SetTranslation((0,0,0))
  23 
  24 atomplot = VTKPlotAtoms(atoms_dimer, parent = plot)
  25 atomplot.RemoveAvatar(atomplot.unitcell)
  26 plot.Render()
  27 
  28 
  29 #If one wants the atoms white
  30 #atomavatar.SetAtomColors((1,1,1))
  31 
  32 #Get a handle on the isosurfaces and only look at two
  33 #at +-15
  34 isosurface1=plot.GetIsoSurface1()
  35 isosurface1.SetContourRange((-3,3))
  36 isosurface1.SetColorRange((-3,3))
  37 isosurface1.SetNumberOfContours(2)
  38 plot.Render()
  39 
  40 #The isosurface at -15 is colored blue, the one at +15 yellow
  41 plot.GetColorTable().SetRGBColors(['blue','yellow'])
  42 plot.GetAvatars()[0].GetActorProperty().SetOpacity(0.35)
  43 plot.Render()

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2006-02-07 13:04:54, 1.0 KB) [[attachment:2H2O.py]]
  • [get | view] (2006-02-07 13:03:11, 1.2 KB) [[attachment:H2O_density_plot.py]]
  • [get | view] (2006-02-07 13:03:40, 23.6 KB) [[attachment:H2O_densplot.jpg]]
  • [get | view] (2006-02-07 13:02:12, 0.5 KB) [[attachment:H2O_freeze1.py]]
  • [get | view] (2006-02-07 13:02:29, 0.5 KB) [[attachment:H2O_freeze2.py]]
  • [get | view] (2006-02-03 14:11:18, 76.6 KB) [[attachment:NMA_densplot.jpg]]
  • [get | view] (2006-02-03 14:10:55, 1.3 KB) [[attachment:diff_density_plot.py]]
  • [get | view] (2006-02-03 14:10:22, 27.3 KB) [[attachment:nma_model.jpg]]
  • [get | view] (2006-02-03 14:09:54, 44.1 KB) [[attachment:peptidechain.jpg]]
  • [get | view] (2006-02-07 12:59:18, 88.2 KB) [[attachment:scheme_anti.jpg]]
  • [get | view] (2006-02-07 12:59:38, 86.6 KB) [[attachment:scheme_par.jpg]]
  • [get | view] (2006-02-07 13:00:02, 28.6 KB) [[attachment:termination.jpg]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.