1 /* GamessGuess.c */
2 /**********************************************************************************************************
3 Copyright (c) 2002-2013 Abdul-Rahman Allouche. All rights reserved
4 
5 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6 documentation files (the Gabedit), to deal in the Software without restriction, including without limitation
7 the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
8 and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
9 
10   The above copyright notice and this permission notice shall be included in all copies or substantial portions
11   of the Software.
12 
13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
14 TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
16 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17 DEALINGS IN THE SOFTWARE.
18 ************************************************************************************************************/
19 
20 #include <stdlib.h>
21 #include <ctype.h>
22 #include <math.h>
23 #include <string.h>
24 
25 #include "../../Config.h"
26 #include "../Common/Global.h"
27 #include "../Gamess/GamessTypes.h"
28 #include "../Gamess/GamessGlobal.h"
29 #include "../Utils/Utils.h"
30 #include "../Utils/UtilsInterface.h"
31 #include "../Utils/GabeditTextEdit.h"
32 #include "../Common/Windows.h"
33 #include "../Utils/Constants.h"
34 
35 static GtkWidget *buttonDirectSCF = NULL;
36 static GtkWidget *buttonChangeFock = NULL;
37 static GtkWidget *buttonUHFNO = NULL;
38 static GtkWidget *scfFrame = NULL;
39 /*************************************************************************************************************/
initGamessSCFFrame()40 void initGamessSCFFrame()
41 {
42 	scfFrame = NULL;
43 }
44 /*************************************************************************************************************/
setSensitiveGamessSCFFrame(gboolean sensitive)45 void setSensitiveGamessSCFFrame(gboolean sensitive)
46 {
47 	if(!scfFrame) return;
48 	gtk_widget_set_sensitive(scfFrame, sensitive);
49 }
50 /*************************************************************************************************************/
putGamessSCFOptionsInfoInTextEditor()51 static void putGamessSCFOptionsInfoInTextEditor()
52 {
53 	if(!GTK_TOGGLE_BUTTON (buttonDirectSCF)->active
54 	   && !GTK_TOGGLE_BUTTON (buttonChangeFock)->active
55 	   && !GTK_TOGGLE_BUTTON (buttonUHFNO)->active
56 	   ) return;
57         gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, " ",-1);
58         gabedit_text_insert (GABEDIT_TEXT(text), NULL, &gamessColorFore.keyWord, &gamessColorBack.keyWord, "$SCF",-1);
59 	if(GTK_TOGGLE_BUTTON (buttonDirectSCF)->active)
60         	gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, " DIRSCF=.TRUE.",-1);
61 	if(GTK_TOGGLE_BUTTON (buttonChangeFock)->active)
62         	gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, " FDIFF=.TRUE.",-1);
63 	if(GTK_TOGGLE_BUTTON (buttonUHFNO)->active)
64         	gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, " UHFNOS=.TRUE.",-1);
65 
66         gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, " ",-1);
67         gabedit_text_insert (GABEDIT_TEXT(text), NULL, &gamessColorFore.keyWord, &gamessColorBack.keyWord, "$END\n",-1);
68 }
69 /************************************************************************************************************/
putGamessSCFInfoInTextEditor()70 void putGamessSCFInfoInTextEditor()
71 {
72 	putGamessSCFOptionsInfoInTextEditor();
73 
74 }
75 /************************************************************************************************************/
createGamessSCFFrame(GtkWidget * win,GtkWidget * box)76 void createGamessSCFFrame(GtkWidget *win, GtkWidget *box)
77 {
78 	GtkWidget* frame;
79 	GtkWidget* vboxFrame;
80 	gint l=0;
81 	gint c=0;
82 	gint ncases=1;
83 	GtkWidget *table = gtk_table_new(3,1,FALSE);
84 
85 	buttonDirectSCF = NULL;
86 	buttonChangeFock = NULL;
87 	buttonUHFNO = NULL;
88 
89 	frame = gtk_frame_new (_("SCF options"));
90 	scfFrame = frame;
91 	gtk_widget_show (frame);
92 	gtk_box_pack_start (GTK_BOX (box), frame, TRUE, TRUE, 3);
93 	gtk_frame_set_label_align (GTK_FRAME (frame), 0.5, 0.5);
94 
95 	vboxFrame = gtk_vbox_new (FALSE, 3);
96 	gtk_widget_show (vboxFrame);
97 	gtk_container_add (GTK_CONTAINER (frame), vboxFrame);
98 	gtk_box_pack_start (GTK_BOX (vboxFrame), table, TRUE, TRUE, 0);
99 
100 	/*------------------ DIrectSCF -----------------------------------------*/
101 	l=0;
102 	c = 0; ncases=1;
103 	buttonDirectSCF = gtk_check_button_new_with_label (_("Direct SCF"));
104 	gtk_table_attach(GTK_TABLE(table),buttonDirectSCF,c,c+ncases,l,l+1,
105 		(GtkAttachOptions)	(GTK_FILL | GTK_EXPAND),
106 		(GtkAttachOptions)	(GTK_FILL | GTK_SHRINK),
107                   2,2);
108 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttonDirectSCF), FALSE);
109 	/*------------------ ChangeFock ----------------------------------------*/
110 	l++;
111 	c = 0; ncases=1;
112 	buttonChangeFock = gtk_check_button_new_with_label (_("Compute only change in Fock matrix"));
113 	gtk_table_attach(GTK_TABLE(table),buttonChangeFock,c,c+ncases,l,l+1,
114 		(GtkAttachOptions)	(GTK_FILL | GTK_EXPAND),
115 		(GtkAttachOptions)	(GTK_FILL | GTK_SHRINK),
116                   2,2);
117 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttonChangeFock), FALSE);
118 	/*------------------ UHFNO ----------------------------------------*/
119 	l++;
120 	c = 0; ncases=1;
121 	buttonUHFNO = gtk_check_button_new_with_label (_("Generate UHF Natural Orbitals"));
122 	gtk_table_attach(GTK_TABLE(table),buttonUHFNO,c,c+ncases,l,l+1,
123 		(GtkAttachOptions)	(GTK_FILL | GTK_EXPAND),
124 		(GtkAttachOptions)	(GTK_FILL | GTK_SHRINK),
125                   2,2);
126 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttonUHFNO), FALSE);
127 }
128