parameters: (name, **kwargs)
return_statement: return ccwfn
docstring: Function encoding sequence of PSI module calls for
      all CC property calculations.
docstring_summary: Function encoding sequence of PSI module calls for
      all CC property calculations.
docstring_tokens: Function encoding sequence of PSI module calls for all CC property calculations .
function: def run_cc_property(name, **kwargs):
      """Function encoding sequence of PSI module calls for
      all CC property calculations.
  
      """
      optstash = p4util.OptionsState(
              ['WFN'],
              ['DERTYPE'],
              ['ONEPDM'],
              ['PROPERTY'],
              ['CCLAMBDA', 'R_CONVERGENCE'],
              ['CCEOM', 'R_CONVERGENCE'],
              ['CCEOM', 'E_CONVERGENCE']) # yapf:disable
  
      oneel_properties = core.OEProp.valid_methods
      twoel_properties = []
      response_properties = ['POLARIZABILITY', 'ROTATION', 'ROA', 'ROA_TENSOR']
      excited_properties = ['OSCILLATOR_STRENGTH', 'ROTATIONAL_STRENGTH']
  
      one = []
      two = []
      response = []
      excited = []
      invalid = []
  
      if 'properties' in kwargs:
          properties = kwargs['properties']
  
          for prop in properties:
  
              prop = prop.upper()
              if prop in oneel_properties:
                  one.append(prop)
              elif prop in twoel_properties:
                  two.append(prop)
              elif prop in response_properties:
                  response.append(prop)
              elif prop in excited_properties:
                  excited.append(prop)
              else:
                  invalid.append(prop)
      else:
          raise ValidationError("""The "properties" keyword is required with the property() function.""")
  
      # People are used to requesting dipole/quadrupole and getting dipole,quadrupole,mulliken_charges and NO_occupations
      if ('DIPOLE' in one) or ('QUADRUPOLE' in one):
          one = list(set(one + ['DIPOLE', 'QUADRUPOLE', 'MULLIKEN_CHARGES', 'NO_OCCUPATIONS']))
  
      n_one = len(one)
      n_two = len(two)
      n_response = len(response)
      n_excited = len(excited)
      n_invalid = len(invalid)
  
      if n_invalid > 0:
          print("""The following properties are not currently supported: %s""" % invalid)
  
      if n_excited > 0 and (name not in ['eom-ccsd', 'eom-cc2']):
          raise ValidationError("""Excited state CC properties require EOM-CC2 or EOM-CCSD.""")
  
      if (name in ['eom-ccsd', 'eom-cc2']) and n_response > 0:
          raise ValidationError("""Cannot (yet) compute response properties for excited states.""")
  
      if 'roa' in response:
          # Perform distributed roa job
          run_roa(name, **kwargs)
          return  # Don't do anything further
  
      if (n_one > 0 or n_two > 0) and (n_response > 0):
          print("""Computing both density- and response-based properties.""")
  
      if name in ['ccsd', 'cc2', 'eom-ccsd', 'eom-cc2']:
          this_name = name.upper().replace('-', '_')
          core.set_global_option('WFN', this_name)
          ccwfn = run_ccenergy(name, **kwargs)
          core.set_global_option('WFN', this_name)
      else:
          raise ValidationError("""CC property name %s not recognized""" % name.upper())
  
      # Need cchbar for everything
      core.cchbar(ccwfn)
  
      # Need ccdensity at this point only for density-based props
      if n_one > 0 or n_two > 0:
          if name == 'eom-ccsd':
              core.set_global_option('WFN', 'EOM_CCSD')
              core.set_global_option('DERTYPE', 'NONE')
              core.set_global_option('ONEPDM', 'TRUE')
              core.cceom(ccwfn)
          elif name == 'eom-cc2':
              core.set_global_option('WFN', 'EOM_CC2')
              core.set_global_option('DERTYPE', 'NONE')
              core.set_global_option('ONEPDM', 'TRUE')
              core.cceom(ccwfn)
          core.set_global_option('DERTYPE', 'NONE')
          core.set_global_option('ONEPDM', 'TRUE')
          core.cclambda(ccwfn)
          core.ccdensity(ccwfn)
  
      # Need ccresponse only for response-type props
      if n_response > 0:
          core.set_global_option('DERTYPE', 'RESPONSE')
          core.cclambda(ccwfn)
          for prop in response:
              core.set_global_option('PROPERTY', prop)
              core.ccresponse(ccwfn)
  
      # Excited-state transition properties
      if n_excited > 0:
          if name == 'eom-ccsd':
              core.set_global_option('WFN', 'EOM_CCSD')
          elif name == 'eom-cc2':
              core.set_global_option('WFN', 'EOM_CC2')
          else:
              raise ValidationError("""Unknown excited-state CC wave function.""")
          core.set_global_option('DERTYPE', 'NONE')
          core.set_global_option('ONEPDM', 'TRUE')
          # Tight convergence unnecessary for transition properties
          core.set_local_option('CCLAMBDA', 'R_CONVERGENCE', 1e-4)
          core.set_local_option('CCEOM', 'R_CONVERGENCE', 1e-4)
          core.set_local_option('CCEOM', 'E_CONVERGENCE', 1e-5)
          core.cceom(ccwfn)
          core.cclambda(ccwfn)
          core.ccdensity(ccwfn)
  
      if n_one > 0:
          # call oe prop for GS density
          oe = core.OEProp(ccwfn)
          oe.set_title(name.upper())
          for oe_name in one:
              oe.add(oe_name.upper())
          oe.compute()
          # call oe prop for each ES density
          if name.startswith('eom'):
              # copy GS CC DIP/QUAD ... to CC ROOT 0 DIP/QUAD ... if we are doing multiple roots
              # retire components at v1.5
              with warnings.catch_warnings():
                  warnings.simplefilter("ignore")
                  if 'dipole' in one:
                      core.set_variable("CC ROOT 0 DIPOLE X", core.variable("CC DIPOLE X"))
                      core.set_variable("CC ROOT 0 DIPOLE Y", core.variable("CC DIPOLE Y"))
                      core.set_variable("CC ROOT 0 DIPOLE Z", core.variable("CC DIPOLE Z"))
                  if 'quadrupole' in one:
                      core.set_variable("CC ROOT 0 QUADRUPOLE XX", core.variable("CC QUADRUPOLE XX"))
                      core.set_variable("CC ROOT 0 QUADRUPOLE XY", core.variable("CC QUADRUPOLE XY"))
                      core.set_variable("CC ROOT 0 QUADRUPOLE XZ", core.variable("CC QUADRUPOLE XZ"))
                      core.set_variable("CC ROOT 0 QUADRUPOLE YY", core.variable("CC QUADRUPOLE YY"))
                      core.set_variable("CC ROOT 0 QUADRUPOLE YZ", core.variable("CC QUADRUPOLE YZ"))
                      core.set_variable("CC ROOT 0 QUADRUPOLE ZZ", core.variable("CC QUADRUPOLE ZZ"))
              if 'dipole' in one:
                  core.set_variable("CC ROOT 0 DIPOLE", core.variable("CC DIPOLE"))
                  # core.set_variable("CC ROOT n DIPOLE", core.variable("CC DIPOLE"))  # P::e CCENERGY
              if 'quadrupole' in one:
                  core.set_variable("CC ROOT 0 QUADRUPOLE", core.variable("CC QUADRUPOLE"))
                  # core.set_variable("CC ROOT n QUADRUPOLE", core.variable("CC QUADRUPOLE"))  # P::e CCENERGY
  
              n_root = sum(core.get_global_option("ROOTS_PER_IRREP"))
              for rn in range(n_root):
                  oe.set_title("CC ROOT {}".format(rn + 1))
                  Da = ccwfn.variable("CC ROOT {} Da".format(rn + 1))
                  oe.set_Da_so(Da)
                  if core.get_global_option("REFERENCE") == "UHF":
                      Db = ccwfn.variable("CC ROOT {} Db".format(rn + 1))
                      oe.set_Db_so(Db)
                  oe.compute()
  
      core.set_global_option('WFN', 'SCF')
      core.revoke_global_option_changed('WFN')
      core.set_global_option('DERTYPE', 'NONE')
      core.revoke_global_option_changed('DERTYPE')
  
      optstash.restore()
      return ccwfn
