Fix lowest SV index finding

Former-commit-id: ac6e4f3539dfa32888497600a8adf603d3587883
This commit is contained in:
Marek Nečada 2019-03-14 01:34:04 +02:00
parent ea0b6fb402
commit 97f87202e1
1 changed files with 3 additions and 3 deletions

View File

@ -45,8 +45,8 @@ for iri in range(ss.nirreps):
mm_iri = ss.modeproblem_matrix_packed(k, iri)
U, S, Vh = np.linalg.svd(mm_iri)
print(iri, ss.irrep_names[iri], S[-1])
starti = np.searchsorted(S, sv_threshold, side='right')
starti = max(0,len(S) - np.searchsorted(S[::-1], sv_threshold, side='left')-1)
np.savez(os.path.join(outputdatadir, 'Nx%d_Ny%d_%geV_ir%d.npz'%(Nx, Ny, omega/eV*hbar, iri)),
S=S[starti:], omega=omega, Vh = Vh[starti:], iri=iri, )
S=S[starti:], omega=omega, Vh = Vh[starti:], iri=iri, Nx = Nx, Ny= Ny )
# Don't forget to conjugate Vh before transforming it to the full vector!