Kodomo

Пользователь

Учебная страница курса биоинформатики,
год поступления 2017

Вычисление параметров молекулы водорода

Вам дан файл с фунциями для расчёта основных матриц hfscf.py

Теория (ref 7) : https://chemistlibrary.files.wordpress.com/2015/02/modern-quantum-chemistry.pdf

Более подробная реализация на Python : https://gitlab.com/LLindenbauer/Hartree-Fock-Tutorial/-/blob/master/Hartree-Fock%20Sample.ipynb

Функция расчёта орбиталей на основе подхода Рутана Холла выглядит примерно так:

   1 def SCF (r = 1.4632, Z=[1,1], b1 = GTO["H"], b2 = GTO["H"], b = 3, vbs=False):
   2     R = [0, r]
   3     if vbs: print("*) Generando matriz de traslape S.")
   4     s_scf = S(....
   5     if vbs: print("\n*) Generando hamiltoniano H.")
   6     h_scf = H(....
   7         
   8     # Diagonalizar matriz S y hallar matriz X
   9     if vbs: print("\n*) Diagonalizando matriz S y hallando matriz diagonal X.")
  10     X = diagon(m=s_scf)
  11     Xa = X.getH()
  12     
  13     # Estimar matriz de densidad P
  14     if vbs: print("\n*) Creando matriz de densidad P.")
  15     p_scf = np.matrix([[0,0],[0,0]], dtype=np.float64)  # Referencia (7) p. 148
  16     
  17     # Comenzar proceso iterativo
  18     if vbs: print("\n*) Comenzando con el SCF.")
  19     for iteracion in range(50):
  20         # Construir matriz de Fock F
  21         # F = H + G
  22         if vbs: print("\n**) Generando la matriz de Fock: calculando \
  23 integrales de dos electrones.")
  24         g_scf = G(....
  25         f_scf = h_scf + ....   # Referencia (7) p. 141 eq. (3.154)
  26         
  27         # Construir matriz F'
  28         # F' = X_adj * F * X
  29         if vbs: print("**) Cambiando la base de F.")
  30         f_tra = Xa * f_scf * X
  31         
  32         # Diagonalizar matriz F y constuir matriz C'
  33         if vbs: print("**) Diagonalizando F' y generando C'.")
  34         c_tra = diagon2(m=f_tra)
  35         
  36         # Construir matriz C
  37         # C = X * C'
  38         if vbs: print("**) Construyendo matriz de coeficientes C.")
  39         c_scf = X * c_tra
  40         
  41         # Construir matriz P a partir de matriz C
  42         if vbs: print("**) Recalculando matriz de densidad P.")
  43         p_temp = P(C=c_scf)
  44         
  45         print("\nConcluida la " + str(iteracion + 1) + ". iteracion.\n")
  46         
  47         # Revisar convergencia
  48         if np.linalg.norm(p_temp - p_scf) < 1E-4: # Referencia (7) p. 148
  49             print("\n\n-->El campo autoconsistente SI ha convergido!")
  50             return {"S":s_scf,"H":h_scf,"X": X,"F":f_scf,"C":c_scf,"P":p_temp}
  51         else:
  52             p_scf = p_temp
  53     print("\n\n-->El campo autoconsistente NO ha convergido!\nRevisar supuestos.")
  54     return {"S":s_scf,"H":h_scf,"X": X,"F":f_scf,"C":c_scf,"P":p_temp}

Опишите :

Рссчитайте:

Постройте :