function_tokens: def run_cc_property ( name , * * kwargs ) : optstash = p4util . OptionsState ( [ 'WFN' ] , [ 'DERTYPE' ] , [ 'ONEPDM' ] , [ 'PROPERTY' ] , [ 'CCLAMBDA' , 'R_CONVERGENCE' ] , [ 'CCEOM' , 'R_CONVERGENCE' ] , [ 'CCEOM' , 'E_CONVERGENCE' ] ) # yapf:disable oneel_properties = core . OEProp . valid_methods twoel_properties = [ ] response_properties = [ 'POLARIZABILITY' , 'ROTATION' , 'ROA' , 'ROA_TENSOR' ] excited_properties = [ 'OSCILLATOR_STRENGTH' , 'ROTATIONAL_STRENGTH' ] one = [ ] two = [ ] response = [ ] excited = [ ] invalid = [ ] if 'properties' in kwargs : properties = kwargs [ 'properties' ] for prop in properties : prop = prop . upper ( ) if prop in oneel_properties : one . append ( prop ) elif prop in twoel_properties : two . append ( prop ) elif prop in response_properties : response . append ( prop ) elif prop in excited_properties : excited . append ( prop ) else : invalid . append ( prop ) else : raise ValidationError ( """The "properties" keyword is required with the property() function.""" ) # People are used to requesting dipole/quadrupole and getting dipole,quadrupole,mulliken_charges and NO_occupations if ( 'DIPOLE' in one ) or ( 'QUADRUPOLE' in one ) : one = list ( set ( one + [ 'DIPOLE' , 'QUADRUPOLE' , 'MULLIKEN_CHARGES' , 'NO_OCCUPATIONS' ] ) ) n_one = len ( one ) n_two = len ( two ) n_response = len ( response ) n_excited = len ( excited ) n_invalid = len ( invalid ) if n_invalid > 0 : print ( """The following properties are not currently supported: %s""" % invalid ) if n_excited > 0 and ( name not in [ 'eom-ccsd' , 'eom-cc2' ] ) : raise ValidationError ( """Excited state CC properties require EOM-CC2 or EOM-CCSD.""" ) if ( name in [ 'eom-ccsd' , 'eom-cc2' ] ) and n_response > 0 : raise ValidationError ( """Cannot (yet) compute response properties for excited states.""" ) if 'roa' in response : # Perform distributed roa job run_roa ( name , * * kwargs ) return # Don't do anything further if ( n_one > 0 or n_two > 0 ) and ( n_response > 0 ) : print ( """Computing both density- and response-based properties.""" ) if name in [ 'ccsd' , 'cc2' , 'eom-ccsd' , 'eom-cc2' ] : this_name = name . upper ( ) . replace ( '-' , '_' ) core . set_global_option ( 'WFN' , this_name ) ccwfn = run_ccenergy ( name , * * kwargs ) core . set_global_option ( 'WFN' , this_name ) else : raise ValidationError ( """CC property name %s not recognized""" % name . upper ( ) ) # Need cchbar for everything core . cchbar ( ccwfn ) # Need ccdensity at this point only for density-based props if n_one > 0 or n_two > 0 : if name == 'eom-ccsd' : core . set_global_option ( 'WFN' , 'EOM_CCSD' ) core . set_global_option ( 'DERTYPE' , 'NONE' ) core . set_global_option ( 'ONEPDM' , 'TRUE' ) core . cceom ( ccwfn ) elif name == 'eom-cc2' : core . set_global_option ( 'WFN' , 'EOM_CC2' ) core . set_global_option ( 'DERTYPE' , 'NONE' ) core . set_global_option ( 'ONEPDM' , 'TRUE' ) core . cceom ( ccwfn ) core . set_global_option ( 'DERTYPE' , 'NONE' ) core . set_global_option ( 'ONEPDM' , 'TRUE' ) core . cclambda ( ccwfn ) core . ccdensity ( ccwfn ) # Need ccresponse only for response-type props if n_response > 0 : core . set_global_option ( 'DERTYPE' , 'RESPONSE' ) core . cclambda ( ccwfn ) for prop in response : core . set_global_option ( 'PROPERTY' , prop ) core . ccresponse ( ccwfn ) # Excited-state transition properties if n_excited > 0 : if name == 'eom-ccsd' : core . set_global_option ( 'WFN' , 'EOM_CCSD' ) elif name == 'eom-cc2' : core . set_global_option ( 'WFN' , 'EOM_CC2' ) else : raise ValidationError ( """Unknown excited-state CC wave function.""" ) core . set_global_option ( 'DERTYPE' , 'NONE' ) core . set_global_option ( 'ONEPDM' , 'TRUE' ) # Tight convergence unnecessary for transition properties core . set_local_option ( 'CCLAMBDA' , 'R_CONVERGENCE' , 1e-4 ) core . set_local_option ( 'CCEOM' , 'R_CONVERGENCE' , 1e-4 ) core . set_local_option ( 'CCEOM' , 'E_CONVERGENCE' , 1e-5 ) core . cceom ( ccwfn ) core . cclambda ( ccwfn ) core . ccdensity ( ccwfn ) if n_one > 0 : # call oe prop for GS density oe = core . OEProp ( ccwfn ) oe . set_title ( name . upper ( ) ) for oe_name in one : oe . add ( oe_name . upper ( ) ) oe . compute ( ) # call oe prop for each ES density if name . startswith ( 'eom' ) : # copy GS CC DIP/QUAD ... to CC ROOT 0 DIP/QUAD ... if we are doing multiple roots # retire components at v1.5 with warnings . catch_warnings ( ) : warnings . simplefilter ( "ignore" ) if 'dipole' in one : core . set_variable ( "CC ROOT 0 DIPOLE X" , core . variable ( "CC DIPOLE X" ) ) core . set_variable ( "CC ROOT 0 DIPOLE Y" , core . variable ( "CC DIPOLE Y" ) ) core . set_variable ( "CC ROOT 0 DIPOLE Z" , core . variable ( "CC DIPOLE Z" ) ) if 'quadrupole' in one : core . set_variable ( "CC ROOT 0 QUADRUPOLE XX" , core . variable ( "CC QUADRUPOLE XX" ) ) core . set_variable ( "CC ROOT 0 QUADRUPOLE XY" , core . variable ( "CC QUADRUPOLE XY" ) ) core . set_variable ( "CC ROOT 0 QUADRUPOLE XZ" , core . variable ( "CC QUADRUPOLE XZ" ) ) core . set_variable ( "CC ROOT 0 QUADRUPOLE YY" , core . variable ( "CC QUADRUPOLE YY" ) ) core . set_variable ( "CC ROOT 0 QUADRUPOLE YZ" , core . variable ( "CC QUADRUPOLE YZ" ) ) core . set_variable ( "CC ROOT 0 QUADRUPOLE ZZ" , core . variable ( "CC QUADRUPOLE ZZ" ) ) if 'dipole' in one : core . set_variable ( "CC ROOT 0 DIPOLE" , core . variable ( "CC DIPOLE" ) ) # core.set_variable("CC ROOT n DIPOLE", core.variable("CC DIPOLE"))  # P::e CCENERGY if 'quadrupole' in one : core . set_variable ( "CC ROOT 0 QUADRUPOLE" , core . variable ( "CC QUADRUPOLE" ) ) # core.set_variable("CC ROOT n QUADRUPOLE", core.variable("CC QUADRUPOLE"))  # P::e CCENERGY n_root = sum ( core . get_global_option ( "ROOTS_PER_IRREP" ) ) for rn in range ( n_root ) : oe . set_title ( "CC ROOT {}" . format ( rn + 1 ) ) Da = ccwfn . variable ( "CC ROOT {} Da" . format ( rn + 1 ) ) oe . set_Da_so ( Da ) if core . get_global_option ( "REFERENCE" ) == "UHF" : Db = ccwfn . variable ( "CC ROOT {} Db" . format ( rn + 1 ) ) oe . set_Db_so ( Db ) oe . compute ( ) core . set_global_option ( 'WFN' , 'SCF' ) core . revoke_global_option_changed ( 'WFN' ) core . set_global_option ( 'DERTYPE' , 'NONE' ) core . revoke_global_option_changed ( 'DERTYPE' ) optstash . restore ( ) return ccwfn