以前のリビジョンの文書です


波動関数

[kimi@ssp1 ncfiles]$ ./getwfs 
usage: getwfs [-w] input_nc_file output_file_prefix

options:
  -h, --help          show this help message and exit
  -w, --wavefunction  create xyz format files for all wavefunctions

[kimi@ssp1 ncfiles]$ cat ./getdensity ./getwfs 
#!/usr/bin/env python
from math import log10
from optparse import OptionParser

from Dacapo import Dacapo
from ASE.IO.Cube import WriteCube

cmd = OptionParser(usage = '%prog [-w] input_nc_file output_file_prefix')
cmd.add_option('-w', '--wavefunction', action = "store_true", default = False,
               help = 'create xyz format files for all wavefunctions')


(opt, argv) = cmd.parse_args()

if len(argv) != 2:
    cmd.print_help()
    raise SystemExit

ncfile = argv[0]
cubefileprefix = argv[1]

model = Dacapo.ReadAtoms(ncfile)
calculator = model.GetCalculator()

if opt.wavefunction is not True:
  density = calculator.GetDensityArray()
  cubefile = '%s.xyz' % cubefileprefix
  WriteCube(model, density, cubefile)
else:
  NumberOfBands = calculator.GetNumberOfBands()
  NumberOfKpoints = len(calculator.GetIBZKPoints())
  isSpinPolarized = calculator.GetSpinPolarized()
  if (isSpinPolarized):
    NumberOfSpins = 2
  else:
    NumberOfSpins = 1

  for nband in range(NumberOfBands):
    for nkpt in range(NumberOfKpoints):
      for nspin in range(NumberOfSpins):
        cubefile = '%s' % cubefileprefix
        fmts = '%%0%dd' % (log10(NumberOfBands) + 1)
        cubefile += fmts % nband
        if (NumberOfKpoints > 1):
          fmts = 'k%%0%dd' % (log10(NumberOfKpoints) + 1)
          cubefile += fmts % nkpt
        if (NumberOfSpins > 1):
          cubefile += 's%1d' % nspin
        cubefile += '.cube'
        print cubefile
        wf = calculator.GetWaveFunctionArray(band = nband,
                                              kpt = nkpt,
                                             spin = nspin)
        WriteCube(model, wf, cubefile)


[kimi@ssp1 ncfiles]$ 
ab_initio/波動関数.1233417521.txt.gz · 最終更新: 2009/02/01 00:58 by kimi
www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0