コード例 #1
0
ファイル: input.py プロジェクト: mdavezac/LaDa
def test():
  """ Tests functional prints and reads itself """
  from pylada.dftcrystal.functional import Functional
  from pylada.dftcrystal import Crystal
  from pylada.dftcrystal.parse import parse
  parsed = parse(string)
  structure = Crystal()
  structure.read_input(parsed['rutile']['CRYSTAL'])
  a = Functional()
  a.read_input(parsed)
  assert a.scfdir 
  assert a.maxcycle == 300
  assert a.exchsize == 6937578
  # need structure otherwise parse can't find beginning of input.
  otherstring = a.print_input(structure=structure)
  otherparsed = parse(otherstring)
  b = Functional()
  b.read_input(otherparsed)
  assert otherstring == b.print_input(structure=structure)
コード例 #2
0
ファイル: rawbasis.py プロジェクト: georgeyumnam/pylada
def test_output_map():
  from pylada.dftcrystal import Functional, Crystal
  from pylada.dftcrystal.parse import parse

  a = Functional()
  parsed = parse(input)['']
  a.basis.read_input(parsed['BASISSET'])
  structure = Crystal()
  structure.read_input(parsed['CRYSTAL'])
  o = a.basis.output_map(structure=structure)
  assert len(o) == 1
  assert o[0] == ('ghosts', '2\n1 2')
  a.basis.ghosts.breaksym = False
  o = a.basis.output_map(structure=structure)
  assert len(o) == 2
  assert o[0] == ('keepsymm', True)
  assert o[1] == ('ghosts', '2\n1 2')
  b = Functional()
  b.basis.raw = o.prefix
  assert set(b.basis) == set(['O', 'Ti'])
  assert repr(b.basis['O']) == repr(a.basis['O'])
  assert repr(b.basis['Ti']) == repr(a.basis['Ti'])