# 差分

この文書の現在のバージョンと選択したバージョンの差分を表示します。

ab_initio:ase_manual 2009/01/24 01:02 ab_initio:ase_manual 2009/05/19 18:35 現在
ライン 4: ライン 4:
from LinearAlgebra import Heigenvalues from LinearAlgebra import Heigenvalues
from Numeric import array from Numeric import array
-a = array([[1.0, 0.01j], [-0.01j, 1.0]]) +a1 = array([[1.0, 0.01j], [-0.01j, 1.0]])
-b = Heigenvalues(a+b1 = Heigenvalues(a1
-print b+print b1
</code> </code>
ライン 12: ライン 12:
<code python> <code python>
-the_filename = 'out.nc'+f1 = 'out.nc'
from Dacapo import Dacapo from Dacapo import Dacapo
-the_model = Dacapo.ReadAtoms(filename = the_filename+s1 = Dacapo.ReadAtoms(filename = f1
-the_calculator = the_model.GetCalculator()+c1 = s1.GetCalculator()
from ASE.Utilities.DOS import DOS from ASE.Utilities.DOS import DOS
-a_dos = DOS(the_calculator+d1 = DOS(c1
-= a_dos.GetEnergies() +x0 = d1.GetEnergies()
-y1 = a_dos.GetDOS(0) +y1 = d1.GetDOS(0)
-y2 = a_dos.GetDOS(1)+y2 = d1.GetDOS(1)
-for i in range(len(x)): +for i in range(len(x0)):
-  print x[i], y1[i], -y2[i]+  print x0[i], y1[i], -y2[i]
</code> </code>
+===== WriteXYZ =====
+<code python>
+from Dacapo import Dacapo
+s1 = Dacapo.ReadAtoms(filename = 'out.nc')
-===== VTK (Visual Tool Kit) =====+from ASE.IO.xyz import WriteXYZ
+WriteXYZ('out.xyz', atoms = s1)
+</code>
+==== 標準ツール trajectory2xyz ソースコード ====
<code python> <code python>
+#!/usr/bin/env python
+from optparse import OptionParser
-band = 0 +from ASE.IO.xyz import WriteXYZ
-'CO_in_a_box.nc'+from ASE.Trajectories.NetCDFTrajectory import NetCDFTrajectory
-from ASE import ListOfAtoms +
-from ASE import Atom +
-from ASE.Visualization.VTK import VTKPlotWaveFunction +parser = OptionParser(usage='%prog [-r R1 R2 R3] trajectory xyzfile',
-from ASE.Visualization.VTK import VTKPlotAtoms+                      version='%prog 0.1')
+parser.add_option('-r', '--repeat', type='int', nargs=3,
+                 help='Repeat R1, R2, R3 times along the three axes',
+                  metavar='R1 R2 R3')
+
+options, args = parser.parse_args()
+
+if len(args) != 2:
+    parser.print_help()
+    raise SystemExit
+
+print 'Creating xyz file:' ,args[1]
+trajectory = NetCDFTrajectory(args[0])
+WriteXYZ(args[1],trajectory=trajectory,repeat=options.repeat,id=args[0])
+</code>
+
+===== VTK (Visual Tool Kit) =====
+
+<code python>
+f1 = 'out.nc'
from Dacapo import Dacapo from Dacapo import Dacapo
-atoms = Dacapo.ReadAtoms(filename='CO_in_a_box.nc') +s1 = Dacapo.ReadAtoms(filename = f1)
-calc = atoms.GetCalculator()+
-# make a combined plot of the wavefunction and the atoms +from ASE.Visualization.VTK import VTKPlotAtoms
-atomplot = VTKPlotAtoms(atoms+ap1 = VTKPlotAtoms(s1
-wfplot = VTKPlotWaveFunction(atoms,band=band,parent=atomplot) +</code>
-atomplot.Update()+
-# The appearence of the individual atomic elements can also be changed. +<code python>
-# Finding aluminium atom avatar (found in the dictionary of species avatars) +f1 = 'out.nc'
-p1_O=atomplot.GetDictOfSpecies()['O'] +
-p1_C=atomplot.GetDictOfSpecies()['C']+
-# Change the radius to 2.0 AA and set the color to blue +from Dacapo import Dacapo
-#The color is given in an rgb (red,green,blue) scale +from ASE.Visualization.VTK import VTKPlotDensity
-p1_C.SetColor((1,0,0)) +dp1 = VTKPlotDensity(s1, showatoms = True
-p1_O.SetColor((0,1,0)+</code>
-atomplot.Render()+
-# The unitcell can be removed +<code python>
-unitcell=atomplot.unitcell +f1 = 'out.nc'
-atomplot.RemoveAvatar(unitcell) +m1 = 0
-atomplot.Render()+
+from Dacapo import Dacapo
+s1 = Dacapo.ReadAtoms(filename = f1)
+from ASE.Visualization.VTK import VTKPlotWaveFunction
+wp1 = VTKPlotWaveFunction(s1, band = m1, showatoms = True)
+</code>
ab_initio/ase_manual.1232726554.txt.gz · 最終更新: 2009/01/24 01:02 by kimi