Skip to content

Commit

Permalink
put back the load grid as ft in the menu
Browse files Browse the repository at this point in the history
  • Loading branch information
aoterodelaroza committed Nov 25, 2024
1 parent c6069d0 commit 395f7f5
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 42 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.345
1.2.346
1 change: 0 additions & 1 deletion src/gui/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,6 @@ subroutine show_main_menu()
character(kind=c_char,len=:), allocatable, target :: str1, str2
integer(c_int) :: idum
logical :: launchquit, launch(4)
logical :: system_ok
integer :: isys

logical, save :: ttshown = .false. ! tooltip flag
Expand Down
142 changes: 106 additions & 36 deletions src/gui/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ module subroutine draw_tree(w)
use fieldmod, only: type_grid
use tools_io, only: string, uout
use types, only: realloc
use param, only: bohrtoa, ifformat_as_resample
use param, only: bohrtoa, ifformat_as_resample, ifformat_as_ft_x, ifformat_as_ft_y,&
ifformat_as_ft_z, ifformat_as_ft_xx, ifformat_as_ft_xy, ifformat_as_ft_xz,&
ifformat_as_ft_yy, ifformat_as_ft_yz, ifformat_as_ft_zz, ifformat_as_ft_grad,&
ifformat_as_ft_lap, ifformat_as_ft_pot
use c_interface_module
class(window), intent(inout), target :: w

Expand Down Expand Up @@ -157,7 +160,7 @@ module subroutine draw_tree(w)
call iw_tooltip("Write the current tree to the output console in csv-style (for copying)",ttshown)

! button: plot
if (iw_menuitem("Plot")) &
if (iw_menuitem("Plot Tree Data...")) &
iaux = stack_create_window(wintype_treeplot,.true.,idparent=w%id,orraise=-1)
call iw_tooltip("Plot the tree data",ttshown)
call igSeparator()
Expand Down Expand Up @@ -621,37 +624,104 @@ module subroutine draw_tree(w)

! grid calculation options
if (sys(i)%f(k)%type == type_grid) then
! strpop = "Load gradient grid" // c_null_char
!! iw_menuitem
!! ! if (igMenuItem_Bool(c_loc(strpop),c_null_ptr,.false._c_bool,.true._c_bool)) then
! id = sys(i)%getfieldnum()
! call sys(i)%f(id)%load_as_fftgrid(sys(i)%c,id,"<generated>, gradient of $" // string(k),&
! sys(i)%f(k)%grid,ifformat_as_grad)
! end if
! call iw_tooltip("Load a new grid field as the gradient of this field",ttshown)

! strpop = "Load Laplacian grid" // c_null_char
!! iw_menuitem
!! if (igMenuItem_Bool(c_loc(strpop),c_null_ptr,.false._c_bool,.true._c_bool)) then
! id = sys(i)%getfieldnum()
! call sys(i)%f(id)%load_as_fftgrid(sys(i)%c,id,"<generated>, Laplacian of $" // string(k),&
! sys(i)%f(k)%grid,ifformat_as_lap)
! end if
! call iw_tooltip("Load a new grid field as the Laplacian of this field",ttshown)

! strpop = "Load potential grid" // c_null_char
!! iw_menuitem
!! if (igMenuItem_Bool(c_loc(strpop),c_null_ptr,.false._c_bool,.true._c_bool)) then
! id = sys(i)%getfieldnum()
! call sys(i)%f(id)%load_as_fftgrid(sys(i)%c,id,"<generated>, potential of $" // string(k),&
! sys(i)%f(k)%grid,ifformat_as_pot)
! end if
! call iw_tooltip("Load a new grid field as the potential of this field",ttshown)

