1 /* PsicodeKeywords.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 "../Psicode/PsicodeTypes.h"
28 #include "../Psicode/PsicodeGlobal.h"
29 #include "../Psicode/PsicodeMolecule.h"
30 #include "../Psicode/PsicodeBasis.h"
31 #include "../Psicode/PsicodeGuess.h"
32 #include "../Utils/Utils.h"
33 #include "../Utils/UtilsInterface.h"
34 #include "../Utils/GabeditTextEdit.h"
35 #include "../Common/Windows.h"
36 #include "../Utils/Constants.h"
37 
38 static GtkWidget* comboSCF = NULL;
39 static GtkWidget* comboMethod = NULL;
40 static GtkWidget* comboTypeMethod = NULL;
41 static GtkWidget* comboExcited = NULL;
42 static void setPsicodeMethods();
43 /*************************************************************************************************************/
44 static gchar* listJobView[] = {
45         "Single Point Energy",
46 	"Equilibrium structure search",
47 	"Frequencies",
48 	"Equilibrium structure search + Frequencies",
49 };
50 static gchar* listJobReal[] = {
51         "SP",
52 	"optimize",
53         "freq",
54         "opt&freq",
55 };
56 static guint numberOfJobs = G_N_ELEMENTS (listJobView);
57 static gchar selectedJob[BSIZE]="SP";
58 /*************************************************************************************************************/
59 static gchar* listSCFView[] = { "default","unrestricted", "restricted"};
60 static gchar* listSCFReal[] = { "DEF", "TRUE", "FALSE"};
61 static guint numberOfSCF = G_N_ELEMENTS (listSCFView);
62 static gchar selectedSCF[BSIZE]="DEF";
63 /*************************************************************************************************************/
64 static gchar* listTypeMethodsView[] =
65 {
66 	"Hatree-Fock",
67 	"Local and gradient corrected functionals",
68 	"Hybrid functionals",
69 	"Meta-GGA and hybrid meta-GGA's",
70 	"X_LRC",
71 	"Second Order Many Body Perturbation Theory",
72 	"High-level Single Reference Methods",
73 	/*"Semiempirical Methods",*/
74 };
75 static gchar* listTypeMethodsReal[] =
76 {
77 	"SCF",
78 	"DFT",
79 	"Hybrid",
80 	"Meta-GGA",
81 	"X_LRC",
82 	"MP2",
83 	"HL-SR",
84 	/* "SemiEmp",*/
85 };
86 static guint numberOfTypeMethods = G_N_ELEMENTS (listTypeMethodsView);
87 static gchar selectedTypeMethod[BSIZE]="SCF";
88 /*************************************************************************************************************/
89 static gchar* listHFMethodsView[] =
90 {
91 	"HF",
92 };
93 static gchar* listHFMethodsReal[] =
94 {
95 	"SCF",
96 };
97 static guint numberOfHFMethods = G_N_ELEMENTS (listHFMethodsView);
98 /*************************************************************************************************************/
99 static gchar* listHFDFTMethodsView[] =
100 {
101 	"HFexch",
102 };
103 static gchar* listHFDFTMethodsReal[] =
104 {
105 	"XC HFexch",
106 };
107 static guint numberOfHFDFTMethods = G_N_ELEMENTS (listHFDFTMethodsView);
108 /*************************************************************************************************************/
109 static gchar* listDFTMethodsView[] =
110 {
111 	"B3_X",
112 	"B88_X",
113 	"B97-D",
114 	"BLYP",
115 	"BLYP-D",
116 	"BP86",
117 	"FT97",
118 	"FT97B_X",
119 	"FT97_C",
120 	"HCTH",
121 	"HCTH120",
122 	"HCTH147",
123 	"HCTH407",
124 	"LYP_C",
125 	"P86_C",
126 	"PBE",
127 	"PBE-D",
128 	"PBESOL_X",
129 	"PBE_C",
130 	"PBE_X",
131 	"PW91",
132 	"PW91_C",
133 	"PW91_X",
134 	"PW92_C",
135 	"PZ81_C",
136 	"SVWN",
137 	"S_X",
138 	"VWN3RPA_C",
139 	"VWN3_C",
140 	"VWN5RPA_C",
141 	"VWN5_C",
142 };
143 static gchar* listDFTMethodsReal[] =
144 {
145 	"B3_X",
146 	"B88_X",
147 	"B97-D",
148 	"BLYP",
149 	"BLYP-D",
150 	"BP86",
151 	"FT97",
152 	"FT97B_X",
153 	"FT97_C",
154 	"HCTH",
155 	"HCTH120",
156 	"HCTH147",
157 	"HCTH407",
158 	"LYP_C",
159 	"P86_C",
160 	"PBE",
161 	"PBE-D",
162 	"PBESOL_X",
163 	"PBE_C",
164 	"PBE_X",
165 	"PW91",
166 	"PW91_C",
167 	"PW91_X",
168 	"PW92_C",
169 	"PZ81_C",
170 	"SVWN",
171 	"S_X",
172 	"VWN3RPA_C",
173 	"VWN3_C",
174 	"VWN5RPA_C",
175 	"VWN5_C",
176 };
177 static guint numberOfDFTMethods = G_N_ELEMENTS (listDFTMethodsView);
178 /*************************************************************************************************************/
179 static gchar* listHybridMethodsView[] =
180 {
181 	"B3LYP",
182 	"B3LYP-D",
183 	"B3LYP5",
184 	"B3LYP5-D",
185 	"B97-0",
186 	"B97-1",
187 	"B97-2",
188 	"PBE0",
189 	"wB97X Parameterized Hybrid LRC B97 GGA XC Functional",
190 	"wB97X-D",
191 	"wPBE0 SR-XC Functional (HJS Model)",
192 	"wPBE0sol0",
193 };
194 static gchar* listHybridMethodsReal[] =
195 {
196 	"B3LYP",
197 	"B3LYP-D",
198 	"B3LYP5 ",
199 	"B3LYP5-D",
200 	"B97-0",
201 	"B97-1",
202 	"B97-2",
203 	"PBE0",
204 	"wB97X",
205 	"wB97X-D",
206 	"wPBE0",
207 	"wPBE0sol0",
208 };
209 static guint numberOfHybridMethods = G_N_ELEMENTS (listHybridMethodsView);
210 /*************************************************************************************************************/
211 static gchar* listMetaGGAMethodsView[] =
212 {
213 	"m05",
214 	"m05-2X",
215 };
216 static gchar* listMetaGGAMethodsReal[] =
217 {
218 	"m05",
219 	"m05-2X",
220 };
221 static guint numberOfMetaGGAMethods = G_N_ELEMENTS (listMetaGGAMethodsView);
222 /*************************************************************************************************************/
223 static gchar* listXLRCMethodsView[] =
224 {
225 	"wB88_X",
226 	"wB97",
227 	"wB97X",
228 	"wB97X-D",
229 	"wBLYP",
230 	"wPBE",
231 	"wPBE0",
232 	"wPBE_X",
233 	"wPBEsol",
234 	"wPBEsol0",
235 	"wPBEsol_X",
236 	"wSVWN",
237 	"wS_X",
238 };
239 static gchar* listXLRCMethodsReal[] =
240 {
241 	"wB88_X",
242 	"wB97",
243 	"wB97X",
244 	"wB97X-D",
245 	"wBLYP",
246 	"wPBE",
247 	"wPBE0",
248 	"wPBE_X",
249 	"wPBEsol",
250 	"wPBEsol0",
251 	"wPBEsol_X",
252 	"wSVWN",
253 	"wS_X",
254 };
255 static guint numberOfXLRCMethods = G_N_ELEMENTS (listXLRCMethodsView);
256 /*************************************************************************************************************/
257 static gchar* listMP2MethodsView[] =
258 {
259 	"MP2",
260 	"DF-MP2",
261 };
262 static gchar* listMP2MethodsReal[] =
263 {
264 	"MP2",
265 	"DF-MP2",
266 };
267 static guint numberOfMP2Methods = G_N_ELEMENTS (listMP2MethodsView);
268 /*************************************************************************************************************/
269 static gchar* listHighLevelSingleRefMethodsView[] =
270 {
271 	"CC2",
272 	"CCD",
273 	"CCSD",
274 	"CC3",
275 	"CCD(T)",
276 	"CCSD(T) ",
277 };
278 static gchar* listHighLevelSingleRefMethodsReal[] =
279 {
280 	"CC2",
281 	"CCD",
282 	"CCSD",
283 	"CC3",
284 	"CCD(T)",
285 	"CCSD(T) ",
286 };
287 static guint numberOfHighLevelSingleRefMethods = G_N_ELEMENTS (listHighLevelSingleRefMethodsView);
288 /*************************************************************************************************************/
289 static gchar* listSemiEmpMethodsView[] =
290 {
291 	"ZINDO/S",
292 	"ZINDO/1",
293 	"ZINDO/2",
294 	"NDDO/1",
295 	"NDDO/2",
296 	"MNDO",
297 	"AM1",
298 	"PM3",
299 };
300 static gchar* listSemiEmpMethodsReal[] =
301 {
302 	"ZINDO/S",
303 	"ZINDO/1",
304 	"ZINDO/2",
305 	"NDDO/1",
306 	"NDDO/2",
307 	"MNDO",
308 	"AM1",
309 	"PM3",
310 };
311 static guint numberOfSemiEmpMethods = G_N_ELEMENTS (listSemiEmpMethodsView);
312 /*************************************************************************************************************/
313 static gchar selectedMethod[BSIZE]="HF";
314 static gchar** listMethodsView = listHybridMethodsView;
315 static gchar** listMethodsReal = listHybridMethodsReal;
316 static guint numberOfMethods = G_N_ELEMENTS (listHybridMethodsView);
317 /*************************************************************************************************************/
318 static gchar* listScfConvergenceView[] = {
319 	"Default",
320 	"Energy convergence = 10^-6 au",
321 	"Energy convergence = 10^-7 au",
322 	"Energy convergence = 10^-8 au",
323 	"Energy convergence = 10^-9 au",
324 	"Energy convergence = 10^-10 au"
325 };
326 static gchar* listScfConvergenceReal[] = {
327 	"NONE",
328 	"6",
329 	"7",
330 	"8",
331 	"9",
332 	"10"
333 
334 };
335 static guint numberOfScfConvergence = G_N_ELEMENTS (listScfConvergenceView);
336 static gchar selectedScfConvergence[BSIZE]="NONE";
337 /*************************************************************************************************************/
338 static gchar* listNothingExcitedView[] =
339 {
340 	"Nothing",
341 };
342 static gchar* listNothingExcitedReal[] =
343 {
344 	"NONE",
345 };
346 static guint numberOfNothingExcited = G_N_ELEMENTS (listNothingExcitedView);
347 /*************************************************************************************************************/
348 static gchar* listSemiEmpExcitedView[] =
349 {
350 	"Nothing",
351 	"CIS",
352 };
353 static gchar* listSemiEmpExcitedReal[] =
354 {
355 	"NONE",
356 	"CIS",
357 };
358 static guint numberOfSemiEmpExcited = G_N_ELEMENTS (listSemiEmpExcitedView);
359 /*************************************************************************************************************/
360 static gchar* listHFExcitedView[] =
361 {
362 	"Nothing",
363 	"CIS",
364 	"CIS(D)",
365 };
366 static gchar* listHFExcitedReal[] =
367 {
368 	"NONE",
369 	"CIS",
370 	"CIS(D)",
371 };
372 static guint numberOfHFExcited = G_N_ELEMENTS (listHFExcitedView);
373 /*************************************************************************************************************/
374 static gchar* listDFTExcitedView[] =
375 {
376 	"Nothing",
377 	"CIS",
378 	"TDDFT",
379 };
380 static gchar* listDFTExcitedReal[] =
381 {
382 	"NONE",
383 	"CIS",
384 	"TDDFT",
385 };
386 static guint numberOfDFTExcited = G_N_ELEMENTS (listDFTExcitedView);
387 /*************************************************************************************************************/
388 static gchar* listHLExcitedView[] =
389 {
390 	"Nothing",
391 	"EOM",
392 };
393 static gchar* listHLExcitedReal[] =
394 {
395 	"NONE",
396 	"EOM",
397 };
398 static guint numberOfHLExcited = G_N_ELEMENTS (listHLExcitedView);
399 /*************************************************************************************************************/
400 static gchar selectedExcited[BSIZE]="NONE";
401 static gchar** listExcitedView = listNothingExcitedView;
402 static gchar** listExcitedReal = listNothingExcitedReal;
403 static guint numberOfExcited = G_N_ELEMENTS (listNothingExcitedView);
404 /*************************************************************************************************************/
getPsicodeExcitedMethod()405 gchar* getPsicodeExcitedMethod()
406 {
407 	return selectedExcited;
408 }
409 /*************************************************************************************************************/
getPsicodeTypeMethod()410 gchar* getPsicodeTypeMethod()
411 {
412 	return selectedTypeMethod;
413 }
414 /*************************************************************************************************************/
putPsicodeExcitedInfoInTextEditor()415 static void putPsicodeExcitedInfoInTextEditor()
416 {
417 	gchar buffer[BSIZE];
418 	if(!strcmp(selectedExcited,"NONE"))return;
419 	if(!strcmp(selectedExcited,"EOM"))return;
420  	gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, "\n",-1);
421       	gabedit_text_insert (GABEDIT_TEXT(text), NULL, &psicodeColorFore.keyWord, &psicodeColorBack.keyWord, "tddft\n", -1);
422 
423 	if(strstr(selectedExcited,"CIS")) sprintf(buffer," cis\n");
424 	else sprintf(buffer," rpa\n");
425  	gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1);
426 
427 	sprintf(buffer," nroots %d # the number of excited states to be calculated.\n",8);
428        	gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1);
429 	sprintf(buffer,
430 			"# nosinglet\n"
431 			"# notriplet\n"
432 			"# maxvecs 1000 # it is the maximum number of trial vectors that the calculation is allowed to hold\n"
433 			"# thresh 1e-4\n"
434 			"# maxiter 100\n"
435 			"# freeze atomic # To exclude the atom-like core regions\n"
436 			"# freeze 10     #  the number of lowest-lying occupied orbitals be excluded\n"
437 			"# freeze virtual 5      # to freeze the top 5 virtual orbitals\n"
438 			);
439        	gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1);
440 
441 	sprintf(buffer,"end #tddft\n");
442        	gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1);
443 }
444 /*************************************************************************************************************/
setPsicodeExcited()445 static void setPsicodeExcited()
446 {
447 	GtkTreeIter iter;
448 	GtkTreeIter iter0;
449 	gint i;
450 
451 	if(strcmp(selectedTypeMethod,"HF")==0)
452 	{
453 		listExcitedView = listHFExcitedView;
454 		listExcitedReal = listHFExcitedReal;
455 		numberOfExcited = numberOfHFExcited;
456 	}
457 	else
458 	if(strcmp(selectedTypeMethod,"HFexch")==0)
459 	{
460 		listExcitedView = listDFTExcitedView;
461 		listExcitedReal = listDFTExcitedReal;
462 		numberOfExcited = numberOfDFTExcited;
463 	}
464 	else
465 	if(strcmp(selectedTypeMethod,"DFT")==0)
466 	{
467 		listExcitedView = listDFTExcitedView;
468 		listExcitedReal = listDFTExcitedReal;
469 		numberOfExcited = numberOfDFTExcited;
470 	}
471 	else
472 	if(strcmp(selectedTypeMethod,"Hybrid")==0)
473 	{
474 		listExcitedView = listDFTExcitedView;
475 		listExcitedReal = listDFTExcitedReal;
476 		numberOfExcited = numberOfDFTExcited;
477 	}
478 	else
479 	if(strcmp(selectedTypeMethod,"Meta-GGA")==0)
480 	{
481 		listExcitedView = listDFTExcitedView;
482 		listExcitedReal = listDFTExcitedReal;
483 		numberOfExcited = numberOfDFTExcited;
484 	}
485 	else
486 	if(strcmp(selectedTypeMethod,"HL-SR")==0 && (!strcmp(selectedMethod,"CC2") || !strcmp(selectedMethod,"CCSD") ))
487 	{
488 		listExcitedView = listHLExcitedView;
489 		listExcitedReal = listHLExcitedReal;
490 		numberOfExcited = numberOfHLExcited;
491 	}
492 	else
493 	if(strcmp(selectedTypeMethod,"SemiEmp")==0 && strstr(selectedMethod,"/S"))
494 	{
495 		listExcitedView = listSemiEmpExcitedView;
496 		listExcitedReal = listSemiEmpExcitedReal;
497 		numberOfExcited = numberOfSemiEmpExcited;
498 	}
499 	else
500 	{
501 		listExcitedView = listNothingExcitedView;
502 		listExcitedReal = listNothingExcitedReal;
503 		numberOfExcited = numberOfNothingExcited;
504 	}
505 
506 	if (comboExcited && gtk_combo_box_get_active_iter (GTK_COMBO_BOX(comboExcited), &iter))
507 	{
508 		GtkTreeModel* model = gtk_combo_box_get_model(GTK_COMBO_BOX(comboExcited));
509         	GtkTreeStore *store = GTK_TREE_STORE(model);
510 		gtk_tree_store_clear(store);
511 
512 		for(i=0;i<numberOfExcited;i++)
513 		{
514         		gtk_tree_store_append (store, &iter, NULL);
515 			if(i==0) iter0 = iter;
516         		gtk_tree_store_set (store, &iter, 0, listExcitedView[i], -1);
517 		}
518 		gtk_combo_box_set_active_iter(GTK_COMBO_BOX (comboExcited), &iter0);
519 	}
520 
521 }
522 /************************************************************************************************************/
traitementExcited(GtkComboBox * combobox,gpointer d)523 static void traitementExcited (GtkComboBox *combobox, gpointer d)
524 {
525 	GtkTreeIter iter;
526 	gchar* data = NULL;
527 	gchar* res = NULL;
528 	gint i;
529 
530 	if (gtk_combo_box_get_active_iter (combobox, &iter))
531 	{
532 		GtkTreeModel* model = gtk_combo_box_get_model(combobox);
533 		gtk_tree_model_get (model, &iter, 0, &data, -1);
534 	}
535 	else return;
536 	for(i=0;i<numberOfExcited;i++)
537 	{
538 		if(strcmp((gchar*)data,listExcitedView[i])==0) res = listExcitedReal[i];
539 	}
540 	if(res) sprintf(selectedExcited,"%s",res);
541 	/*
542 {
543 	gboolean ri = FALSE;
544 	GtkWidget* wid;
545 	ri = !strcmp(selectedExcited,"CIS(D)");
546 	wid  = g_object_get_data(G_OBJECT (combobox), "LabelAuxBasis1");
547 	if(wid) gtk_widget_set_sensitive(wid, ri);
548 	wid  = g_object_get_data(G_OBJECT (combobox), "LabelAuxBasis2");
549 	if(wid) gtk_widget_set_sensitive(wid, ri);
550 	wid  = g_object_get_data(G_OBJECT (combobox), "ComboAuxBasis");
551 	if(wid) gtk_widget_set_sensitive(wid, ri);
552 }
553 	*/
554 }
555 /********************************************************************************************************/
create_list_excited()556 static GtkWidget *create_list_excited()
557 {
558         GtkTreeIter iter;
559         GtkTreeStore *store;
560 	GtkTreeModel *model;
561 	GtkWidget *combobox;
562 	GtkCellRenderer *renderer;
563 	gint i;
564         GtkTreeIter iter0;
565 
566 	store = gtk_tree_store_new (1,G_TYPE_STRING);
567 
568 
569 	for(i=0;i<numberOfExcited;i++)
570 	{
571         	gtk_tree_store_append (store, &iter, NULL);
572 		if(i==0) iter0 = iter;
573         	gtk_tree_store_set (store, &iter, 0, listExcitedView[i], -1);
574 	}
575 
576         model = GTK_TREE_MODEL (store);
577 	combobox = gtk_combo_box_new_with_model (model);
578 	/*
579 	gtk_combo_box_set_add_tearoffs (GTK_COMBO_BOX (combobox), TRUE);
580 	*/
581 	g_object_unref (model);
582 	g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(traitementExcited), NULL);
583 	renderer = gtk_cell_renderer_text_new ();
584 	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, TRUE);
585 	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer, "text", 0, NULL);
586 
587 	gtk_combo_box_set_active_iter(GTK_COMBO_BOX (combobox), &iter0);
588 
589 	return combobox;
590 }
traitementScfConvergence(GtkComboBox * combobox,gpointer d)591 static void traitementScfConvergence (GtkComboBox *combobox, gpointer d)
592 {
593 	GtkTreeIter iter;
594 	gchar* data = NULL;
595 	gchar* res = NULL;
596 	gint i;
597 
598 
599 	/* gchar* s;*/
600 	if (gtk_combo_box_get_active_iter (combobox, &iter))
601 	{
602 		GtkTreeModel* model = gtk_combo_box_get_model(combobox);
603 		gtk_tree_model_get (model, &iter, 0, &data, -1);
604 	}
605 	for(i=0;i<numberOfScfConvergence;i++)
606 	{
607 		if(strcmp((gchar*)data,listScfConvergenceView[i])==0) res = listScfConvergenceReal[i];
608 	}
609 	if(res) sprintf(selectedScfConvergence,"%s",res);
610 	else  sprintf(selectedScfConvergence,"Default");
611 
612 }
613 /********************************************************************************************************/
create_list_scfconvergence()614 static GtkWidget *create_list_scfconvergence()
615 {
616         GtkTreeIter iter;
617         GtkTreeStore *store;
618 	GtkTreeModel *model;
619 	GtkWidget *combobox;
620 	GtkCellRenderer *renderer;
621 	gint i;
622         GtkTreeIter iter0;
623 
624 	store = gtk_tree_store_new (1,G_TYPE_STRING);
625 
626 	for(i=0;i<numberOfScfConvergence;i++)
627 	{
628         	gtk_tree_store_append (store, &iter, NULL);
629 		if(i==0) iter0 = iter;
630         	gtk_tree_store_set (store, &iter, 0, listScfConvergenceView[i], -1);
631 	}
632 
633         model = GTK_TREE_MODEL (store);
634 	combobox = gtk_combo_box_new_with_model (model);
635 	/*
636 	gtk_combo_box_set_add_tearoffs (GTK_COMBO_BOX (combobox), TRUE);
637 	*/
638 	g_object_unref (model);
639 	g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(traitementScfConvergence), NULL);
640 	renderer = gtk_cell_renderer_text_new ();
641 	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, TRUE);
642 	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer, "text", 0, NULL);
643 
644 	gtk_combo_box_set_active_iter(GTK_COMBO_BOX (combobox), &iter0);
645 
646 	return combobox;
647 }
648 /************************************************************************************************************/
addPsicodeScfConvergenceToTable(GtkWidget * table,gint i)649 GtkWidget* addPsicodeScfConvergenceToTable(GtkWidget *table, gint i)
650 {
651 	GtkWidget* comboScfConvergence = NULL;
652 
653 
654 	add_label_table(table,_("SCF convergence"),(gushort)i,0);
655 	add_label_table(table,":",(gushort)i,1);
656 	comboScfConvergence  = create_list_scfconvergence();
657 
658 	return comboScfConvergence;
659 }
660 /*************************************************************************************************************/
calculWord(gchar * view)661 static gchar* calculWord(gchar* view)
662 {
663 	gint i;
664 	for(i=0;i<numberOfJobs;i++)
665 	{
666 		if(strcmp(view,listJobView[i])==0)return listJobReal[i];
667 	}
668 	return NULL;
669 }
670 /************************************************************************************************************/
671 /*
672 static void getMultiplicityName(gint multiplicity, gchar* buffer)
673 {
674 	if(multiplicity==1) sprintf(buffer,"Singlet");
675 	else if(multiplicity==2) sprintf(buffer,"Doublet");
676 	else if(multiplicity==3) sprintf(buffer,"Triplet");
677 	else if(multiplicity==4) sprintf(buffer,"Quartet");
678 	else if(multiplicity==5) sprintf(buffer,"Quintet");
679 	else if(multiplicity==6) sprintf(buffer,"Sextet");
680 	else if(multiplicity==7) sprintf(buffer,"Septet");
681 	else if(multiplicity==8) sprintf(buffer,"Octet");
682 	else sprintf(buffer,"NOpen %d",multiplicity/2);
683 }
684 */
685 /*************************************************************************************************************/
putPsicodeSCFKeywordsInfoInTextEditor()686 static void putPsicodeSCFKeywordsInfoInTextEditor()
687 {
688 	if( !strcmp(selectedTypeMethod,"DFT") || !strcmp(selectedTypeMethod,"HFexch")|| !strcmp(selectedTypeMethod,"Hybrid") || !strcmp(selectedTypeMethod,"Meta-GGA") || !strcmp(selectedTypeMethod,"X-LRC"))
689 	{
690 		gchar buffer[BSIZE];
691 		sprintf(buffer,"set dft_functional ");
692        		gabedit_text_insert (GABEDIT_TEXT(text), NULL, &psicodeColorFore.keyWord, &psicodeColorBack.keyWord, buffer, -1);
693 		if(strcmp(selectedScfConvergence,"NONE")!=0)
694 		{
695 			sprintf(buffer,"set scf e_convergence=%s\n",selectedScfConvergence);
696         		gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1);
697 		}
698 		sprintf(buffer," %s\n",selectedMethod);
699        		gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer, -1);
700 	}
701 	else
702 	{
703 		gchar buffer[BSIZE];
704 		if(strcmp(selectedScfConvergence,"NONE")!=0)
705 		{
706 			sprintf(buffer,"set scf e_convergence=%s\n",selectedScfConvergence);
707         		gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1);
708 		}
709 	}
710 
711 	if(strcmp(selectedSCF,"DEF") || getPsicodeMultiplicity()!=1)
712 	{
713 		if( getPsicodeMultiplicity()!=1)
714 			gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, "set scf reference uhf\n",-1);
715 		else
716 		{
717 			if(!strcmp(selectedSCF,"TRUE")) gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, "set scf reference uhf\n",-1);
718 			else gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, "set scf reference rhf\n",-1);
719 		}
720 
721 	}
722 	else if(strstr(selectedMethod,"MP2") && getPsicodeMultiplicity()!=1)
723 	{
724 		gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, " uhf\n",-1);
725 	}
726 }
727 /*************************************************************************************************************/
putPsicodeMP2KeywordsInfoInTextEditor()728 static void putPsicodeMP2KeywordsInfoInTextEditor()
729 {
730 	if(strstr(selectedMethod,"MP2"))
731 	{
732 		if(strstr(selectedMethod,"DF"))
733         		gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, "set scf_type df\n",-1);
734         	gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, "set freeze_core True\n",-1);
735 	}
736 }
737 /*************************************************************************************************************/
putPsicodeMethodInfoInTextEditor()738 static void putPsicodeMethodInfoInTextEditor()
739 {
740 	gchar buffer[BSIZE];
741 	gchar sMethod[BSIZE];
742 	sprintf(sMethod,"SCF");
743         if(strcmp(selectedMethod,"SCF"))
744 	{
745         	if(strstr(selectedMethod,"MP2")) sprintf(sMethod,"%s",selectedMethod);
746         	else if(strstr(selectedTypeMethod,"HL-SR")) sprintf(sMethod,"%s",selectedMethod);
747         	else if(strstr(selectedExcited,"CIS") || strstr(selectedExcited,"TDDFT")) sprintf(sMethod,"%s","TDDFT");
748 		else sprintf(sMethod,"SCF");
749 	}
750 	if(!strcmp(selectedJob,"SP") && !strstr(selectedExcited,"EOM") )
751 	{
752 	sprintf(buffer,"energy(\"%s\")\n",sMethod);
753        	gabedit_text_insert (GABEDIT_TEXT(text), NULL, &psicodeColorFore.keyWord, &psicodeColorBack.keyWord, buffer, -1);
754 	}
755 	else
756 	{
757 		gchar buffer[BSIZE];
758 		if(strstr(selectedJob,"opt&freq"))
759 		{
760 
761 			sprintf(buffer,"optimize(\"%s\")\n",sMethod);
762        			gabedit_text_insert (GABEDIT_TEXT(text), NULL, &psicodeColorFore.keyWord, &psicodeColorBack.keyWord, buffer, -1);
763 			sprintf(buffer,"frequencies(\"%s\")\n",sMethod);
764        			gabedit_text_insert (GABEDIT_TEXT(text), NULL, &psicodeColorFore.keyWord, &psicodeColorBack.keyWord, buffer, -1);
765 		}
766 		else if(strstr(selectedJob,"saddle&freq"))
767 		{
768 
769 			sprintf(buffer," %s","saddle");
770        			gabedit_text_insert (GABEDIT_TEXT(text), NULL, &psicodeColorFore.keyWord, &psicodeColorBack.keyWord, buffer, -1);
771 
772 			sprintf(buffer,"\ntask %s ",sMethod);
773        			gabedit_text_insert (GABEDIT_TEXT(text), NULL, &psicodeColorFore.keyWord, &psicodeColorBack.keyWord, buffer, -1);
774 
775 			sprintf(buffer,"frequencies(\"%s\")\n",sMethod);
776        			gabedit_text_insert (GABEDIT_TEXT(text), NULL, &psicodeColorFore.keyWord, &psicodeColorBack.keyWord, buffer, -1);
777 		}
778 		else if(strstr(selectedJob,"optimiz"))
779 		{
780 			sprintf(buffer,"optimize(\"%s\")\n",sMethod);
781        			gabedit_text_insert (GABEDIT_TEXT(text), NULL, &psicodeColorFore.keyWord, &psicodeColorBack.keyWord, buffer, -1);
782 		}
783 		else if(strstr(selectedJob,"freq"))
784 		{
785 
786 			sprintf(buffer,"frequencies(\"%s\")\n",sMethod);
787        			gabedit_text_insert (GABEDIT_TEXT(text), NULL, &psicodeColorFore.keyWord, &psicodeColorBack.keyWord, buffer, -1);
788 		}
789 		else if(!strstr(selectedTypeMethod,"HL-SR"))
790 		{
791 			sprintf(buffer," %s ",selectedJob);
792        			gabedit_text_insert (GABEDIT_TEXT(text), NULL, &psicodeColorFore.keyWord, &psicodeColorBack.keyWord, buffer, -1);
793 		}
794 	}
795 }
796 /*************************************************************************************************************/
putPsicodeHLKeywordsInfoInTextEditor()797 static void putPsicodeHLKeywordsInfoInTextEditor()
798 {
799 	if(!strcmp(selectedTypeMethod,"HL-SR"))
800 	{
801 		gchar buffer[BSIZE];
802 		if(strstr(selectedExcited,"EOM"))
803 		{
804 			sprintf(buffer,"set roots_per_irrep [2]\n");
805  			gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1);
806 			sprintf(buffer,"property('eom-%s', properties=['oscillator_strength'])\n",selectedMethod);
807  			gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1);
808 		}
809 	}
810 }
811 /*************************************************************************************************************/
putPsicodeKeywordsInfoInTextEditor()812 void putPsicodeKeywordsInfoInTextEditor()
813 {
814 	putPsicodeGuessInfoInTextEditor();
815 	if(!strstr(selectedTypeMethod,"SemiEmp")) putPsicodeBasisInfoInTextEditor();
816 	if(strstr(selectedMethod,"RI")) putPsicodeAuxBasisInTextEditor();
817 	if(!strcmp(selectedExcited,"CIS(D)")) putPsicodeAuxBasisInTextEditor();
818 	putPsicodeSCFKeywordsInfoInTextEditor();
819 	putPsicodeMP2KeywordsInfoInTextEditor();
820 	putPsicodeMethodInfoInTextEditor();
821 	putPsicodeHLKeywordsInfoInTextEditor();
822 	putPsicodeExcitedInfoInTextEditor();
823 
824         gabedit_text_insert (GABEDIT_TEXT(text), NULL, &psicodeColorFore.keyWord, &psicodeColorBack.keyWord, "\n",-1);
825 }
826 /************************************************************************************************************/
traitementJobType(GtkComboBox * combobox,gpointer d)827 static void traitementJobType (GtkComboBox *combobox, gpointer d)
828 {
829 	GtkTreeIter iter;
830 	gchar* data = NULL;
831 	gchar* res = NULL;
832 
833 	if (gtk_combo_box_get_active_iter (combobox, &iter))
834 	{
835 		GtkTreeModel* model = gtk_combo_box_get_model(combobox);
836 		gtk_tree_model_get (model, &iter, 0, &data, -1);
837 	}
838 	else return;
839 	res = calculWord(data);
840 	if(res) sprintf(selectedJob,"%s",res);
841 	else  sprintf(selectedJob,"SP");
842 
843 }
844 /********************************************************************************************************/
create_list_jobtype()845 static GtkWidget *create_list_jobtype()
846 {
847         GtkTreeIter iter;
848         GtkTreeStore *store;
849 	GtkTreeModel *model;
850 	GtkWidget *combobox;
851 	GtkCellRenderer *renderer;
852 	gint i;
853         GtkTreeIter iter0;
854 
855 	store = gtk_tree_store_new (1,G_TYPE_STRING);
856 
857 	for(i=0;i<numberOfJobs;i++)
858 	{
859         	gtk_tree_store_append (store, &iter, NULL);
860 		if(i==0) iter0 = iter;
861         	gtk_tree_store_set (store, &iter, 0, listJobView[i], -1);
862 	}
863 
864         model = GTK_TREE_MODEL (store);
865 	combobox = gtk_combo_box_new_with_model (model);
866 	/*
867 	gtk_combo_box_set_add_tearoffs (GTK_COMBO_BOX (combobox), TRUE);
868 	*/
869 	g_object_unref (model);
870 	g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(traitementJobType), NULL);
871 	renderer = gtk_cell_renderer_text_new ();
872 	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, TRUE);
873 	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer, "text", 0, NULL);
874 
875 	gtk_combo_box_set_active_iter(GTK_COMBO_BOX (combobox), &iter0);
876 
877 	return combobox;
878 }
879 /************************************************************************************************************/
setPsicodeSCFMethod(gboolean okRHF)880 void setPsicodeSCFMethod(gboolean okRHF)
881 {
882 	GtkTreeIter iter;
883 	GtkTreeIter iter0;
884 	gint i;
885 	/* gchar* s;*/
886 	if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX(comboSCF), &iter))
887 	{
888 		GtkTreeModel* model = gtk_combo_box_get_model(GTK_COMBO_BOX(comboSCF));
889         	GtkTreeStore *store = GTK_TREE_STORE(model);
890 		gint k = 0;
891 		gtk_tree_store_clear(store);
892 		for(i=0;i<numberOfSCF;i++)
893 		{
894 			if(!okRHF)
895 			if(strcmp(listSCFView[i],"restricted")==0)continue;
896         		gtk_tree_store_append (store, &iter, NULL);
897 			if(k==0) iter0 = iter;
898 			k++;
899         		gtk_tree_store_set (store, &iter, 0, listSCFView[i], -1);
900 		}
901 		gtk_combo_box_set_active_iter(GTK_COMBO_BOX (comboSCF), &iter0);
902 	}
903 }
904 /************************************************************************************************************/
traitementSCF(GtkComboBox * combobox,gpointer d)905 static void traitementSCF (GtkComboBox *combobox, gpointer d)
906 {
907 	GtkTreeIter iter;
908 	gchar* data = NULL;
909 	gchar* res = NULL;
910 	gint i;
911 	/* gchar* s;*/
912 	if (gtk_combo_box_get_active_iter (combobox, &iter))
913 	{
914 		GtkTreeModel* model = gtk_combo_box_get_model(combobox);
915 		gtk_tree_model_get (model, &iter, 0, &data, -1);
916 	}
917 	else return;
918 	for(i=0;i<numberOfSCF;i++)
919 	{
920 		if(strcmp((gchar*)data,listSCFView[i])==0) res = listSCFReal[i];
921 	}
922 	if(res) sprintf(selectedSCF,"%s",res);
923 	else  sprintf(selectedSCF,"DEF");
924 
925 }
926 /********************************************************************************************************/
create_list_scf()927 static GtkWidget *create_list_scf()
928 {
929         GtkTreeIter iter;
930         GtkTreeStore *store;
931 	GtkTreeModel *model;
932 	GtkWidget *combobox;
933 	GtkCellRenderer *renderer;
934 	gint i;
935         GtkTreeIter iter0;
936 
937 	store = gtk_tree_store_new (1,G_TYPE_STRING);
938 
939 	for(i=0;i<numberOfSCF;i++)
940 	{
941         	gtk_tree_store_append (store, &iter, NULL);
942 		if(i==0) iter0 = iter;
943         	gtk_tree_store_set (store, &iter, 0, listSCFView[i], -1);
944 	}
945 
946         model = GTK_TREE_MODEL (store);
947 	combobox = gtk_combo_box_new_with_model (model);
948 	/*
949 	gtk_combo_box_set_add_tearoffs (GTK_COMBO_BOX (combobox), TRUE);
950 	*/
951 	g_object_unref (model);
952 	g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(traitementSCF), NULL);
953 	renderer = gtk_cell_renderer_text_new ();
954 	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, TRUE);
955 	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer, "text", 0, NULL);
956 
957 	gtk_combo_box_set_active_iter(GTK_COMBO_BOX (combobox), &iter0);
958 
959 	return combobox;
960 }
961 /************************************************************************************************************/
setPsicodeMethods()962 static void setPsicodeMethods()
963 {
964 	GtkTreeIter iter;
965 	GtkTreeIter iter0;
966 	gint i;
967 
968 	if(strcmp(selectedTypeMethod,"HF")==0)
969 	{
970 		listMethodsView = listHFMethodsView;
971 		listMethodsReal = listHFMethodsReal;
972 		numberOfMethods = numberOfHFMethods;
973 	}
974 	else
975 	if(strcmp(selectedTypeMethod,"HFexch")==0)
976 	{
977 		listMethodsView = listHFDFTMethodsView;
978 		listMethodsReal = listHFDFTMethodsReal;
979 		numberOfMethods = numberOfHFDFTMethods;
980 	}
981 	else
982 	if(strcmp(selectedTypeMethod,"DFT")==0)
983 	{
984 		listMethodsView = listDFTMethodsView;
985 		listMethodsReal = listDFTMethodsReal;
986 		numberOfMethods = numberOfDFTMethods;
987 	}
988 	else
989 	if(strcmp(selectedTypeMethod,"Hybrid")==0)
990 	{
991 		listMethodsView = listHybridMethodsView;
992 		listMethodsReal = listHybridMethodsReal;
993 		numberOfMethods = numberOfHybridMethods;
994 	}
995 	else
996 	if(strcmp(selectedTypeMethod,"Meta-GGA")==0)
997 	{
998 		listMethodsView = listMetaGGAMethodsView;
999 		listMethodsReal = listMetaGGAMethodsReal;
1000 		numberOfMethods = numberOfMetaGGAMethods;
1001 	}
1002 	else
1003 	if(strcmp(selectedTypeMethod,"X-LRC")==0)
1004 	{
1005 		listMethodsView = listXLRCMethodsView;
1006 		listMethodsReal = listXLRCMethodsReal;
1007 		numberOfMethods = numberOfXLRCMethods;
1008 	}
1009 	else
1010 	if(strcmp(selectedTypeMethod,"MP2")==0)
1011 	{
1012 		listMethodsView = listMP2MethodsView;
1013 		listMethodsReal = listMP2MethodsReal;
1014 		numberOfMethods = numberOfMP2Methods;
1015 	}
1016 	else
1017 	if(strcmp(selectedTypeMethod,"HL-SR")==0)
1018 	{
1019 		listMethodsView = listHighLevelSingleRefMethodsView;
1020 		listMethodsReal = listHighLevelSingleRefMethodsReal;
1021 		numberOfMethods = numberOfHighLevelSingleRefMethods;
1022 	}
1023 	else
1024 	if(strcmp(selectedTypeMethod,"SemiEmp")==0)
1025 	{
1026 		listMethodsView = listSemiEmpMethodsView;
1027 		listMethodsReal = listSemiEmpMethodsReal;
1028 		numberOfMethods = numberOfSemiEmpMethods;
1029 	}
1030 	else
1031 	{
1032 		listMethodsView = listHFMethodsView;
1033 		listMethodsReal = listHFMethodsReal;
1034 		numberOfMethods = numberOfHFMethods;
1035 	}
1036 
1037 	if (comboMethod && gtk_combo_box_get_active_iter (GTK_COMBO_BOX(comboMethod), &iter))
1038 	{
1039 		GtkTreeModel* model = gtk_combo_box_get_model(GTK_COMBO_BOX(comboMethod));
1040         	GtkTreeStore *store = GTK_TREE_STORE(model);
1041 		gtk_tree_store_clear(store);
1042 
1043 		for(i=0;i<numberOfMethods;i++)
1044 		{
1045         		gtk_tree_store_append (store, &iter, NULL);
1046 			if(i==0) iter0 = iter;
1047         		gtk_tree_store_set (store, &iter, 0, listMethodsView[i], -1);
1048 		}
1049 		gtk_combo_box_set_active_iter(GTK_COMBO_BOX (comboMethod), &iter0);
1050 	}
1051 
1052 }
1053 /************************************************************************************************************/
traitementTypeMethod(GtkComboBox * combobox,gpointer d)1054 static void traitementTypeMethod (GtkComboBox *combobox, gpointer d)
1055 {
1056 	GtkTreeIter iter;
1057 	gchar* data = NULL;
1058 	gchar* res = NULL;
1059 	gint i;
1060 	/* gchar* s;*/
1061 	if (gtk_combo_box_get_active_iter (combobox, &iter))
1062 	{
1063 		GtkTreeModel* model = gtk_combo_box_get_model(combobox);
1064 		gtk_tree_model_get (model, &iter, 0, &data, -1);
1065 	}
1066 	else return;
1067 	for(i=0;i<numberOfTypeMethods;i++)
1068 	{
1069 		if(strcmp((gchar*)data,listTypeMethodsView[i])==0) res = listTypeMethodsReal[i];
1070 	}
1071 	if(res) sprintf(selectedTypeMethod,"%s",res);
1072 	else  sprintf(selectedSCF,"HF");
1073 
1074 	setPsicodeMethods();
1075 }
1076 /********************************************************************************************************/
create_list_type_methods()1077 static GtkWidget *create_list_type_methods()
1078 {
1079         GtkTreeIter iter;
1080         GtkTreeStore *store;
1081 	GtkTreeModel *model;
1082 	GtkWidget *combobox;
1083 	GtkCellRenderer *renderer;
1084 	gint i;
1085         GtkTreeIter iter0;
1086 
1087 	store = gtk_tree_store_new (1,G_TYPE_STRING);
1088 
1089 	for(i=0;i<numberOfTypeMethods;i++)
1090 	{
1091         	gtk_tree_store_append (store, &iter, NULL);
1092 		if(i==0) iter0 = iter;
1093         	gtk_tree_store_set (store, &iter, 0, listTypeMethodsView[i], -1);
1094 	}
1095 
1096         model = GTK_TREE_MODEL (store);
1097 	combobox = gtk_combo_box_new_with_model (model);
1098 	/*
1099 	gtk_combo_box_set_add_tearoffs (GTK_COMBO_BOX (combobox), TRUE);
1100 	*/
1101 	g_object_unref (model);
1102 	g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(traitementTypeMethod), NULL);
1103 	renderer = gtk_cell_renderer_text_new ();
1104 	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, TRUE);
1105 	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer, "text", 0, NULL);
1106 
1107 	gtk_combo_box_set_active_iter(GTK_COMBO_BOX (combobox), &iter0);
1108 
1109 	return combobox;
1110 }
1111 /*************************************************************************************************************/
traitementMethod(GtkComboBox * combobox,gpointer d)1112 static void traitementMethod (GtkComboBox *combobox, gpointer d)
1113 {
1114 	GtkTreeIter iter;
1115 	gchar* data = NULL;
1116 	gchar* res = NULL;
1117 	gint i;
1118 	GtkWidget* wid;
1119 	gboolean ri = FALSE;
1120 
1121 	if (gtk_combo_box_get_active_iter (combobox, &iter))
1122 	{
1123 		GtkTreeModel* model = gtk_combo_box_get_model(combobox);
1124 		gtk_tree_model_get (model, &iter, 0, &data, -1);
1125 	}
1126 	else return;
1127 	for(i=0;i<numberOfMethods;i++)
1128 	{
1129 		if(strcmp((gchar*)data,listMethodsView[i])==0) res = listMethodsReal[i];
1130 	}
1131 	if(res) sprintf(selectedMethod,"%s",res);
1132 	else  sprintf(selectedMethod,"HF");
1133 	if(strstr(selectedMethod,"RI")) ri = TRUE;
1134 	wid  = g_object_get_data(G_OBJECT (combobox), "LabelAuxBasis1");
1135 	if(wid) gtk_widget_set_sensitive(wid, ri);
1136 	wid  = g_object_get_data(G_OBJECT (combobox), "LabelAuxBasis2");
1137 	if(wid) gtk_widget_set_sensitive(wid, ri);
1138 	wid  = g_object_get_data(G_OBJECT (combobox), "ComboAuxBasis");
1139 	if(wid) gtk_widget_set_sensitive(wid, ri);
1140 	setPsicodeExcited();
1141 }
1142 /********************************************************************************************************/
create_list_methods()1143 static GtkWidget *create_list_methods()
1144 {
1145         GtkTreeIter iter;
1146         GtkTreeStore *store;
1147 	GtkTreeModel *model;
1148 	GtkWidget *combobox;
1149 	GtkCellRenderer *renderer;
1150 	gint i;
1151         GtkTreeIter iter0;
1152 
1153 	store = gtk_tree_store_new (1,G_TYPE_STRING);
1154 
1155 
1156 	for(i=0;i<numberOfMethods;i++)
1157 	{
1158         	gtk_tree_store_append (store, &iter, NULL);
1159 		if(i==0) iter0 = iter;
1160         	gtk_tree_store_set (store, &iter, 0, listMethodsView[i], -1);
1161 	}
1162 
1163         model = GTK_TREE_MODEL (store);
1164 	combobox = gtk_combo_box_new_with_model (model);
1165 	/*
1166 	gtk_combo_box_set_add_tearoffs (GTK_COMBO_BOX (combobox), TRUE);
1167 	*/
1168 	g_object_unref (model);
1169 	g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(traitementMethod), NULL);
1170 	renderer = gtk_cell_renderer_text_new ();
1171 	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, TRUE);
1172 	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer, "text", 0, NULL);
1173 
1174 	gtk_combo_box_set_active_iter(GTK_COMBO_BOX (combobox), &iter0);
1175 
1176 	return combobox;
1177 }
1178 /************************************************************************************************************/
createPsicodeKeywordsFrame(GtkWidget * win,GtkWidget * box)1179 void createPsicodeKeywordsFrame(GtkWidget *win, GtkWidget *box)
1180 {
1181 	GtkWidget* frame;
1182 	GtkWidget* vboxFrame;
1183 	GtkWidget* comboBasis;
1184 	GtkWidget* sep;
1185 	GtkWidget* combo = NULL;
1186 	GtkWidget* comboScfConvergence  = NULL;
1187 	gint l=0;
1188 	gint c=0;
1189 	gint ncases=1;
1190 	GtkWidget *table = gtk_table_new(10,3,FALSE);
1191 
1192 	comboMethod = NULL;
1193 	comboTypeMethod = NULL;
1194 	comboExcited = NULL;
1195 
1196 	listMethodsView = listHybridMethodsView;
1197 	listMethodsReal = listHybridMethodsReal;
1198 	numberOfMethods = numberOfHybridMethods;
1199 
1200 	frame = gtk_frame_new (_("Job Specification:"));
1201 	gtk_widget_show (frame);
1202 	gtk_box_pack_start (GTK_BOX (box), frame, TRUE, TRUE, 3);
1203 	gtk_frame_set_label_align (GTK_FRAME (frame), 0.5, 0.5);
1204 
1205 	vboxFrame = gtk_vbox_new (FALSE, 3);
1206 	gtk_widget_show (vboxFrame);
1207 	gtk_container_add (GTK_CONTAINER (frame), vboxFrame);
1208 	gtk_box_pack_start (GTK_BOX (vboxFrame), table, TRUE, TRUE, 0);
1209 
1210 	/*------------------ Job Type -----------------------------------------*/
1211 	l=0;
1212 	c = 0; ncases=1;
1213 	add_label_table(table,_("Job Type"),l,c);
1214 	c = 1; ncases=1;
1215 	add_label_table(table,":",l,c);
1216 	combo = create_list_jobtype();
1217 	c = 2; ncases=1;
1218 	gtk_table_attach(GTK_TABLE(table),combo,c,c+ncases,l,l+1,
1219 		(GtkAttachOptions)	(GTK_FILL | GTK_EXPAND),
1220 		(GtkAttachOptions)	(GTK_FILL | GTK_SHRINK),
1221                   2,2);
1222 	/*------------------ SCF Type -----------------------------------------*/
1223 	l++;
1224 	c = 0; ncases=1;
1225 	add_label_table(table,_("SCF Type"),l,c);
1226 	c = 1; ncases=1;
1227 	add_label_table(table,":",l,c);
1228 	combo = create_list_scf();
1229 	comboSCF=combo;
1230 	c = 2; ncases=1;
1231 	gtk_table_attach(GTK_TABLE(table),combo,c,c+ncases,l,l+1,
1232 		(GtkAttachOptions)	(GTK_FILL | GTK_EXPAND),
1233 		(GtkAttachOptions)	(GTK_FILL | GTK_SHRINK),
1234                   2,2);
1235 	/*------------------ SCF Convergence -----------------------------------------*/
1236 	l++;
1237 	c = 0; ncases=1;
1238 	add_label_table(table,_("SCF Convergence"),l,c);
1239 	c = 1; ncases=1;
1240 	add_label_table(table,":",l,c);
1241 	comboScfConvergence  = create_list_scfconvergence();
1242 	c = 2; ncases=1;
1243 	gtk_table_attach(GTK_TABLE(table),comboScfConvergence,c,c+ncases,l,l+1,
1244 		(GtkAttachOptions)	(GTK_FILL | GTK_EXPAND),
1245 		(GtkAttachOptions)	(GTK_FILL | GTK_SHRINK),
1246                   2,2);
1247 
1248 	/*------------------ Method Type -----------------------------------------*/
1249 	l++;
1250 	c = 0; ncases=1;
1251 	add_label_table(table,_("Type of method"),l,c);
1252 	c = 1; ncases=1;
1253 	add_label_table(table,":",l,c);
1254 	combo = create_list_type_methods();
1255 	comboTypeMethod = combo;
1256 	c = 2; ncases=1;
1257 	gtk_table_attach(GTK_TABLE(table),combo,c,c+ncases,l,l+1,
1258 		(GtkAttachOptions)	(GTK_FILL | GTK_EXPAND),
1259 		(GtkAttachOptions)	(GTK_FILL | GTK_SHRINK),
1260                   2,2);
1261 	/*------------------  Method -----------------------------------------*/
1262 	l++;
1263 	c = 0; ncases=1;
1264 	add_label_table(table,_("Method"),l,c);
1265 	c = 1; ncases=1;
1266 	add_label_table(table,":",l,c);
1267 	combo = create_list_methods();
1268 	comboMethod = combo;
1269 	c = 2; ncases=1;
1270 	gtk_table_attach(GTK_TABLE(table),combo,c,c+ncases,l,l+1,
1271 		(GtkAttachOptions)	(GTK_FILL | GTK_EXPAND),
1272 		(GtkAttachOptions)	(GTK_FILL | GTK_SHRINK),
1273                   2,2);
1274 	setPsicodeMethods();
1275 	/*------------------  Excited states -----------------------------------------*/
1276 	l++;
1277 	c = 0; ncases=1;
1278 	add_label_table(table,_("Excited states"),l,c);
1279 	c = 1; ncases=1;
1280 	add_label_table(table,":",l,c);
1281 	combo = create_list_excited();
1282 	comboExcited = combo;
1283 	c = 2; ncases=1;
1284 	gtk_table_attach(GTK_TABLE(table),combo,c,c+ncases,l,l+1,
1285 		(GtkAttachOptions)	(GTK_FILL | GTK_EXPAND),
1286 		(GtkAttachOptions)	(GTK_FILL | GTK_SHRINK),
1287                   2,2);
1288 	setPsicodeExcited();
1289 	/*------------------ separator -----------------------------------------*/
1290 	l++;
1291 	sep = gtk_hseparator_new ();;
1292 	c = 0; ncases=3;
1293 	gtk_table_attach(GTK_TABLE(table),sep,c,c+ncases,l,l+1,
1294 		(GtkAttachOptions)	(GTK_FILL | GTK_EXPAND),
1295 		(GtkAttachOptions)	(GTK_FILL | GTK_SHRINK),
1296                   2,2);
1297 	/*------------------ basis -----------------------------------------*/
1298 	l++;
1299 	comboBasis = addPsicodeBasisToTable(table, l+1);
1300 	addPsicodeTypeBasisToTable(table, l, comboBasis);
1301 	l++;
1302 	/*------------------ aux basis -----------------------------------------*/
1303 	l++;
1304 	addPsicodeAuxBasisToTable(table, l, comboMethod, comboExcited);
1305 	setPsicodeMethods(); /* For activate sensitive aux basis */
1306 }
1307