parameters: (item, linkage, isSowReap, isC4notP4, isC4fully, zmat, outdir, scrdir, c4scrdir, lowername, kwargs)
return_statement: return fjobarc
docstring: Provided with the particular displacement number *item* and the
      associated *zmat* file with geometry and *linkage*, returns the
      FJOBARC contents. Depending on the mode settings of *isC4notP4*,
      *isSowReap*, and *isC4fully*, either runs (using *lowername* and
      *kwargs*) or reaps contents. *outdir* is where psi4 was invoked,
      *scrdir* is the psi4 scratch directory, and *c4scrdir* is Cfour
      scratch directory within.
docstring_summary: Provided with the particular displacement number *item* and the
      associated *zmat* file with geometry and *linkage*, returns the
      FJOBARC contents. Depending on the mode settings of *isC4notP4*,
      *isSowReap*, and *isC4fully*, either runs (using *lowername* and
      *kwargs*) or reaps contents. *outdir* is where psi4 was invoked,
      *scrdir* is the psi4 scratch directory, and *c4scrdir* is Cfour
      scratch directory within.
docstring_tokens: Provided with the particular displacement number * item * and the associated * zmat * file with geometry and * linkage * returns the FJOBARC contents . Depending on the mode settings of * isC4notP4 * * isSowReap * and * isC4fully * either runs ( using * lowername * and * kwargs * ) or reaps contents . * outdir * is where psi4 was invoked * scrdir * is the psi4 scratch directory and * c4scrdir * is Cfour scratch directory within .
function: def vpt2_reaprun_files(item, linkage, isSowReap, isC4notP4, isC4fully, zmat, outdir, scrdir, c4scrdir, lowername, kwargs):
      """Provided with the particular displacement number *item* and the
      associated *zmat* file with geometry and *linkage*, returns the
      FJOBARC contents. Depending on the mode settings of *isC4notP4*,
      *isSowReap*, and *isC4fully*, either runs (using *lowername* and
      *kwargs*) or reaps contents. *outdir* is where psi4 was invoked,
      *scrdir* is the psi4 scratch directory, and *c4scrdir* is Cfour
      scratch directory within.
  
      """
      os.chdir(outdir)  # current_directory
      # Extract qcdb.Molecule at findif orientation
      zmmol = qcdb.cfour.harvest_zmat(zmat)
  
      # Cfour S/R Direct for gradients
      if isC4fully:
          with open('VPT2-' + item + '.fja', 'r') as handle:
              fjobarc = handle.read()
  
      # Cfour for gradients
      elif isC4notP4:
  
          # S/R: Reap results from output file
          if isSowReap:
              isOk, msg, results = reap_job_validate(outdir, 'VPT2', item, linkage,
                  ['CURRENT ENERGY', 'CURRENT DIPOLE', 'CURRENT GRADIENT', 'CURRENT MOLECULE'])
              if not isOk:
                  raise ValidationError(msg)
  
              fje = results['CURRENT ENERGY']
              fjgrd = results['CURRENT GRADIENT']
              fjdip = [item / constants.dipmom_au2debye for item in results['CURRENT DIPOLE']]
              c4mol = qcdb.Molecule(results['CURRENT MOLECULE'])
              c4mol.update_geometry()
  
          # C: Run the job and collect results
          else:
              # Prepare Cfour skeleton calc directory
              os.chdir(scrdir + c4scrdir)  # psi_scratch/cfour
              if os.path.exists('scr.' + item):
                  shutil.rmtree('scr.' + item)
              os.mkdir('scr.' + item)
              os.chdir('scr.' + item)  # psi_scratch/cfour/scr.000-004
              with open('ZMAT', 'w') as handle:
                  handle.write(zmat)
              shutil.copy2('../harm/GENBAS', 'GENBAS')
  
              #os.chdir(scrdir + '/scr.' + item)
              #run_cfour_module('xja2fja')
              #with open('FJOBARC', 'r') as handle:
              #    fjobarc = handle.read()
  
              # Run Cfour calc using ZMAT & GENBAS in scratch, outdir redirects to outfile
              os.chdir(outdir)  # current_directory
              core.get_active_molecule().set_name('blank_molecule_psi4_yo')
              energy('cfour', path=c4scrdir + '/scr.' + item)
  #            os.chdir(scrdir + '/scr.' + item)
  
              fje = core.variable('CURRENT ENERGY')
              fjgrd = p4util.mat2arr(core.get_gradient())
              fjdip = [core.variable('CURRENT DIPOLE X') / constants.dipmom_au2debye,
                       core.variable('CURRENT DIPOLE Y') / constants.dipmom_au2debye,
                       core.variable('CURRENT DIPOLE Z') / constants.dipmom_au2debye]
              c4mol = qcdb.Molecule(core.get_active_molecule().create_psi4_string_from_molecule())
              c4mol.update_geometry()
  
          # Get map btwn ZMAT and C4 orientation, then use it, grad and dipole to forge FJOBARC file
          fjobarc = qcdb.cfour.format_fjobarc(fje,
              *qcdb.cfour.backtransform(chgeMol=zmmol, permMol=c4mol), gradient=fjgrd, dipole=fjdip)
  
      # Psi4 for gradients
      else:
          # Prepare Cfour skeleton calc directory
          os.chdir(scrdir + c4scrdir)  # psi_scratch/cfour
          if os.path.exists('scr.' + item):
              shutil.rmtree('scr.' + item)
          os.mkdir('scr.' + item)
          os.chdir('scr.' + item)  # psi_scratch/cfour/scr.000-004
          with open('ZMAT', 'w') as handle:
              handle.write(zmat)
          shutil.copy2('../harm/GENBAS', 'GENBAS')
  
          # Run Cfour skeleton calc and extract qcdb.Molecule at needed C4 orientation
          with open('partial.out', 'w') as handle:
              handle.write(run_cfour_module('xjoda'))
              handle.write(run_cfour_module('xvmol'))
              handle.write(run_cfour_module('xvmol2ja'))
          core.print_out('  CFOUR scratch file %s for %s has been read\n' % ('JOBARC (binary)', item))
          c4mol = qcdb.cfour.jajo2mol(qcdb.jajo.getrec(['COORD   ', 'ATOMCHRG', 'MAP2ZMAT', 'IFLAGS  ']))
  
          # S/R: Reap results from output file
          if isSowReap:
              isOk, msg, results = reap_job_validate(outdir, 'VPT2', item, linkage,
                  ['CURRENT ENERGY', 'CURRENT DIPOLE', 'CURRENT GRADIENT'])
              if not isOk:
                  raise ValidationError(msg)
  
              fje = results['CURRENT ENERGY']
              fjgrd = results['CURRENT GRADIENT']
              fjdip = [item / constants.dipmom_au2debye for item in results['CURRENT DIPOLE']]
  
          # C: Run the job and collect results
          else:
              core.IO.set_default_namespace(item)
              molecule = geometry(zmmol.create_psi4_string_from_molecule(), 'disp-' + item)
              molecule.update_geometry()
              gradient(lowername, **kwargs)
  
              fje = core.variable('CURRENT ENERGY')
              fjgrd = p4util.mat2arr(core.get_gradient())
              fjdip = [core.variable('CURRENT DIPOLE X') / constants.dipmom_au2debye,
                       core.variable('CURRENT DIPOLE Y') / constants.dipmom_au2debye,
                       core.variable('CURRENT DIPOLE Z') / constants.dipmom_au2debye]
  
          # Transform results into C4 orientation (defined by c4mol) & forge FJOBARC file
          fjobarc = qcdb.cfour.format_fjobarc(fje,
              *qcdb.cfour.backtransform(chgeMol=zmmol, permMol=c4mol, chgeGrad=fjgrd, chgeDip=fjdip))
  
      return fjobarc
