Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
properties_and_expectation_values [2025/07/18 11:06] – [Derivatives with respect to fields (dipole, quadrupole, second and third moments)] dollproperties_and_expectation_values [2025/09/10 06:37] (current) – add example for pop , spin doll
Line 1: Line 1:
- 
- 
 ====== Properties and expectation values ====== ====== Properties and expectation values ======
  
Line 271: Line 269:
 ci;dm,9000.2; ci;dm,9000.2;
 pop;density,9000.2 pop;density,9000.2
 +</code>
 +
 +In the following example, the population for charge and spin is computed:
 +
 +<code - examples/li_pop.inp>
 +geometry={li}
 +basis=vdz
 +hf
 +pop;
 +pop;density,type=spin
 </code> </code>
  
Line 408: Line 416:
 ===== Derivatives with respect to fields (dipole, quadrupole, second and third moments) ===== ===== Derivatives with respect to fields (dipole, quadrupole, second and third moments) =====
  
-Derivaties with respect to fields can be computed with the keywords ''FGRAD'' (1st derivative) and ''FPOL'' (2nd derivative). The fields may be dipole (''DM''), quadrupole (''QM''), second (''SM'') and third (''TM'') moments, and for DM, SM, QM also their individual components (e.g. ''DMX'', ''XZ'', ''QMXY'').+Derivatives with respect to fields can be computed with the keywords ''FGRAD'' (1st derivative) and ''FPOL'' (2nd derivative). The fields may be dipole (''DM''), quadrupole (''QM''), second (''SM'') and third (''TM'') moments, and also their individual components (e.g. ''DMX'', ''XZ'', ''QMXY'', ''XXX'').
  
-By default a two-point formula is used for first derivatives (keyword ''CENTRAL''). Alternatively, forward-difference formula ''FORWARD'' (fastbut inaccurate) or a fourpoint formula may be used ''FOURPOINT'' For second derivatives, two-point and four-point formulas are implemented, which require 2*2 or 4*4 calculations. If available, analytical first gradients may be used with the keyword use_grad so that only the second derivative is done numerically. The default step size is 0.001 a.u. and may be change with the option ''STRENGTH''+Second derivatives include minus signe.g. $$-\frac{\partial^2 E}{\partial d_i \partial d_j}$$ where $d_i$ are the components of the dipole field.
  
-The origin may be varied with ''ORIGIN'' 
  
-The quadrupole tensor is traceless which is exploited by default. It may be switched off with ''ZERO_TRACE_UNUSED''+The syntax for the first or second derivative with respect to a dipole field is like this: 
 + 
 +''FGRAD,OPER=DM,PROC=myproc'' 
 +or 
 +''FPOL,OPER=DM,PROC=myproc'' 
 + 
 +where ''myproc'' has to be defined. 
 + 
 +By default a two-point formula is used for first derivatives (keyword ''CENTRAL''). Alternatively, a forward-difference formula ''FORWARD'' (fast, but inaccurate) or a fourpoint formula may be used ''FOURPOINT''
 + 
 +For second derivatives, central (1 central point + 2 more points for the diagonal part, 2*2 points for the off-diagonal part) and four-point formulas (central point + 4 more points for the diagonal part, 4*4 points for the off-diagonal part) are implemented. If available, analytical first gradients may be used with the keyword ''use_grad'' so that only the second derivative is done numerically. This may require the ''expec'' keyword to compute the analytical first derivative. 
 + 
 +The default step size is 0.001 a.u. and may be changed with the option ''STRENGTH''.  
 + 
 +The quadrupole tensor is traceless which is exploited by default in the case of first derivatives. It may be switched off with ''ZERO_TRACE_UNUSED''
  
 The energy calculation has to be done with a ''PROCEDURE'' (alternatively, ''STARTCMD'' may also be used).  The energy calculation has to be done with a ''PROCEDURE'' (alternatively, ''STARTCMD'' may also be used). 
  
  
 +==== Examples ====
 +
 +This example shows how dipole, quadrupole and third moments can be obtained by computing derivatives with respect to the corresponding fields, and the dipole polarizability.
 +
 +<code - examples/h2o2_fgrad_fpol.inp>
 +geometry={4
 +H2O2
 +O1      0.0000   0.7375  -0.0528
 +O2      0.0000  -0.7375  -0.0528
 +H3      0.8190   0.8170   0.4220
 +H4     -0.8190  -0.8170   0.4220
 +}
 +
 +basis=def2-svp
 +{hf}
 +{mp2;expec,dm,qm,tm}
 +
 +fgrad,dm,proc=myproc
 +fgrad,qm,proc=myproc
 +fgrad,tm,proc=myproc
 +fpol,dm,proc=myproc
 +
 +proc myproc
 +{hf}
 +{mp2}
 +endproc
 +
 +
 +
 +</code>
 +
 +This example shows how ''use_grad'' may be used:
 +
 +
 +<code - examples/h2o_fpol_dm_use_grad_ccsd.inp>
 +geometry={   3
 +H2O
 +O          0.0000000000        0.0000000000       -0.0573384885
 +H          0.7581330543        0.0000000000        0.5338192442
 +H         -0.7581330543        0.0000000000        0.5338192442
 +}
 +
 +basis=def2-svp
 +{hf}
 +
 +!use first analytial derivative
 +fpol,dm,proc=myproc,use_grad
 +
 +proc myproc
 +{hf}
 +{ccsd
 +expec,dm}
 +endproc
 +
 +
 +!compare with twofold numerical derivative
 +fpol,dm,proc=myproc
 +</code>