예제 #1
0
파일: bigdft.py 프로젝트: andersx/qctoolkit
def write(self, name=None):
    today = datetime.date.today()
    out = InpContent(name)
    out.write('Goedecker pseudopotential for %s\n' % \
      qtk.Z2n(self.param['Z']))
    out.write('   %2d  %2d  %s ! Z, ZV, date(ddmmyy)\n' %\
      (self.param['Z'], self.param['ZV'], today.strftime('%d%m%y')))
    out.write('   %d  %s  2 0 2002 0  ! xc:%s\n' %\
      (type_dict[self.setting['type']],
       xc_dict[self.param['xc']],
       self.param['xc']))
    out.write('   %12.8f %3d' % (self.param['r_loc'], self.param['Cn']))
    for i in range(self.param['Cn']):
        out.write(' % 12.8f' % self.param['Ci'][i])
    out.write(' ! rloc, #C, C[i]')
    out.write('\n  %d\n' % self.param['l_max'])
    for i in range(len(self.param['r_nl'])):
        r_nl = self.param['r_nl'][i]
        h_ij = self.param['h_ij'][i]
        out.write('   %12.8f %3d' % (r_nl, len(h_ij)))
        if len(h_ij) > 0:
            for j in range(len(h_ij)):
                if j > 0:
                    out.write('%19s' % '')
                for k in range(j, len(h_ij)):
                    out.write(' % 12.8f' % h_ij[j][k])
                if j == 0:
                    out.write(' ! h_ij\n')
                else:
                    out.write('\n')
        else:
            out.write(' % 12.8f\n' % 0)
    if self.param['r_nl'] > 0:
        for j in range(len(h_ij)):
            out.write('%19s' % '')
            for k in range(j, len(h_ij)):
                out.write(' % 12.8f' % 0.0)
            if j == 0:
                out.write(' ! abinit k_ij\n')
            else:
                out.write('\n')
    if self.setting['type'] == 'nlcc':
        out.write('   %12.8f     %12.8f' %\
          (self.param['rcore'], self.param['qcore']))
    out.close()
예제 #2
0
def write(self, name=None):
  today = datetime.date.today()
  out = InpContent(name)
  out.write('Goedecker pseudopotential for %s\n' % \
    qtk.Z2n(self.param['Z']))
  out.write('   %2d  %2d  %s ! Z, ZV, date(ddmmyy)\n' %\
    (self.param['Z'], self.param['ZV'], today.strftime('%d%m%y')))
  out.write('   %d  %s  2 0 2002 0  ! xc:%s\n' %\
    (type_dict[self.setting['type']], 
     xc_dict[self.param['xc']], 
     self.param['xc']))
  out.write('   %12.8f %3d' % (self.param['r_loc'], self.param['Cn']))
  for i in range(self.param['Cn']):
    out.write(' % 12.8f' % self.param['Ci'][i])
  out.write(' ! rloc, #C, C[i]')
  out.write('\n  %d\n' % self.param['l_max'])
  for i in range(len(self.param['r_nl'])):
    r_nl = self.param['r_nl'][i]
    h_ij = self.param['h_ij'][i]
    out.write('   %12.8f %3d' % (r_nl, len(h_ij)))
    if len(h_ij) > 0:
      for j in range(len(h_ij)):
        if j > 0:
          out.write('%19s' % '')
        for k in range(j, len(h_ij)):
          out.write(' % 12.8f' % h_ij[j][k])
        if j == 0:
          out.write(' ! h_ij\n')
        else:
          out.write('\n')
    else:
      out.write(' % 12.8f\n' % 0)
  if self.param['r_nl'] > 0:
    for j in range(len(h_ij)):
      out.write('%19s' % '')
      for k in range(j, len(h_ij)):
        out.write(' % 12.8f' % 0.0)
      if j == 0:
        out.write(' ! abinit k_ij\n')
      else:
        out.write('\n')
  if self.setting['type'] == 'nlcc':
    out.write('   %12.8f     %12.8f' %\
      (self.param['rcore'], self.param['qcore']))
  out.close()
예제 #3
0
파일: cpmd.py 프로젝트: andersx/qctoolkit
def write(self, name=None):
    out = InpContent(name)
    out.write('&ATOM\n')
    out.write(' Z  = %4.2f\n' % self.param['Z'])
    out.write(' ZV = %4.2f\n' % self.param['ZV'])
    out.write(' XC = %04d    %12.10f\n'\
               % (xc_dict[self.param['xc']], xc_dict['factor']))
    out.write(' TYPE = NORMCONSERVING GOEDECKER\n')
    out.write('&END\n')
    out.write('&INFO\n')
    out.write(' %s\n' % self.info)
    out.write('&END\n')
    out.write('&POTENTIAL\n')
    out.write('    GOEDECKER\n')
    out.write('  %-33d LMAX\n' % self.param['l_max'])
    out.write('   %12.9f%25s\n' % (self.param['r_loc'], 'RC'))
    out.write('  %d ' % self.param['Cn'])
    for c in self.param['Ci']:
        out.write(' %12.9f ' % c)
    for i in range(len(self.param['h_ij'])):
        h_ij = self.param['h_ij'][i]
        r_nl = self.param['r_nl'][i]
        elem = []
        for j in range(len(h_ij)):
            for k in range(j, len(h_ij)):
                elem.append(h_ij[k, j])
        #upper = [list(v) for v in np.triu(h_ij)]
        #elem = [e for v in upper for e in v if e]
        out.write('\n% 15.9f %2d' % (r_nl, len(h_ij)))
        for e in elem:
            out.write(' %12.9f' % e)
    out.write('\n&END')

    out.close()
예제 #4
0
파일: cpmd.py 프로젝트: SamKChang/qctoolkit
def write(self, name=None):
  out = InpContent(name)
  out.write('&ATOM\n')
  out.write(' Z  = %4.2f\n' % self.param['Z'])
  out.write(' ZV = %4.2f\n' % self.param['ZV'])
  out.write(' XC = %04d    %12.10f\n'\
             % (xc_dict[self.param['xc']], xc_dict['factor']))
  out.write(' TYPE = NORMCONSERVING GOEDECKER\n')
  out.write('&END\n')
  out.write('&INFO\n')
  out.write(' %s\n' % self.info)
  out.write('&END\n')
  out.write('&POTENTIAL\n')
  out.write('    GOEDECKER\n')
  out.write('  %-33d LMAX\n' % self.param['l_max'])
  out.write('   %12.9f%25s\n' % (self.param['r_loc'], 'RC'))
  out.write('  %d ' % self.param['Cn'])
  for c in self.param['Ci']:
    out.write(' %12.9f ' % c)
  for i in range(len(self.param['h_ij'])):
    h_ij = self.param['h_ij'][i]
    r_nl = self.param['r_nl'][i]
    elem = []
    for j in range(len(h_ij)):
      for k in range(j, len(h_ij)):
        elem.append(h_ij[k, j])
    #upper = [list(v) for v in np.triu(h_ij)]
    #elem = [e for v in upper for e in v if e]
    out.write('\n% 15.9f %2d' % (r_nl, len(h_ij)))
    for e in elem:
      out.write(' %12.9f' % e)
  out.write('\n&END')

  out.close()