function_tokens: def vpt2_reaprun_files ( item , linkage , isSowReap , isC4notP4 , isC4fully , zmat , outdir , scrdir , c4scrdir , lowername , kwargs ) : os . chdir ( outdir ) # current_directory # Extract qcdb.Molecule at findif orientation zmmol = qcdb . cfour . harvest_zmat ( zmat ) # Cfour S/R Direct for gradients if isC4fully : with open ( 'VPT2-' + item + '.fja' , 'r' ) as handle : fjobarc = handle . read ( ) # Cfour for gradients elif isC4notP4 : # S/R: Reap results from output file if isSowReap : isOk , msg , results = reap_job_validate ( outdir , 'VPT2' , item , linkage , [ 'CURRENT ENERGY' , 'CURRENT DIPOLE' , 'CURRENT GRADIENT' , 'CURRENT MOLECULE' ] ) if not isOk : raise ValidationError ( msg ) fje = results [ 'CURRENT ENERGY' ] fjgrd = results [ 'CURRENT GRADIENT' ] fjdip = [ item / constants . dipmom_au2debye for item in results [ 'CURRENT DIPOLE' ] ] c4mol = qcdb . Molecule ( results [ 'CURRENT MOLECULE' ] ) c4mol . update_geometry ( ) # C: Run the job and collect results else : # Prepare Cfour skeleton calc directory os . chdir ( scrdir + c4scrdir ) # psi_scratch/cfour if os . path . exists ( 'scr.' + item ) : shutil . rmtree ( 'scr.' + item ) os . mkdir ( 'scr.' + item ) os . chdir ( 'scr.' + item ) # psi_scratch/cfour/scr.000-004 with open ( 'ZMAT' , 'w' ) as handle : handle . write ( zmat ) shutil . copy2 ( '../harm/GENBAS' , 'GENBAS' ) #os.chdir(scrdir + '/scr.' + item) #run_cfour_module('xja2fja') #with open('FJOBARC', 'r') as handle: #    fjobarc = handle.read() # Run Cfour calc using ZMAT & GENBAS in scratch, outdir redirects to outfile os . chdir ( outdir ) # current_directory core . get_active_molecule ( ) . set_name ( 'blank_molecule_psi4_yo' ) energy ( 'cfour' , path = c4scrdir + '/scr.' + item ) #            os.chdir(scrdir + '/scr.' + item) fje = core . variable ( 'CURRENT ENERGY' ) fjgrd = p4util . mat2arr ( core . get_gradient ( ) ) fjdip = [ core . variable ( 'CURRENT DIPOLE X' ) / constants . dipmom_au2debye , core . variable ( 'CURRENT DIPOLE Y' ) / constants . dipmom_au2debye , core . variable ( 'CURRENT DIPOLE Z' ) / constants . dipmom_au2debye ] c4mol = qcdb . Molecule ( core . get_active_molecule ( ) . create_psi4_string_from_molecule ( ) ) c4mol . update_geometry ( ) # Get map btwn ZMAT and C4 orientation, then use it, grad and dipole to forge FJOBARC file fjobarc = qcdb . cfour . format_fjobarc ( fje , * qcdb . cfour . backtransform ( chgeMol = zmmol , permMol = c4mol ) , gradient = fjgrd , dipole = fjdip ) # Psi4 for gradients else : # Prepare Cfour skeleton calc directory os . chdir ( scrdir + c4scrdir ) # psi_scratch/cfour if os . path . exists ( 'scr.' + item ) : shutil . rmtree ( 'scr.' + item ) os . mkdir ( 'scr.' + item ) os . chdir ( 'scr.' + item ) # psi_scratch/cfour/scr.000-004 with open ( 'ZMAT' , 'w' ) as handle : handle . write ( zmat ) shutil . copy2 ( '../harm/GENBAS' , 'GENBAS' ) # Run Cfour skeleton calc and extract qcdb.Molecule at needed C4 orientation with open ( 'partial.out' , 'w' ) as handle : handle . write ( run_cfour_module ( 'xjoda' ) ) handle . write ( run_cfour_module ( 'xvmol' ) ) handle . write ( run_cfour_module ( 'xvmol2ja' ) ) core . print_out ( '  CFOUR scratch file %s for %s has been read\n' % ( 'JOBARC (binary)' , item ) ) c4mol = qcdb . cfour . jajo2mol ( qcdb . jajo . getrec ( [ 'COORD   ' , 'ATOMCHRG' , 'MAP2ZMAT' , 'IFLAGS  ' ] ) ) # S/R: Reap results from output file if isSowReap : isOk , msg , results = reap_job_validate ( outdir , 'VPT2' , item , linkage , [ 'CURRENT ENERGY' , 'CURRENT DIPOLE' , 'CURRENT GRADIENT' ] ) if not isOk : raise ValidationError ( msg ) fje = results [ 'CURRENT ENERGY' ] fjgrd = results [ 'CURRENT GRADIENT' ] fjdip = [ item / constants . dipmom_au2debye for item in results [ 'CURRENT DIPOLE' ] ] # C: Run the job and collect results else : core . IO . set_default_namespace ( item ) molecule = geometry ( zmmol . create_psi4_string_from_molecule ( ) , 'disp-' + item ) molecule . update_geometry ( ) gradient ( lowername , * * kwargs ) fje = core . variable ( 'CURRENT ENERGY' ) fjgrd = p4util . mat2arr ( core . get_gradient ( ) ) fjdip = [ core . variable ( 'CURRENT DIPOLE X' ) / constants . dipmom_au2debye , core . variable ( 'CURRENT DIPOLE Y' ) / constants . dipmom_au2debye , core . variable ( 'CURRENT DIPOLE Z' ) / constants . dipmom_au2debye ] # Transform results into C4 orientation (defined by c4mol) & forge FJOBARC file fjobarc = qcdb . cfour . format_fjobarc ( fje , * qcdb . cfour . backtransform ( chgeMol = zmmol , permMol = c4mol , chgeGrad = fjgrd , chgeDip = fjdip ) ) return fjobarc