Skip to content

Commit

Permalink
Additional review items
Browse files Browse the repository at this point in the history
  • Loading branch information
mcbennet committed Dec 2, 2021
1 parent f39330c commit 35b7207
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
31 changes: 17 additions & 14 deletions nexus/lib/qmcpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@


import os
import numpy as np
from numpy import array,dot,pi
from numpy.linalg import inv,norm
from generic import obj
Expand Down Expand Up @@ -573,21 +574,23 @@ def post_analyze(self,analyzer):
nelec = elns.groups[spin_channel[0]].size
eigs_spin = edata[spin_channel].Energy

orb1_eig = sorted(eigs_spin)[orb1-1]
orb2_eig = sorted(eigs_spin)[orb2-1]

if orb1_eig not in edata[spin_channel]['Energy'][nelec:]:
# Construct the correct set of occupied orbitals by hand based on
# orb1 and orb2 values that were input by the user
excited = eigs_spin
order = eigs_spin.argsort()
ground = excited[order]
# einspline orbital ordering for excited state
excited = excited[:nelec]
# hand-crafted orbital order for excited state
hc_excited = ground[:orb1]+ground[orb2-1]+ground[orb1+1:nelec]

etol = 1e-6
if np.abs(hc_excited-excited).max() > tol:
msg = 'WARNING: You requested \'{}\' excitation of type \'{}\',\n'
msg += ' however, the first orbital \'{}\' is still occupied (see einspline file).\n'
msg += ' however, the second orbital \'{}\' is not occupied (see einspline file).\n'
msg += ' Please check your input.'
msg = msg.format(spin_channel,exc_input[1],orb1)
exc_failure = True
elif orb2_eig not in edata[spin_channel]['Energy'][:nelec]:
msg = 'WARNING: You requested \'{}\' excitation of type \'{}\',\n'
msg += ' however, the first orbital \'{}\' is still occupied (see einspline file).\n'
msg += ' Please check your input.'
msg = msg.format(spin_channel,exc_input[1],orb2)
exc_failure = True
#end if

elif exc1 in ('singlet','triplet'):
Expand Down Expand Up @@ -632,7 +635,8 @@ def post_analyze(self,analyzer):
# Convert band_1, band_2 to band indexes
bands = [band_1, band_2]
for bnum, b in enumerate(bands):
if 'CB' in b:
b = b.lower()
if 'cb' in b:
if '-' in b:
b = b.split('-')
bands[bnum] = cb - int(b[1])
Expand All @@ -642,7 +646,7 @@ def post_analyze(self,analyzer):
else:
bands[bnum] = cb
#end if
elif 'VB' in b:
elif 'vb' in b:
if '-' in b:
b = b.split('-')
bands[bnum] = vb - int(b[1])
Expand Down Expand Up @@ -673,7 +677,6 @@ def post_analyze(self,analyzer):
k_1 = kpath_rel[where(kpath_label == k_1)][0]
k_2 = kpath_rel[where(kpath_label == k_2)][0]

#kpts = nscf.input.k_points.kpoints
kpts = structure.kpoints_unit()
found_k1 = False
found_k2 = False
Expand Down
13 changes: 4 additions & 9 deletions nexus/lib/qmcpack_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -4827,8 +4827,6 @@ def check_excitation_type(excitation):
#end if

return exc_spin,exc_type,exc_spins,exc_types,exc1,exc2


#end def check_excitation_type


Expand Down Expand Up @@ -5042,7 +5040,8 @@ def generate_determinantset_old(type = 'bspline',
# Convert band_1, band_2 to band indexes
bands = [band_1, band_2]
for bnum, b in enumerate(bands):
if 'CB' in b:
b = b.lower()
if 'cb' in b:
if '-' in b:
b = b.split('-')
bands[bnum] = cb - int(b[1])
Expand All @@ -5052,7 +5051,7 @@ def generate_determinantset_old(type = 'bspline',
else:
bands[bnum] = cb
#end if
elif 'VB' in b:
elif 'vb' in b:
if '-' in b:
b = b.split('-')
bands[bnum] = vb - int(b[1])
Expand All @@ -5069,11 +5068,7 @@ def generate_determinantset_old(type = 'bspline',
band_1, band_2 = bands

# Convert k_1 k_2 to wavevector indexes
if system.structure.has_folded():
structure = system.structure.folded_structure.copy()
else:
structure = system.structure.copy()
#end if
structure = system.structure.get_smallest().copy()
structure.change_units('A')
kpath = get_kpath(structure=structure)
kpath_label = array(kpath['explicit_kpoints_labels'])
Expand Down

0 comments on commit 35b7207

Please sign in to comment.