Skip to content

Instantly share code, notes, and snippets.

@gabrielelanaro
Created August 20, 2011 06:48
Show Gist options
  • Select an option

  • Save gabrielelanaro/1158774 to your computer and use it in GitHub Desktop.

Select an option

Save gabrielelanaro/1158774 to your computer and use it in GitHub Desktop.
relevant parts huckel
# This is in aiccm/calculator_huckel.py how I form the huckel fock matrix
def calcF(self):
""" Calculate the fock matrix.
"""
# It's not quite necessary but I calculate overlaps at once
S = self.getS()
d = self.dimension
self.F = F = np.zeros((d, d), 'd')
for (i,j),val in np.ndenumerate(F):
bfng_i = self.BasisListFull[i]
bfng_j = self.BasisListFull[j]
symb_i = self.atoms[bfng_i.atAtom].symbol
symb_j = self.atoms[bfng_j.atAtom].symbol
# Get the ionization potentials from the ase data
# dictionary in eV (like ase commands)
Ii = data[symb_i]['ionization energy']
Ij = data[symb_j]['ionization energy']
if i == j:
F[i,j] = -Ii
else:
F[i,j] = 0.5*K*(-Ii -Ij)*S[i,j]
# This is in aiccm/densities.py, how I calculate the eigenvectors of the huckel's fock matrix and determine the density
def buildHuckelGuess(self):
""" Build the guess using the Extended Huckel Method.
"""
if self.text is not None and self.input_parameters.printlevel > 3:
self.text('Building density matrix guess using Extended Huckel method...')
calculator = ExtendedHuckel(self.basis, self.atoms,
self.text, self.input_parameters)
calculator.calcF()
F = calculator.getF()
S = calculator.getS()
solver = ST(self.text, self.input_parameters)
e, C = solver.solve(F, S)
print "Initial guess"
for c in C:
self.text(c)
self.updateD(C)
return self.Da
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment