From 35b7207cacb902eb11ff69dfa72ffa36b43086cc Mon Sep 17 00:00:00 2001 From: "M. Chandler Bennett" Date: Thu, 2 Dec 2021 17:41:13 -0500 Subject: [PATCH] Additional review items --- nexus/lib/qmcpack.py | 31 +++++++++++++++++-------------- nexus/lib/qmcpack_input.py | 13 ++++--------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/nexus/lib/qmcpack.py b/nexus/lib/qmcpack.py index 42723583f8..f9885827b2 100644 --- a/nexus/lib/qmcpack.py +++ b/nexus/lib/qmcpack.py @@ -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 @@ -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'): @@ -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]) @@ -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]) @@ -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 diff --git a/nexus/lib/qmcpack_input.py b/nexus/lib/qmcpack_input.py index 3f4249304c..e2711b09f6 100644 --- a/nexus/lib/qmcpack_input.py +++ b/nexus/lib/qmcpack_input.py @@ -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 @@ -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]) @@ -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]) @@ -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'])