Skip to content

Commit

Permalink
Merge pull request #102 from efposadac/fixEasyIssues
Browse files Browse the repository at this point in the history
Improved the plots and cubes from the output program, adding options …
  • Loading branch information
jacharrym authored Nov 25, 2024
2 parents 7b0b800 + d46fc7d commit c84166f
Show file tree
Hide file tree
Showing 20 changed files with 2,082 additions and 1,901 deletions.
87 changes: 63 additions & 24 deletions bin/lowdin
Original file line number Diff line number Diff line change
Expand Up @@ -177,37 +177,37 @@ if [ $extFile="lowdin" ]; then
'{
printf("\n&InputParticle\n\tInputParticle_name = \"%s\"\n\tInputParticle_basisSetName = \"%s\"\n",toupper($1),toupper($2))
for(i=1;i<=NF;i++){
if($i=="addParticles"){
if(toupper($i)==toupper("addParticles")){
printf("\tInputParticle_addParticles = %s\n",toupper($(i+2)) )
}
else if($i=="multiplicity"){
else if(toupper($i)==toupper("multiplicity")){
printf("\tInputParticle_multiplicity = %s\n",toupper($(i+2)) )
}
else if($i=="fix"){
else if(toupper($i)==toupper("fix")){
printf("\tInputParticle_fixedCoordinates = %s\n",toupper($(i+2)) )
}
else if($i=="fragmentNumber"){
else if(toupper($i)==toupper("fragmentNumber")){
printf("\tInputParticle_fragmentNumber = %s\n",toupper($(i+2)) )
}
else if($i=="translationCenter"){
else if(toupper($i)==toupper("translationCenter")){
printf("\tInputParticle_translationCenter = %s\n",toupper($(i+2)) )
}
else if($i=="rotationPoint"){
else if(toupper($i)==toupper("rotationPoint")){
printf("\tInputParticle_rotationPoint = %s\n",toupper($(i+2)) )
}
else if($i=="rotateAround"){
else if(toupper($i)==toupper("rotateAround")){
printf("\tInputParticle_rotateAround = %s\n",toupper($(i+2)) )
}
else if($i=="q"){
else if(toupper($i)==toupper("q")){
printf("\tInputParticle_charge = %s\n",toupper($(i+2)) )
}
else if($i=="m"){
else if(toupper($i)==toupper("m")){
printf("\tInputParticle_mass = %s\n",toupper($(i+2)) )
}
else if($i=="omega"){
else if(toupper($i)==toupper("omega")){
printf("\tInputParticle_omega = %s\n",toupper($(i+2)) )
}
else if($i=="qdoCenterOf"){
else if(toupper($i)==toupper("qdoCenterOf")){
printf("\tInputParticle_qdoCenterOf = \"%s\"\n",toupper($(i+2)) )
};
};
Expand Down Expand Up @@ -291,28 +291,67 @@ if [ $extFile="lowdin" ]; then
'{
printf("\n&Output\n")
for(i=1;i<=NF;i++){
if($i=="species"){
if(toupper($i)==toupper("species")){
printf("\tOutput_species = %s\n",$toupper((i+2)) )
}
else if($i=="orbital"){
printf("\tOutput_orbital = %s\n",$toupper((i+2)) )
else if(toupper($i)==toupper("plane")){
printf("\tOutput_plane = %s\n",$toupper((i+2)) )
}
else if(toupper($i)==toupper("axis")){
printf("\tOutput_axis = %s\n",$toupper((i+2)) )
}
else if($i=="state"){
else if(toupper($i)==toupper("state")){
printf("\tOutput_state = %s\n",$toupper((i+2)) )
}
else if($i=="dimensions"){
else if(toupper($i)==toupper("orbital")){
printf("\tOutput_orbital = %s\n",$toupper((i+2)) )
}
else if(toupper($i)==toupper("dimensions")){
printf("\tOutput_dimensions = %s\n",$toupper((i+2)) )
}
else if($i=="cubeSize"){
else if(toupper($i)==toupper("pointsPerDim")){
printf("\tOutput_pointsPerDim = %s\n",$toupper((i+2)) )
}
else if(toupper($i)==toupper("scanStep")){
printf("\tOutput_scanStep = %s\n",$toupper((i+2)) )
}
else if(toupper($i)==toupper("cubeSize")){
printf("\tOutput_cubeSize = %s\n",$toupper((i+2)) )
}
else if($i=="point1"){
else if(toupper($i)==toupper("minValue")){
printf("\tOutput_minValue = %s\n",$toupper((i+2)) )
}
else if(toupper($i)==toupper("maxValue")){
printf("\tOutput_maxValue = %s\n",$toupper((i+2)) )
}
else if(toupper($i)==toupper("offsetX")){
printf("\tOutput_offsetX = %s\n",$toupper((i+2)) )
}
else if(toupper($i)==toupper("offsetY")){
printf("\tOutput_offsetY = %s\n",$toupper((i+2)) )
}
else if(toupper($i)==toupper("offsetZ")){
printf("\tOutput_offsetZ = %s\n",$toupper((i+2)) )
}
else if(toupper($i)==toupper("limitX")){
printf("\tOutput_limitX = %15.12E %15.12E \n",$(i+2),$(i+3))
}
else if(toupper($i)==toupper("limitY")){
printf("\tOutput_limitY = %15.12E %15.12E \n",$(i+2),$(i+3))
}
else if(toupper($i)==toupper("limitZ")){
printf("\tOutput_limitZ = %15.12E %15.12E \n",$(i+2),$(i+3))
}
else if(toupper($i)==toupper("center")){
printf("\tOutput_center = %15.12E %15.12E %15.12E \n",$(i+2),$(i+3),$(i+4))
}
else if(toupper($i)==toupper("point1")){
printf("\tOutput_point1 = %15.12E %15.12E %15.12E \n",$(i+2),$(i+3),$(i+4))
}
else if($i=="point2"){
else if(toupper($i)==toupper("point2")){
printf("\tOutput_point2 = %15.12E %15.12E %15.12E \n",$(i+2),$(i+3),$(i+4))
}
else if($i=="point3"){
else if(toupper($i)==toupper("point3")){
printf("\tOutput_point3 = %15.12E %15.12E %15.12E \n",$(i+2),$(i+3),$(i+4))
};
};
Expand All @@ -324,16 +363,16 @@ if [ $extFile="lowdin" ]; then
'{
printf("\n&InputCINamelist\n")
for(i=1;i<=NF;i++){
if($i=="species"){
if(toupper($i)==toupper("species")){
printf("\tInputCI_species = %s\n",$toupper((i+2)) )
}
else if($i=="core"){
else if(toupper($i)==toupper("core")){
printf("\tInputCI_core = %s\n",$toupper((i+2)) )
}
else if($i=="active"){
else if(toupper($i)==toupper("active")){
printf("\tInputCI_active = %s\n",$toupper((i+2)) )
}
else if($i=="excitation"){
else if(toupper($i)==toupper("excitation")){
printf("\tInputCI_excitation = %s\n",$toupper((i+2)) )
};
};
Expand Down
42 changes: 40 additions & 2 deletions src/core/Exception.f90
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ module Exception_
integer, public, parameter :: ERROR = 3

public :: &
Exception_stopError, &
Exception_sendWarning, &
Exception_constructor, &
Exception_destructor, &
Exception_show, &
Expand Down Expand Up @@ -96,7 +98,7 @@ subroutine Exception_destructor( this )

this%description = ""
this%debugDescription = ""

end subroutine Exception_destructor

subroutine Exception_show( this )
Expand Down Expand Up @@ -136,7 +138,7 @@ subroutine Exception_show( this )
write(6,"(A16,ES10.2,A4)") "Elapsed Time : ", lowdin_stopwatch%enlapsetTime ," (s)"
write(6,*) "lowdin execution terminated ABNORMALLY at : ", trim( Stopwatch_getCurretData( lowdin_stopwatch ) )
call Stopwatch_destructor( lowdin_stopwatch )
stop
STOP

end select

Expand All @@ -161,5 +163,41 @@ subroutine Exception_setDescription( this , description )

end subroutine Exception_setDescription

!>
!! @brief A nice way to stop the code in other routines
!<
subroutine Exception_stopError( description, debugDescription)
implicit none
character(*) :: description
character(*) :: debugDescription

type(Exception) :: ex

call Exception_constructor( ex , ERROR )
call Exception_setDebugDescription( ex, debugDescription )
call Exception_setDescription( ex, description )
call Exception_show( ex )
call Exception_destructor( ex )

end subroutine Exception_stopError


!>
!! @brief A nice way to send warnings in other routines
!<
subroutine Exception_sendWarning( description, debugDescription)
implicit none
character(*) :: description
character(*) :: debugDescription

type(Exception) :: ex

call Exception_constructor( ex , WARNING )
call Exception_setDebugDescription( ex, debugDescription )
call Exception_setDescription( ex, description )
call Exception_show( ex )
call Exception_destructor( ex )

end subroutine Exception_sendWarning

end module Exception_
137 changes: 135 additions & 2 deletions src/core/MolecularSystem.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1662,6 +1662,74 @@ subroutine MolecularSystem_changeOrbitalOrder( coefficientsOfCombination, specie
labelsOfContractions = MolecularSystem_getlabelsofcontractions(speciesID)

if( (actualFormat.eq."LOWDIN" .and. desiredFormat.eq."MOLDEN") ) then
!! Swap some columns according to the molden format
do k=1,numberOfContractions
!! Take the shellcode
read (labelsOfContractions(k), "(I5,A1,A6,A1,A6)") counter, space, nickname, space, shellcode

!! Reorder the D functions
!! counter: 0, 1, 2, 3, 4, 5
!! Lowdin: XX, XY, XZ, YY, YZ, ZZ
!! Molden: XX, YY, ZZ, XY, XZ, YZ
!! 1-1, 2-4, 3-5, 4-2, 5-6, 6-3
!! 2-4, 3-5, 5-6

if ( adjustl(shellcode) == "Dxx" ) then
auxcounter = counter
!! Swap XY and YY
call Matrix_swapRows( coefficientsOfCombination, auxcounter+1 , auxcounter+3)
!! Swap XZ and ZZ
call Matrix_swapRows( coefficientsOfCombination, auxcounter+2 , auxcounter+5)
!! Swap YZ and XZ'
call Matrix_swapRows( coefficientsOfCombination, auxcounter+4 , auxcounter+5)
end if

!! Reorder the F functions
!! counter: 0, 1, 2, 3, 4, 5, 6, 7, 8 9
!! Lowdin: XXX, XXY, XXZ, XYY, XYZ, XZZ, YYY, YYZ, YZZ, ZZZ
!! Molden: XXX, YYY, ZZZ, XYY, XXY, XXZ, XZZ, YZZ, YYZ, XYZ

if ( adjustl(shellcode) == "Fxxx" ) then
auxcounter = counter
call Matrix_swapRows( coefficientsOfCombination, auxcounter+1 , auxcounter+6)
call Matrix_swapRows( coefficientsOfCombination, auxcounter+2 , auxcounter+9)
call Matrix_swapRows( coefficientsOfCombination, auxcounter+4 , auxcounter+6)
call Matrix_swapRows( coefficientsOfCombination, auxcounter+5 , auxcounter+9)
call Matrix_swapRows( coefficientsOfCombination, auxcounter+6 , auxcounter+9)
call Matrix_swapRows( coefficientsOfCombination, auxcounter+7 , auxcounter+8)

end if

!! Reorder the G functions
!! counter: 0, 1, 2, 3, 4, 5, 6, 7, 8 9, 10, 11, 12, 13, 14
!! Lowdin: XXXX,XXXY,XXXZ,XXYY,XXYZ,XXZZ,XYYY,XYYZ,XYZZ,XZZZ,YYYY,YYYZ,YYZZ,YZZZ,ZZZZ
!!Molden15G:xxxx yyyy zzzz xxxy xxxz yyyx yyyz zzzx zzzy xxyy xxzz yyzz xxyz yyxz zzxy
if ( adjustl(shellcode) == "Gxxxx" ) then
auxcounter = counter
! call Matrix_swapRows( coefficientsOfCombination, auxcounter+0 , auxcounter+0)
call Matrix_swapRows( coefficientsOfCombination, auxcounter+1 , auxcounter+10) !XXXY->10
call Matrix_swapRows( coefficientsOfCombination, auxcounter+2 , auxcounter+14) !XXXZ->14
call Matrix_swapRows( coefficientsOfCombination, auxcounter+3 , auxcounter+10) !XXYY->10
call Matrix_swapRows( coefficientsOfCombination, auxcounter+4 , auxcounter+14) !XXYZ->14
call Matrix_swapRows( coefficientsOfCombination, auxcounter+5 , auxcounter+6) !XXZZ->6
call Matrix_swapRows( coefficientsOfCombination, auxcounter+6 , auxcounter+11) !XXZZ->11
call Matrix_swapRows( coefficientsOfCombination, auxcounter+7 , auxcounter+9) !XYYZ->9
call Matrix_swapRows( coefficientsOfCombination, auxcounter+8 , auxcounter+13) !XYZZ->13
call Matrix_swapRows( coefficientsOfCombination, auxcounter+9 , auxcounter+10) !XYYZ->10
call Matrix_swapRows( coefficientsOfCombination, auxcounter+10, auxcounter+11) !XYYZ->11
call Matrix_swapRows( coefficientsOfCombination, auxcounter+11, auxcounter+12) !XYYZ->12
call Matrix_swapRows( coefficientsOfCombination, auxcounter+12, auxcounter+14) !XYYZ->14
call Matrix_swapRows( coefficientsOfCombination, auxcounter+13, auxcounter+14) !XYZZ->14
! call Matrix_swapRows( coefficientsOfCombination, auxcounter+14, auxcounter+14)
end if

if ( adjustl(shellcode) == "Hxxxxx" ) then
call MolecularSystem_exception(WARNING, "The order of the coefficients only works until G orbitals", "MolecularSystem_changeOrbitalOrder" )
end if

end do

else if( (actualFormat.eq."LOWDIN" .and. desiredFormat.eq."FCHK") ) then
!! Swap some columns according to the molden format
do k=1,numberOfContractions
!! Take the shellcode
Expand Down Expand Up @@ -1775,6 +1843,71 @@ subroutine MolecularSystem_changeOrbitalOrder( coefficientsOfCombination, specie
end do

else if( actualFormat.eq."MOLDEN" .and. desiredFormat.eq."LOWDIN") then
!! Swap some columns according to the molden format
do k=1,numberOfContractions
!! Take the shellcode
read (labelsOfContractions(k), "(I5,A1,A6,A1,A6)") counter, space, nickname, space, shellcode

!! Reorder the D functions
!! counter: 1, 2, 3, 4, 5, 6
!! Molden: XX, YY, ZZ, XY, XZ, YZ
!! Lowdin: XX, XY, XZ, YY, ZZ, YZ
!! 1-1, 2-4, 3-5, 4-2, 5-6, 6-3
!! 2-4, 3-5, 5-6

if ( adjustl(shellcode) == "Dxx" ) then
auxcounter = counter
!! Swap YY and XY
call Matrix_swapRows( coefficientsOfCombination, auxcounter+1 , auxcounter+3)
!! Swap ZZ and XZ
call Matrix_swapRows( coefficientsOfCombination, auxcounter+2 , auxcounter+4)
!! Swap ZZ and YZ'
call Matrix_swapRows( coefficientsOfCombination, auxcounter+4 , auxcounter+5)
end if

!! Reorder the F functions
!! counter: 1, 2, 3, 4, 5, 6, 7, 8 9, 10
!! Molden: XXX, YYY, ZZZ, XYY, XXY, XXZ, XZZ, YZZ, YYZ, XYZ
!! Lowdin: XXX, XXY, XXZ, XYY, XYZ, XZZ, YYY, YYZ, YZZ, ZZZ

if ( adjustl(shellcode) == "Fxxx" ) then
auxcounter = counter
call Matrix_swapRows( coefficientsOfCombination, auxcounter+1 , auxcounter+4)
call Matrix_swapRows( coefficientsOfCombination, auxcounter+2 , auxcounter+5)
call Matrix_swapRows( coefficientsOfCombination, auxcounter+4 , auxcounter+9)
call Matrix_swapRows( coefficientsOfCombination, auxcounter+5 , auxcounter+6)
call Matrix_swapRows( coefficientsOfCombination, auxcounter+6 , auxcounter+9)
call Matrix_swapRows( coefficientsOfCombination, auxcounter+7 , auxcounter+8)
end if
!! Reorder the G functions
!! counter: 0, 1, 2, 3, 4, 5, 6, 7, 8 9, 10, 11, 12, 13, 14
!!Molden15G:xxxx yyyy zzzz xxxy xxxz yyyx yyyz zzzx zzzy xxyy xxzz yyzz xxyz yyxz zzxy
!! Lowdin: XXXX,XXXY,XXXZ,XXYY,XXYZ,XXZZ,XYYY,XYYZ,XYZZ,XZZZ,YYYY,YYYZ,YYZZ,YZZZ,ZZZZ
if ( adjustl(shellcode) == "Gxxxx" ) then
auxcounter = counter
call Matrix_swapRows( coefficientsOfCombination, auxcounter+1 , auxcounter+3) !YYYY->3
call Matrix_swapRows( coefficientsOfCombination, auxcounter+2 , auxcounter+4) !ZZZZ->4
call Matrix_swapRows( coefficientsOfCombination, auxcounter+3 , auxcounter+9) !YYYY->9
call Matrix_swapRows( coefficientsOfCombination, auxcounter+4 , auxcounter+12)!ZZZZ->12
call Matrix_swapRows( coefficientsOfCombination, auxcounter+5 , auxcounter+10)!YYYX-10
call Matrix_swapRows( coefficientsOfCombination, auxcounter+6 , auxcounter+10)!YYYZ-10
call Matrix_swapRows( coefficientsOfCombination, auxcounter+7 , auxcounter+13)!ZZZX-13
call Matrix_swapRows( coefficientsOfCombination, auxcounter+8 , auxcounter+14)!ZZZY-14
call Matrix_swapRows( coefficientsOfCombination, auxcounter+9 , auxcounter+13)!YYYY-13
call Matrix_swapRows( coefficientsOfCombination, auxcounter+10, auxcounter+13)!YYYZ-13
call Matrix_swapRows( coefficientsOfCombination, auxcounter+11, auxcounter+13)!YYZZ-13
call Matrix_swapRows( coefficientsOfCombination, auxcounter+12, auxcounter+13)!ZZZZ-13
call Matrix_swapRows( coefficientsOfCombination, auxcounter+13, auxcounter+14)!ZZZZ-14
end if

if ( adjustl(shellcode) == "Hxxxxx" ) then
call MolecularSystem_exception(WARNING, "The order of the coefficients only works until G orbitals", "MolecularSystem_changeOrbitalOrder" )
end if


end do

else if( actualFormat.eq."FCHK" .and. desiredFormat.eq."LOWDIN") then
!! Swap some columns according to the molden format
do k=1,numberOfContractions
!! Take the shellcode
Expand Down Expand Up @@ -1833,7 +1966,7 @@ subroutine MolecularSystem_changeOrbitalOrder( coefficientsOfCombination, specie


end do

else

call MolecularSystem_exception(ERROR, "The desired format change from "//actualFormat//" to "//desiredFormat//"has not been implemented","MolecularSystem module at changeOrbitalOrder function.")
Expand Down Expand Up @@ -1946,7 +2079,7 @@ subroutine MolecularSystem_readFchk( fileName, coefficients, densityMatrix, name
end if
end do

call MolecularSystem_changeOrbitalOrder( coefficients, speciesID, "MOLDEN", "LOWDIN" )
call MolecularSystem_changeOrbitalOrder( coefficients, speciesID, "FCHK", "LOWDIN" )
! print *, "coefficients read"
! call Matrix_show(coefficients)

Expand Down
Loading

0 comments on commit c84166f

Please sign in to comment.