Hello @torrent. Thanks so much for your response.
I ended up having to hack the code, although I avoided intervening with atvshift to avoid collateral as best as I could.
Parsing through the source code, I found that macro_uj is only ever subject to constraints if it is a) greater than zero or b) not equal to zero. To acquiesce to these, I encoded another option for macro_uj = 4, which is both greater than zero and not equal to zero and, for all intents and purposes, should trigger all constraints mutually triggered by the other three macro_uj options. Then I added the following lines:
To 44_abitypes_defs/m_dtset.F90
if (dtsets(idtset)%macro_uj>0) then
! Level shift atom with amplitude pawujv
dtsets(idtset)%atvshift(:,:,pawujat)=dtsets(idtset)%pawujv
! Case level shift only on one spin channel
if ((dtsets(idtset)%macro_uj==2.or.dtsets(idtset)%macro_uj==3).and.dtsets(idtset)%nsppol==2) then
dtsets(idtset)%atvshift(:,2,pawujat)=0_dp
end if
!# CHANGE TO CODE LM 2021
if (dtsets(idtset)%macro_uj==4.and.dtsets(idtset)%nsppol==2) then
dtsets(idtset)%atvshift(:,2,pawujat)= -dtsets(idtset)%pawujv
end if
!# END CHANGE LM 2021
end if ! macro_uj
To 65_paw/m_paw_uj.F90
!Calculation of response matrix
do jdtset=1,4
if (nspden==1) then
chih(jdtset,1:nat_org)=dtpawuj(jdtset)%occ(1,:)
else if (macro_uj==1.and.nspden==2) then
chih(jdtset,1:nat_org)=dtpawuj(jdtset)%occ(1,:)+dtpawuj(jdtset)%occ(2,:)
else if (macro_uj==2.and.nspden==2) then
chih(jdtset,1:nat_org)=dtpawuj(jdtset)%occ(1,:)
else if (macro_uj==3.and.nspden==2) then
chih(jdtset,1:nat_org)=dtpawuj(jdtset)%occ(2,:)
!# CHANGE TO CODE LM 2021
else if (macro_uj==4.and.nspden==2) then
chih(jdtset,1:nat_org)=dtpawuj(jdtset)%occ(1,:)+dtpawuj(jdtset)%occ(2,:)
!# END CHANGE LM 2021
end if
vsh(jdtset)=dtpawuj(jdtset)%vsh(1,pawujat)
if (pawprtvol==3) then
write(message,fmt='(2a,i3,a,f15.12)') ch10,' Potential shift vsh(',jdtset,') =',vsh(jdtset)
call wrtout(std_out,message,'COLL')
write(message,fmt='( a,i3,a,120f15.9)') ' Occupations occ(',jdtset,') ',chih(jdtset,1:nat_org)
call wrtout(std_out,message,'COLL')
end if
end do
Selecting macro_uj = 4 now makes atvshift for the second spin channel equal to negative pawujv, keeping atvshift for the first spin channel equal to positive pawujv. From what I could find, there should be no consequences for having a negative atvshift value.
This seemed to do the trick. Are there any other considerations I’ve missed, though? I want to make sure the answers are still physical.
Again, thank you for your response!