strpop = "Load resampled grid" // c_null_char
strpop = "Load Fourier-Transformed Grid" // c_null_char
if (igBeginMenu(c_loc(strpop),.true._c_bool)) then
ldum = iw_menuitem("[First derivatives]",enabled=.false.)
if (iw_menuitem("x")) then
id = sys(i)%getfieldnum()
call sys(i)%f(id)%load_as_fftgrid(sys(i)%c,id,&
"<generated>, x-derivative of $" // string(k),sys(i)%f(k)%grid,ifformat_as_ft_x)
end if
call iw_tooltip("Load a new grid field using FFT as the x-component of &
&this field's gradient",ttshown)
if (iw_menuitem("y")) then
id = sys(i)%getfieldnum()
call sys(i)%f(id)%load_as_fftgrid(sys(i)%c,id,&
"<generated>, y-derivative of $" // string(k),sys(i)%f(k)%grid,ifformat_as_ft_y)
end if
call iw_tooltip("Load a new grid field using FFT as the y-component of &
&this field's gradient",ttshown)
if (iw_menuitem("z")) then
id = sys(i)%getfieldnum()
call sys(i)%f(id)%load_as_fftgrid(sys(i)%c,id,&
"<generated>, z-derivative of $" // string(k),sys(i)%f(k)%grid,ifformat_as_ft_z)
end if
call iw_tooltip("Load a new grid field using FFT as the z-component of &
&this field's gradient",ttshown)
if (iw_menuitem("Gradient Norm")) then
id = sys(i)%getfieldnum()
call sys(i)%f(id)%load_as_fftgrid(sys(i)%c,id,&
"<generated>, grad of $" // string(k),sys(i)%f(k)%grid,ifformat_as_ft_grad)
end if
call iw_tooltip("Load a new grid field using FFT as the norm of &
&this field's gradient",ttshown)
call igSeparator()

ldum = iw_menuitem("[Second derivatives]",enabled=.false.)
if (iw_menuitem("xx")) then
id = sys(i)%getfieldnum()
call sys(i)%f(id)%load_as_fftgrid(sys(i)%c,id,&
"<generated>, xx-derivative of $" // string(k),sys(i)%f(k)%grid,ifformat_as_ft_xx)
end if
call iw_tooltip("Load a new grid field using FFT as the xx component of &
&this field's Hessian matrix",ttshown)
if (iw_menuitem("xy")) then
id = sys(i)%getfieldnum()
call sys(i)%f(id)%load_as_fftgrid(sys(i)%c,id,&
"<generated>, xy-derivative of $" // string(k),sys(i)%f(k)%grid,ifformat_as_ft_xy)
end if
call iw_tooltip("Load a new grid field using FFT as the xy component of &
&this field's Hessian matrix",ttshown)
if (iw_menuitem("xz")) then
id = sys(i)%getfieldnum()
call sys(i)%f(id)%load_as_fftgrid(sys(i)%c,id,&
"<generated>, xz-derivative of $" // string(k),sys(i)%f(k)%grid,ifformat_as_ft_xz)
end if
call iw_tooltip("Load a new grid field using FFT as the xz component of &
&this field's Hessian matrix",ttshown)
if (iw_menuitem("yy")) then
id = sys(i)%getfieldnum()
call sys(i)%f(id)%load_as_fftgrid(sys(i)%c,id,&
"<generated>, yy-derivative of $" // string(k),sys(i)%f(k)%grid,ifformat_as_ft_yy)
end if
call iw_tooltip("Load a new grid field using FFT as the yy component of &
&this field's Hessian matrix",ttshown)
if (iw_menuitem("yz")) then
id = sys(i)%getfieldnum()
call sys(i)%f(id)%load_as_fftgrid(sys(i)%c,id,&
"<generated>, yz-derivative of $" // string(k),sys(i)%f(k)%grid,ifformat_as_ft_yz)
end if
call iw_tooltip("Load a new grid field using FFT as the yz component of &
&this field's Hessian matrix",ttshown)
if (iw_menuitem("zz")) then
id = sys(i)%getfieldnum()
call sys(i)%f(id)%load_as_fftgrid(sys(i)%c,id,"<generated>, zz-derivative of $" // string(k),&
sys(i)%f(k)%grid,ifformat_as_ft_zz)
end if
call iw_tooltip("Load a new grid field using FFT as the zz component of &
&this field's Hessian matrix",ttshown)
if (iw_menuitem("Laplacian")) then
id = sys(i)%getfieldnum()
call sys(i)%f(id)%load_as_fftgrid(sys(i)%c,id,&
"<generated>, lap of $" // string(k),sys(i)%f(k)%grid,ifformat_as_ft_lap)
end if
call iw_tooltip("Load a new grid field using FFT as the Laplacian of this field",ttshown)

call igSeparator()
if (iw_menuitem("Potential")) then
id = sys(i)%getfieldnum()
call sys(i)%f(id)%load_as_fftgrid(sys(i)%c,id,&
"<generated>, potential of $" // string(k),sys(i)%f(k)%grid,ifformat_as_ft_pot)
end if
call iw_tooltip("Load a new grid field using FFT as the potential that generates&
this field (via Poisson's equation)",ttshown)
call igEndMenu()
end if

strpop = "Load Resampled Grid" // c_null_char
if (igBeginMenu(c_loc(strpop),.true._c_bool)) then
flags = ImGuiInputTextFlags_None
strpop2 = "New size##resamplefieldmenunewsize" // c_null_char
strpop2 = "New Size##resamplefieldmenunewsize" // c_null_char
call igSetNextItemWidth(iw_calcwidth(4*3,2))
ldum = igInputInt3(c_loc(strpop2),iresample,flags)

Expand Down Expand Up @@ -946,7 +1016,7 @@ subroutine write_maybe_selectable(isys,tooltipstr)
if (igBeginPopupContextItem(c_loc(strl),ImGuiPopupFlags_MouseButtonRight)) then
! scf energy plot
if (sysc(isys)%collapse /= 0) then
if (iw_menuitem("Plot SCF Iterations",enabled=enabled_no_threads)) then
if (iw_menuitem("Plot SCF Iterations...",enabled=enabled_no_threads)) then
if (sysc(isys)%collapse < 0) then
isyscollapse = isys
else
Expand All @@ -963,7 +1033,7 @@ subroutine write_maybe_selectable(isys,tooltipstr)
strpop = "System" // c_null_char
if (igBeginMenu(c_loc(strpop),.true._c_bool)) then
! Geometry
if (iw_menuitem("View/Edit Geometry",enabled=enabled)) &
if (iw_menuitem("View/Edit Geometry...",enabled=enabled)) &
idgeometry = stack_create_window(wintype_geometry,.true.,isys=isys,orraise=-1)
call iw_tooltip("View and edit the atomic positions, bonds, etc.",ttshown)

Expand All @@ -984,7 +1054,7 @@ subroutine write_maybe_selectable(isys,tooltipstr)
call iw_tooltip("Print a detailed description of this system in the output console",ttshown)

! rebond
if (iw_menuitem("Recalculate Bonds",enabled=enabled_no_threads)) &
if (iw_menuitem("Recalculate Bonds...",enabled=enabled_no_threads)) &
idrebond = stack_create_window(wintype_rebond,.true.,isys=isys,orraise=-1)
call iw_tooltip("Recalculate the covalent bonds in this system and the molecular structures",ttshown)

Expand All @@ -995,7 +1065,7 @@ subroutine write_maybe_selectable(isys,tooltipstr)
strpop = "Fields" // c_null_char
if (igBeginMenu(c_loc(strpop),.true._c_bool)) then
! load field
if (iw_menuitem("Load Field",enabled=enabled)) &
if (iw_menuitem("Load Field...",enabled=enabled)) &
iaux = stack_create_window(wintype_load_field,.true.,isys=isys,orraise=-1)
call iw_tooltip("Load a scalar field for this system",ttshown)

Expand All @@ -1006,7 +1076,7 @@ subroutine write_maybe_selectable(isys,tooltipstr)
strpop = "Vibrations" // c_null_char
if (igBeginMenu(c_loc(strpop),.true._c_bool)) then
! load vibration data
if (iw_menuitem("Load Vibration Data",enabled=enabled)) then
if (iw_menuitem("Load Vibration Data...",enabled=enabled)) then
iaux = stack_create_window(wintype_dialog,.true.,purpose=wpurp_dialog_openvibfile,&
isys=isys,orraise=-1)
end if
Expand Down
8 changes: 4 additions & 4 deletions src/gui/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -2842,7 +2842,7 @@ module subroutine draw_vibrations(w)
class(window), intent(inout), target :: w

logical(c_bool) :: selected
logical :: doquit, system_ok, vib_ok, goodparent, ldum, fset
logical :: doquit, goodsys, vib_ok, goodparent, ldum, fset
integer :: isys, i, digits, iaux
integer(c_int) :: flags
character(kind=c_char,len=:), allocatable, target :: s, str1, str2, strl
Expand Down Expand Up @@ -2892,14 +2892,14 @@ module subroutine draw_vibrations(w)
end if

! vibrations ok?
system_ok = ok_system(isys,sys_init)
vib_ok = system_ok
goodsys = ok_system(isys,sys_init)
vib_ok = goodsys
if (vib_ok) vib_ok = allocated(sys(isys)%c%vib)
if (vib_ok) vib_ok = (sys(isys)%c%vib%nqpt > 0) .and. (sys(isys)%c%vib%nfreq > 0)
if (vib_ok) vib_ok = associated(win(w%idparent)%sc)

! header
if (system_ok) then
if (goodsys) then
! system name
call iw_text("System",highlight=.true.)
call iw_text("(" // string(isys) // ") " // trim(sysc(isys)%seed%name),sameline=.true.)
Expand Down

0 comments on commit 395f7f5

Please sign in to comment.