[gpaw-users] wannier.py : Wannier functions overlap
Ravindra Shinde
neelravi at gmail.com
Wed Aug 14 01:26:55 CEST 2019
Hi all,
@Jens: Thank you for the input.
I wish to calculate that overlap between the Wannier functions using the
function
def calculate_matrix_elements(self, psit1_nG, P1_ani, A, dA, psit2_nG=None,
P2_ani=None)
from the MatrixOperator class.
Following is the function written to compute the overlap.
def wannier_functions_overlap_matrix(self, calc):
""" This function computes the overlap between two wannier
functions on the grid """
centers = self.get_centers()
num_wann = np.shape(centers)[0]
operator = MatrixOperator(calc.wfs.initksl, hermitian=True)
# operator = MatrixOperator(calc.wfs.orthoksl, hermitian=True)
S_unn = np.zeros((num_wann, num_wann), dtype=float) ## Gamma
point only
for kpt in calc.wfs.kpt_u: ## So far only Gamma point
P_ani = kpt.P_ani
for i in range(num_wann):
for j in range(i,num_wann):
psit_nG_i = self.get_function(calc, i, pad=False)
psit_nG_j = self.get_function(calc, j, pad=False)
# Construct the overlap matrix:
S = lambda x: x
dS_aii = dict([(a, calc.wfs.setups[a].dO_ii) for a in
P_ani])
S_unn[i][j] =
calc.operator.calculate_matrix_elements(psit_nG_i, P_ani, S, dS_aii,
psit_nG_j)
np.savetxt("upper_overlap_matrix.txt", (S_unn), fmt='%8.6f',
delimiter=' ', newline='\n', header='Wannier Overlap Matrix Upper
Triangular', comments='# Ravindra :: ', encoding=None)
return
______
However, it gives out the following error:
File "02_benzene_wannier.py", line 31, in <module>
w.wannier_functions_overlap_matrix(calc)
File "/media/data3/ravindra/gpaw/gpaw/wannier.py", line 164, in
wannier_functions_overlap_matrix
operator = MatrixOperator(calc.wfs.initksl, hermitian=True)
File "/media/data3/ravindra/gpaw/gpaw/hs_operators.py", line 77, in
__init__
self.bmd = ksl.new_descriptor() # XXX take hermitian as argument?
File "/media/data3/ravindra/gpaw/gpaw/kohnsham_layouts.py", line 85, in
new_descriptor
return self.matrix_descriptor_class(self.bd, self.gd, self)
TypeError: 'NoneType' object is not callable
____
with the operator = MatrixOperator(calc.wfs.orthoksl, hermitian=True)
option
I get following error:
operator = MatrixOperator(calc.wfs.orthoksl, hermitian=True)
AttributeError: 'FDWaveFunctions' object has no attribute 'orthoksl'
This latter function is used in gpaw/utilities/dscftools.py.
Best regards,
*Ravindra Shinde, Ph.D.*
Department of Chemical and Environmental Engineering
University of California, Riverside
Email: ravindra.shinde at ucr.edu
Phone: +1(951) 466-8168
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/gpaw-users/attachments/20190813/155a1fb6/attachment.html>
More information about the gpaw-users
mailing list