diff -Nru gabedit-2.3.7/ChangeLog gabedit-2.4.0/ChangeLog --- gabedit-2.3.7/ChangeLog 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/ChangeLog 2011-09-22 14:25:07.000000000 +0000 @@ -1,3 +1,18 @@ +15 September 2011 : + Bug fixed for reading orbitals from a ORCA output file + Bug fixed for drawing colorcoded planes (under windows OS) + +13 Jyly 2011 : + NWChem is now supported + Geometry and charges can be read from a aimall sum file + +10 June 2011 : + Bug fixed for animated vibration/threshold + Bug fixed : orbitals molpro (define NOrb) + +1 June 2011 : + Group of the third atom can be rotated in Draw Geom window. + 30 April 2011 : pair radial distribution RMSD for a trajectory diff -Nru gabedit-2.3.7/CONFIG gabedit-2.4.0/CONFIG --- gabedit-2.3.7/CONFIG 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/CONFIG 2011-09-22 14:25:07.000000000 +0000 @@ -13,6 +13,7 @@ RM = rm -f RMTMP = rm -f tmp/* MAKE = make +MKDIR = mkdir -p WIN32LIB = X11LIB = -lX11 CC = gcc diff -Nru gabedit-2.3.7/debian/changelog gabedit-2.4.0/debian/changelog --- gabedit-2.3.7/debian/changelog 2011-05-11 16:33:43.000000000 +0000 +++ gabedit-2.4.0/debian/changelog 2011-10-26 22:06:04.000000000 +0000 @@ -1,3 +1,10 @@ +gabedit (2.4.0-1) unstable; urgency=low + + * New upstream release. + * debian/control (Description): Improved description (closes: #639227). + + -- Daniel Leidert (dale) Thu, 27 Oct 2011 00:06:02 +0200 + gabedit (2.3.7-1) unstable; urgency=low * New upstream release. diff -Nru gabedit-2.3.7/debian/control gabedit-2.4.0/debian/control --- gabedit-2.3.7/debian/control 2011-05-11 16:32:56.000000000 +0000 +++ gabedit-2.4.0/debian/control 2011-10-26 21:58:31.000000000 +0000 @@ -19,17 +19,18 @@ Suggests: a2ps, cups-bsd | lpr, povray [i386], ftp-ssl | ftp, openssh-client | rsh-client, openssh-client | ssh-client Description: graphical user interface to Ab Initio packages Gabedit is a graphical user interface to computational chemistry - packages like the Free Software package MPQC. Other (proprietary) - packages supported include: + packages like: . + - MPQC - GAMESS-US - Gaussian - Molcas - Molpro - Q-Chem . - running locally or on a remote server (supporting FTP, RSH and SSH). - It can display a variety of calculation results including support for - most major molecular file formats. The advanced "Molecule Builder" - allows one to rapidly sketch in molecules and examine them in 3D. - Graphics can be exported to various formats, including animations. + These Ab Initio software packages might run locally or on a remote + server (supporting FTP, RSH and SSH). Gabedit can display a variety + of calculation results including most major molecular file formats. + The advanced "Molecule Builder" allows one to rapidly sketch in + molecules and examine them in 3D. Graphics can further be exported + to various formats, including animations. diff -Nru gabedit-2.3.7/INSTALL gabedit-2.4.0/INSTALL --- gabedit-2.3.7/INSTALL 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/INSTALL 2011-09-22 14:25:07.000000000 +0000 @@ -5,14 +5,14 @@ Installation in unix/Linux system : =================================== - The 2.4.x version of GTK+ (or higher) is required for this version of Gabedit + The 2.16 version of GTK+ (or higher) is required for this version of Gabedit For install gabedit from src files, execute following commands: - gunzip Gabeditxxyyzz.tar.gz - tar -xvf Gabeditxxyyzz.tar - cd Gabeditxxyyzz - cp CONFIG.unix CONFIG + gunzip GabeditSrcxyz.tar.gz + tar -xvf GabeditSrcxyz.tar + cd GabeditSRCxyz + cp plaforms/CONFIG.unix CONFIG make ./gabedit @@ -21,21 +21,39 @@ after installation you can execute gabedit from any directory for this type : gabedit +Installation under MAC OS X11 system : +=================================== + + 1- install X11 if this is not already installed on your mac (see http://guide.macports.org/#installing.x11) + + 2- install macports (http://www.macports.org/) + + 3- install gtk2 using macports. Under an unix terminal(Applications:Utilities:Terminal), type : + sudo port install gtk2 + + 4- install gtkglext using macports. Under an unix terminal, type : + sudo port install gtkglext + + 5- Copy the platforms/CONFIG.MacPorts file at CONFIG in the Gabedit directory and type make (under an unix terminal): + cp platforms/CONFIG.MacPorts CONFIG + make + + Installation of binary version of Gabedit in Windows(2000, XP, ...) system : ============================================================================= - click to setupGabeditxxyyzz.exe + click to setupGabeditxyz.exe click to Gabedit.exe program Compilation of Gabedit under Windows (2000, XP, ....) system : ============================================================== - The 2.4.x version of GTK+ (or higher) is required for this version of Gabedit + The 2.16 version of GTK+ (or higher) is required for this version of Gabedit For install gabedit from src files, execute following commands: - gunzip Gabeditxxyyzz.tar.gz - tar -xvf Gabeditxxyyzz.tar - cd Gabeditxxyyzz - copy CONFIG.win32 CONFIG + gunzip GabeditSrcxyz.tar.gz + tar -xvf GabeditSrcxyz.tar + cd GabeditSrcxyz + copy platforms\CONFIG.win32 CONFIG mingw32-make ./gabedit diff -Nru gabedit-2.3.7/Makefile gabedit-2.4.0/Makefile --- gabedit-2.3.7/Makefile 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/Makefile 2011-09-22 14:25:07.000000000 +0000 @@ -16,6 +16,7 @@ NETWORK = src/NetWork/*.o OPENGL = src/Display/*.o FIREFLY = src/FireFly/*.o +NWCHEM = src/NWChem/*.o ORCA = src/Orca/*.o QCHEM = src/QChem/*.o SEMIEMP = src/SemiEmpirical/*.o @@ -28,13 +29,13 @@ OBJECTS = \ $(COMMON) $(CURVE) $(FILES) $(GAMESS) $(GAUSS) $(GEOM) $(MODELS) \ $(MOLCAS) $(MOLPRO) $(MOPAC) $(MPQC) $(MULTIGRID) $(NETWORK) \ - $(OPENGL) $(FIREFLY) $(ORCA) $(QCHEM) $(SEMIEMP) $(UTILS) \ + $(OPENGL) $(FIREFLY) $(NWCHEM) $(ORCA) $(QCHEM) $(SEMIEMP) $(UTILS) \ $(SYMMETRY) $(VIBCORR) $(IDC) SUBDIRS = \ src/Display src/Common src/Files src/Gaussian \ src/Geometry src/Spectrum src/MolecularMechanics src/Molpro src/Molcas \ - src/MPQC src/Gamess src/Orca src/QChem src/Mopac src/NetWork src/Utils \ + src/MPQC src/Gamess src/NWChem src/Orca src/QChem src/Mopac src/NetWork src/Utils \ src/Symmetry src/FireFly src/MultiGrid src/SemiEmpirical \ src/VibrationalCorrections src/IsotopeDistribution @@ -59,7 +60,7 @@ all: gabedit gabedit: $(SUBDIRS) - mkdir tmp + $(MKDIR) tmp cp $(OBJECTS) tmp $(CC) $(LDFLAGS) tmp/*.o -o gabedit $(GLTOPS) $(X11LIB) $(GTKLIB) $(OGLLIB) $(JPEGLIB) $(LIBPTHREAD) $(WIN32LIB) $(OMPLIB) -g @$(RMTMP) > ptmp diff -Nru gabedit-2.3.7/pixmaps/NWChemMini.xpm gabedit-2.4.0/pixmaps/NWChemMini.xpm --- gabedit-2.3.7/pixmaps/NWChemMini.xpm 1970-01-01 00:00:00.000000000 +0000 +++ gabedit-2.4.0/pixmaps/NWChemMini.xpm 2011-09-22 14:25:07.000000000 +0000 @@ -0,0 +1,135 @@ +/* XPM */ +static char * nwchem_mini_xpm[] = { +"14 16 116 2", +" c #FAFAFA", +". c #F4F5F1", +"+ c #DEE4D4", +"@ c #D4DCC6", +"# c #ECEFE9", +"$ c #C5D1B2", +"% c #AABC8C", +"& c #91A96A", +"* c #749244", +"= c #61842A", +"- c #5C8022", +"; c #5B7F21", +"> c #64862D", +", c #89A360", +"' c #B5C59C", +") c #DFE5D5", +"! c #F8F8F7", +"~ c #BBC6B5", +"{ c #436427", +"] c #527523", +"^ c #5D8123", +"/ c #769541", +"( c #B7CA96", +"_ c #C6CFC1", +": c #3C5C29", +"< c #426327", +"[ c #517324", +"} c #5B7E21", +"| c #5E8222", +"1 c #658C26", +"2 c #6D952A", +"3 c #759E2E", +"4 c #78A22F", +"5 c #9FBD6D", +"6 c #CDD4C8", +"7 c #416128", +"8 c #628828", +"9 c #739B2C", +"0 c #9BB76B", +"a c #98B860", +"b c #78A230", +"c c #A9C37C", +"d c #D4DBD1", +"e c #678E2D", +"f c #79A330", +"g c #8FA765", +"h c #9AB36D", +"i c #799D39", +"j c #B4CB8D", +"k c #DEE2DB", +"l c #3D5D2A", +"m c #92B05E", +"n c #7FA045", +"o c #86A158", +"p c #BCD09A", +"q c #E3E7E0", +"r c #3E5E2B", +"s c #96AD6F", +"t c #94AE67", +"u c #759D2F", +"v c #C5D6A8", +"w c #E7EAE5", +"x c #3F5F2D", +"y c #96B65C", +"z c #FBFCF9", +"A c #95AB6F", +"B c #D0DDB8", +"C c #F1F2F0", +"D c #536F43", +"E c #D4E1BC", +"F c #E4E6E1", +"G c #759B31", +"H c #DAE4C8", +"I c #E2E6E1", +"J c #617952", +"K c #7DA536", +"L c #F7FAF3", +"M c #A0B281", +"N c #81A83D", +"O c #E8EEDE", +"P c #F9F9F9", +"Q c #D5D4D7", +"R c #B9B9BC", +"S c #718367", +"T c #81A640", +"U c #769F2F", +"V c #80A541", +"W c #ABBD8C", +"X c #EFF2EB", +"Y c #DEDDDF", +"Z c #BDBCC0", +"` c #8A9685", +" . c #405F2D", +".. c #85A74B", +"+. c #A4B28C", +"@. c #BABABC", +"#. c #BEBDC1", +"$. c #D9D8DA", +"%. c #E7E7E8", +"&. c #C0BFC3", +"*. c #9FA69D", +"=. c #829C5D", +"-. c #AAB499", +";. c #BCBBBE", +">. c #BFBEC2", +",. c #D7D6D9", +"'. c #F2F2F2", +"). c #EFEFF0", +"!. c #C5C4C7", +"~. c #BCBBBF", +"{. c #C1C0C4", +"]. c #DADADC", +"^. c #F4F4F5", +"/. c #F5F5F5", +"(. c #E1E1E2", +"_. c #F6F6F7", +" . + @ . ", +"# $ % & * = - ; > , ' ) ! ", +"~ { ] ; ; ; ; ; ; ; ; ^ / ( ", +"_ : : < [ } ; ; | 1 2 3 4 5 ", +"6 : : : : 7 8 9 4 4 0 a b c ", +"d : : : : : e 4 4 f g h i j ", +"k l : : : : e 4 4 m n o 4 p ", +"q r : : : : e 4 4 s t u 4 v ", +"w x : : : : e 4 y z A 4 4 B ", +"C D : : : : e 4 E F G 4 4 H ", +" I J : : : e K L M 4 4 N O ", +"P Q R S : : e 4 T U V W X ", +" P Y Z ` .e 4 ..+.@.#.$.P ", +" %.&.*.=.-.;.>.,.'. ", +" ).!.~.{.].^. ", +" /.(._. "}; diff -Nru gabedit-2.3.7/pixmaps/NWChem.xpm gabedit-2.4.0/pixmaps/NWChem.xpm --- gabedit-2.3.7/pixmaps/NWChem.xpm 1970-01-01 00:00:00.000000000 +0000 +++ gabedit-2.4.0/pixmaps/NWChem.xpm 2011-09-22 14:25:07.000000000 +0000 @@ -0,0 +1,190 @@ +/* XPM */ +static char * nwchem_xpm[] = { +"23 22 165 2", +" c #FAFAFA", +". c #F5F6F3", +"+ c #DFE5D6", +"@ c #C8D3B6", +"# c #AEBF92", +"$ c #92A96C", +"% c #94AB6F", +"& c #C0CDAB", +"* c #E7EBE0", +"= c #EDF0EA", +"- c #C7D2B5", +"; c #ACBD8F", +"> c #91A86A", +", c #799649", +"' c #63852B", +") c #5D8023", +"! c #5B7F21", +"~ c #5E8125", +"{ c #789548", +"] c #A2B681", +"^ c #CED8BE", +"/ c #EEF0E9", +"( c #F9F9F9", +"_ c #C1CBBB", +": c #436427", +"< c #517424", +"[ c #66872F", +"} c #87A15D", +"| c #B4C598", +"1 c #F1F4ED", +"2 c #CCD4C7", +"3 c #3C5C29", +"4 c #416228", +"5 c #507224", +"6 c #5A7E21", +"7 c #5C8122", +"8 c #628825", +"9 c #6B9228", +"0 c #729B2C", +"a c #7AA333", +"b c #E5ECD9", +"c c #D6DCD2", +"d c #406128", +"e c #4E7024", +"f c #5A7D22", +"g c #618624", +"h c #688F27", +"i c #70982B", +"j c #76A02E", +"k c #78A22F", +"l c #7CA536", +"m c #ECF0E4", +"n c #DCE1D9", +"o c #3F5F28", +"p c #547826", +"q c #6E962A", +"r c #759F2E", +"s c #A2BB76", +"t c #A4C073", +"u c #7DA637", +"v c #7FA73A", +"w c #F4F6F1", +"x c #E2E6E0", +"y c #51742B", +"z c #A1B382", +"A c #81A640", +"B c #B9C79F", +"C c #739B2E", +"D c #85AB43", +"E c #F8F9F8", +"F c #EBEEEA", +"G c #3F5E2C", +"H c #8CB04F", +"I c #859C5C", +"J c #9DBA6B", +"K c #789348", +"L c #8EB151", +"M c #F0F2EF", +"N c #436231", +"O c #77A12E", +"P c #A1B47F", +"Q c #739A2E", +"R c #9AAB7D", +"S c #96B65D", +"T c #F2F4F2", +"U c #466535", +"V c #89AE48", +"W c #899E64", +"X c #98B762", +"Y c #7B974A", +"Z c #9DBB6A", +"` c #F3F5F3", +" . c #4B693A", +".. c #78A22E", +"+. c #BFD19E", +"@. c #C2D0A8", +"#. c #A8B68F", +"$. c #759E2E", +"%. c #AAC47D", +"&. c #F4F5F4", +"*. c #506D3F", +"=. c #83AA41", +"-. c #F4F8EF", +";. c #FBFBFB", +">. c #819A55", +",. c #B3CA8B", +"'. c #F7F7F7", +"). c #69825B", +"!. c #B9CF93", +"~. c #FFFFFF", +"{. c #CBCFC3", +"]. c #739B2D", +"^. c #BDD19C", +"/. c #7A8F6D", +"(. c #7AA331", +"_. c #F1F5E9", +":. c #869C5F", +"<. c #C6D7AA", +"[. c #E8E8E9", +"}. c #D4D4D6", +"|. c #7F8E77", +"1. c #3E5E2C", +"2. c #CBDAB0", +"3. c #B8C1AA", +"4. c #82A93F", +"5. c #B1C888", +"6. c #EEF2E7", +"7. c #EBEBEC", +"8. c #C4C3C6", +"9. c #BCBBBF", +"0. c #979F93", +"a. c #466334", +"b. c #80A541", +"c. c #9EB17E", +"d. c #DBDED6", +"e. c #F8F8F8", +"f. c #F3F3F4", +"g. c #CAC9CC", +"h. c #ABAEAB", +"i. c #546E45", +"j. c #85A74B", +"k. c #A4B28C", +"l. c #BABABA", +"m. c #BDBCC0", +"n. c #D0CFD2", +"o. c #B7B7B9", +"p. c #6B7F60", +"q. c #79A331", +"r. c #8CA959", +"s. c #ABB59B", +"t. c #CBCACD", +"u. c #E8E7E8", +"v. c #DEDDDF", +"w. c #BDBDC0", +"x. c #BBBBBE", +"y. c #99A58C", +"z. c #B1B7A7", +"A. c #CFCED1", +"B. c #C1C0C4", +"C. c #BFBEC2", +"D. c #D4D3D6", +"E. c #EFEFEF", +"F. c #F0F0F0", +"G. c #D8D7DA", +"H. c #F1F1F2", +" ", +" . + @ # $ % & * ", +" = - ; > , ' ) ! ! ! ! ! ~ { ] ^ / ( ", +" _ : < ! ! ! ! ! ! ! ! ! ! ! ! ! [ } | 1 ", +" 2 3 3 4 5 6 ! ! ! ! ! ! ! ! 7 8 9 0 a b ", +" c 3 3 3 3 d e f ! ! ! g h i j k k k l m ", +" n 3 3 3 3 3 3 o p q r k k k s t u k v w ", +" x 3 3 3 3 3 3 3 y k k k k k z A B C D E ", +" F G 3 3 3 3 3 3 y k k k k H I J K k L ", +" M N 3 3 3 3 3 3 y k k k O P Q R O k S ", +" T U 3 3 3 3 3 3 y k k k V W X Y k k Z ", +" ` .3 3 3 3 3 3 y k k ..+.@.#.$.k k %. ", +" &.*.3 3 3 3 3 3 y k k =.-.;.>.k k k ,. ", +" '.).3 3 3 3 3 3 y k k !.~.{.].k k k ^. ", +" F /.3 3 3 3 3 y k (._.~.:.k k k k <. ", +" [.}.|.1.3 3 3 y k k 2.3.Q k k 4.5.6. ", +" 7.8.9.0.a.3 3 y k k O O ..b.c.d.e. ", +" f.g.9.h.i.3 y k k k j.k.l.9.m.n.'. ", +" '.}.9.o.p.y q.r.s.9.9.m.t.u.( ", +" ( v.w.x.y.z.9.9.m.A.7.( ", +" [.B.9.9.C.D.E. ", +" F.g.G.H. "}; diff -Nru gabedit-2.3.7/platforms/CONFIG.linux gabedit-2.4.0/platforms/CONFIG.linux --- gabedit-2.3.7/platforms/CONFIG.linux 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/platforms/CONFIG.linux 2011-09-22 14:25:07.000000000 +0000 @@ -13,10 +13,11 @@ RM = rm -f RMTMP = rm -f tmp/* MAKE = make +MKDIR = mkdir -p WIN32LIB = X11LIB = -lX11 CC = gcc -enable_omp = 0 +enable_omp = 1 ifeq ($(enable_omp),1) OMPLIB=-L/usr/lib -lgomp OMPCFLAGS=-DENABLE_OMP -fopenmp diff -Nru gabedit-2.3.7/platforms/CONFIG.MacOSX11 gabedit-2.4.0/platforms/CONFIG.MacOSX11 --- gabedit-2.3.7/platforms/CONFIG.MacOSX11 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/platforms/CONFIG.MacOSX11 2011-09-22 14:25:07.000000000 +0000 @@ -11,6 +11,7 @@ LIBPTHREAD = -lpthread RM = rm -f RMTMP = rm -f tmp/* +MKDIR = mkdir -p MAKE = make WIN32LIB = X11LIB = -lX11 @@ -29,6 +30,7 @@ GDKGL=gdkgl LIBPTHREAD = -lpthread RM = rm -f +MKDIR = mkdir -p MAKE = make WIN32LIB = X11LIB = -lX11 diff -Nru gabedit-2.3.7/platforms/CONFIG.MacPorts gabedit-2.4.0/platforms/CONFIG.MacPorts --- gabedit-2.3.7/platforms/CONFIG.MacPorts 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/platforms/CONFIG.MacPorts 2011-09-22 14:25:07.000000000 +0000 @@ -8,6 +8,7 @@ RM = rm -f RMTMP = rm -f tmp/* MAKE = make +MKDIR = mkdir -p WIN32LIB = X11LIB = -lX11 CC = gcc -I/usr/X11/include diff -Nru gabedit-2.3.7/platforms/CONFIG.unix gabedit-2.4.0/platforms/CONFIG.unix --- gabedit-2.3.7/platforms/CONFIG.unix 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/platforms/CONFIG.unix 2011-09-22 14:25:07.000000000 +0000 @@ -13,10 +13,11 @@ RM = rm -f RMTMP = rm -f tmp/* MAKE = make +MKDIR = mkdir -p WIN32LIB = X11LIB = -lX11 CC = gcc -enable_omp = 0 +enable_omp = 1 ifeq ($(enable_omp),1) OMPLIB=-L/usr/lib -lgomp OMPCFLAGS=-DENABLE_OMP -fopenmp diff -Nru gabedit-2.3.7/platforms/CONFIG.win32 gabedit-2.4.0/platforms/CONFIG.win32 --- gabedit-2.3.7/platforms/CONFIG.win32 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/platforms/CONFIG.win32 2011-09-22 14:25:07.000000000 +0000 @@ -7,6 +7,7 @@ #GTKCFLAGS = `pkg-config gtk+-2.0 --cflags` GTKCFLAGS = -IE:/allouche/Programs/gtk/include/gtk-2.0 -IE:/allouche/Programs/gtk/lib/gtk-2.0/include -IE:/allouche/Programs/gtk/include/atk-1.0 -IE:/allouche/Programs/gtk/include/pango-1.0 -IE:/allouche/Programs/gtk/include/glib-2.0 -IE:/allouche/Programs/gtk/lib/glib-2.0/include IE:/allouche/Programs/gtk/include/cairo +MKDIR = mkdir MAKE = mingw32-make RM = del RMTMP = del /S/Q tmp diff -Nru gabedit-2.3.7/platforms/CONFIG.win32Local gabedit-2.4.0/platforms/CONFIG.win32Local --- gabedit-2.3.7/platforms/CONFIG.win32Local 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/platforms/CONFIG.win32Local 2011-09-22 14:25:07.000000000 +0000 @@ -7,6 +7,7 @@ #GTKCFLAGS = `pkg-config gtk+-2.0 --cflags` GTKCFLAGS = -IE:/allouche/Programs/gtk/include/gtk-2.0 -IE:/allouche/Programs/gtk/lib/gtk-2.0/include -IE:/allouche/Programs/gtk/include/atk-1.0 -IE:/allouche/Programs/gtk/include/pango-1.0 -IE:/allouche/Programs/gtk/include/glib-2.0 -IE:/allouche/Programs/gtk/lib/glib-2.0/include IE:/allouche/Programs/gtk/include/cairo +MKDIR = mkdir MAKE = mingw32-make RM = del RMTMP = del /S/Q tmp diff -Nru gabedit-2.3.7/platforms/CONFIG.win32Portable gabedit-2.4.0/platforms/CONFIG.win32Portable --- gabedit-2.3.7/platforms/CONFIG.win32Portable 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/platforms/CONFIG.win32Portable 2011-09-22 14:25:07.000000000 +0000 @@ -9,6 +9,7 @@ #GTKCFLAGS = `pkg-config gtk+-2.0 --cflags` GTKCFLAGS = -I$(GTKDIR)/include -I$(GTKDIR)/include/gtk-2.0 -I$(GTKDIR)/lib/gtk-2.0/include -I$(GTKDIR)/include/atk-1.0 -I$(GTKDIR)/include/pango-1.0 -I$(GTKDIR)/include/glib-2.0 -I$(GTKDIR)/lib/glib-2.0/include -I$(GTKDIR)/include/cairo -I$(GTKGLEXT)/include/gtkglext-1.0 -I$(GTKGLEXT)/lib/gtkglext-1.0/include +MKDIR = mkdir MAKE = mingw32-make RM = del RMTMP = del /S/Q tmp diff -Nru gabedit-2.3.7/platforms/CONFIG.win32Portable22 gabedit-2.4.0/platforms/CONFIG.win32Portable22 --- gabedit-2.3.7/platforms/CONFIG.win32Portable22 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/platforms/CONFIG.win32Portable22 2011-09-22 14:25:07.000000000 +0000 @@ -9,6 +9,7 @@ #GTKCFLAGS = `pkg-config gtk+-2.0 --cflags` GTKCFLAGS = -I$(GTKDIR)/include -I$(GTKDIR)/include/gtk-2.0 -I$(GTKDIR)/lib/gtk-2.0/include -I$(GTKDIR)/include/atk-1.0 -I$(GTKDIR)/include/pango-1.0 -I$(GTKDIR)/include/glib-2.0 -I$(GTKDIR)/lib/glib-2.0/include -I$(GTKDIR)/include/cairo -I$(GTKGLEXT)/include/gtkglext-1.0 -I$(GTKGLEXT)/lib/gtkglext-1.0/include +MKDIR = mkdir MAKE = mingw32-make RM = del RMTMP = del /S/Q tmp diff -Nru gabedit-2.3.7/platforms/CONFIG.win32Portable22_GLExt gabedit-2.4.0/platforms/CONFIG.win32Portable22_GLExt --- gabedit-2.3.7/platforms/CONFIG.win32Portable22_GLExt 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/platforms/CONFIG.win32Portable22_GLExt 2011-09-22 14:25:07.000000000 +0000 @@ -9,6 +9,7 @@ #GTKCFLAGS = `pkg-config gtk+-2.0 --cflags` GTKCFLAGS = -I$(GTKDIR)/include -I$(GTKDIR)/include/gtk-2.0 -I$(GTKDIR)/lib/gtk-2.0/include -I$(GTKDIR)/include/atk-1.0 -I$(GTKDIR)/include/pango-1.0 -I$(GTKDIR)/include/glib-2.0 -I$(GTKDIR)/lib/glib-2.0/include -I$(GTKDIR)/include/cairo -I$(GTKGLEXT)/include/gtkglext-1.0 -I$(GTKGLEXT)/lib/gtkglext-1.0/include +MKDIR = mkdir MAKE = mingw32-make RM = del RMTMP = del /S/Q tmp diff -Nru gabedit-2.3.7/platforms/CONFIG.win32Server gabedit-2.4.0/platforms/CONFIG.win32Server --- gabedit-2.3.7/platforms/CONFIG.win32Server 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/platforms/CONFIG.win32Server 2011-09-22 14:25:07.000000000 +0000 @@ -7,6 +7,7 @@ #GTKCFLAGS = `pkg-config gtk+-2.0 --cflags` GTKCFLAGS = -IZ:/Programs/gtk/include/gtk-2.0 -IZ:/Programs/gtk/lib/gtk-2.0/include -IZ:/Programs/gtk/include/atk-1.0 -IZ:/Programs/gtk/include/pango-1.0 -IZ:/Programs/gtk/include/glib-2.0 -IZ:/Programs/gtk/lib/glib-2.0/include -IZ:/Programs/gtk/include/cairo +MKDIR = mkdir MAKE = mingw32-make RM = del RMTMP = del /S/Q tmp diff -Nru gabedit-2.3.7/src/Common/Dep.mk gabedit-2.4.0/src/Common/Dep.mk --- gabedit-2.3.7/src/Common/Dep.mk 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Common/Dep.mk 2011-09-22 15:59:32.000000000 +0000 @@ -110,10 +110,11 @@ ../../pixmaps/Orca.xpm ../../pixmaps/QChem.xpm ../../pixmaps/Mopac.xpm \ ../../pixmaps/Adf.xpm ../../pixmaps/Dalton.xpm ../../pixmaps/Gamess.xpm \ ../../pixmaps/FireFly.xpm ../../pixmaps/MoveAtom.xpm \ - ../../pixmaps/MPQC.xpm ../../pixmaps/New.xpm ../../pixmaps/Next.xpm \ - ../../pixmaps/No.xpm ../../pixmaps/Ok.xpm ../../pixmaps/OpenBabel.xpm \ - ../../pixmaps/Open.xpm ../../pixmaps/Orbitals.xpm \ - ../../pixmaps/Ortho.xpm ../../pixmaps/Page.xpm ../../pixmaps/Paste.xpm \ + ../../pixmaps/MPQC.xpm ../../pixmaps/NWChem.xpm ../../pixmaps/New.xpm \ + ../../pixmaps/Next.xpm ../../pixmaps/No.xpm ../../pixmaps/Ok.xpm \ + ../../pixmaps/OpenBabel.xpm ../../pixmaps/Open.xpm \ + ../../pixmaps/Orbitals.xpm ../../pixmaps/Ortho.xpm \ + ../../pixmaps/Page.xpm ../../pixmaps/Paste.xpm \ ../../pixmaps/Perspective.xpm ../../pixmaps/Play.xpm \ ../../pixmaps/Print.xpm ../../pixmaps/Question.xpm \ ../../pixmaps/RenderBallStick.xpm ../../pixmaps/RenderStick.xpm \ diff -Nru gabedit-2.3.7/src/Common/GabeditType.h gabedit-2.4.0/src/Common/GabeditType.h --- gabedit-2.3.7/src/Common/GabeditType.h 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Common/GabeditType.h 2011-09-22 14:25:07.000000000 +0000 @@ -60,14 +60,15 @@ } GabEditTypeTexture; typedef enum { - GABEDIT_TYPENODE_GAMESS=0, + GABEDIT_TYPENODE_FIREFLY=0, + GABEDIT_TYPENODE_GAMESS, GABEDIT_TYPENODE_GAUSSIAN, GABEDIT_TYPENODE_MOLCAS, GABEDIT_TYPENODE_MOLPRO, GABEDIT_TYPENODE_MOPAC, GABEDIT_TYPENODE_MPQC, + GABEDIT_TYPENODE_NWCHEM, GABEDIT_TYPENODE_ORCA, - GABEDIT_TYPENODE_FIREFLY, GABEDIT_TYPENODE_QCHEM, GABEDIT_TYPENODE_GABEDIT, GABEDIT_TYPENODE_XYZ, @@ -100,6 +101,7 @@ GABEDIT_TYPEFILE_GZMAT, GABEDIT_TYPEFILE_MZMAT, GABEDIT_TYPEFILE_HIN, + GABEDIT_TYPEFILE_AIMALL, GABEDIT_TYPEFILE_GAMESSINPUT, GABEDIT_TYPEFILE_GAUSSIANINPUT, GABEDIT_TYPEFILE_GAUSSIAN_FCHK, @@ -109,6 +111,7 @@ GABEDIT_TYPEFILE_ORCAINPUT, GABEDIT_TYPEFILE_FIREFLYINPUT, GABEDIT_TYPEFILE_QCHEMINPUT, + GABEDIT_TYPEFILE_NWCHEMINPUT, GABEDIT_TYPEFILE_MOPACINPUT, GABEDIT_TYPEFILE_MPQC, GABEDIT_TYPEFILE_JPEG, @@ -121,6 +124,7 @@ GABEDIT_TYPEFILE_ORCA, GABEDIT_TYPEFILE_FIREFLY, GABEDIT_TYPEFILE_QCHEM, + GABEDIT_TYPEFILE_NWCHEM, GABEDIT_TYPEFILE_MOPAC, GABEDIT_TYPEFILE_MOPAC_AUX, GABEDIT_TYPEFILE_MOPAC_SCAN, @@ -151,6 +155,7 @@ GABEDIT_TYPEFILEGEOM_TINKER, GABEDIT_TYPEFILEGEOM_PDB, GABEDIT_TYPEFILEGEOM_HIN, + GABEDIT_TYPEFILEGEOM_AIMALL, GABEDIT_TYPEFILEGEOM_DALTONIN, GABEDIT_TYPEFILEGEOM_DALTONFIRST, @@ -185,6 +190,11 @@ GABEDIT_TYPEFILEGEOM_QCHEMOUTFIRST, GABEDIT_TYPEFILEGEOM_QCHEMOUTLAST, + GABEDIT_TYPEFILEGEOM_NWCHEMIN, + GABEDIT_TYPEFILEGEOM_NWCHEMOUTFIRST, + GABEDIT_TYPEFILEGEOM_NWCHEMOUTLAST, + + GABEDIT_TYPEFILEGEOM_MOPACIN, GABEDIT_TYPEFILEGEOM_MOPACOUTFIRST, GABEDIT_TYPEFILEGEOM_MOPACOUTLAST, diff -Nru gabedit-2.3.7/src/Common/Global.h gabedit-2.4.0/src/Common/Global.h --- gabedit-2.3.7/src/Common/Global.h 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Common/Global.h 2011-09-22 14:25:07.000000000 +0000 @@ -38,6 +38,7 @@ #define PROG_IS_ORCA GABEDIT_TYPENODE_ORCA #define PROG_IS_FIREFLY GABEDIT_TYPENODE_FIREFLY #define PROG_IS_QCHEM GABEDIT_TYPENODE_QCHEM +#define PROG_IS_NWCHEM GABEDIT_TYPENODE_NWCHEM #define PROG_IS_MOPAC GABEDIT_TYPENODE_MOPAC #define PROG_IS_OTHER -1 @@ -49,8 +50,8 @@ #define DATA_MOD_NO 0 #define MAJOR_VERSION 2 -#define MINOR_VERSION 3 -#define MICRO_VERSION 7 +#define MINOR_VERSION 4 +#define MICRO_VERSION 0 /**** Structures *********/ typedef struct _FileOpen @@ -155,6 +156,7 @@ gchar *NameCommandFireFly; gchar *NameCommandQChem; gchar *NameCommandOrca; + gchar *NameCommandNWChem; gchar *NameCommandMopac; gchar *NameCommandPovray; gint ScreenWidth; @@ -178,6 +180,7 @@ gchar* gamessDirectory; gchar* fireflyDirectory; gchar* orcaDirectory; + gchar* nwchemDirectory; gchar* mopacDirectory; gchar* gaussDirectory; gchar* povrayDirectory; @@ -187,6 +190,7 @@ CommandsList molproCommands; CommandsList mpqcCommands; CommandsList orcaCommands; + CommandsList nwchemCommands; CommandsList fireflyCommands; CommandsList qchemCommands; CommandsList mopacCommands; diff -Nru gabedit-2.3.7/src/Common/Install.c gabedit-2.4.0/src/Common/Install.c --- gabedit-2.3.7/src/Common/Install.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Common/Install.c 2011-09-22 14:25:07.000000000 +0000 @@ -117,7 +117,7 @@ FALSE, "commands", N_( "The \"commands\" file is used to store commands\n" - "for execute Gamess-US, Gaussian, Molcas, Molpro, \nMopac, MPQC, Orca, FireFly or Q-Chem program.\n" + "for execute Gamess-US, Gaussian, Molcas, Molpro, \nMopac, MPQC, NWChem, Orca, FireFly or Q-Chem program.\n" ) }, { @@ -635,24 +635,18 @@ add_label(GTK_BOX(page), _( - "Gabedit is a Graphical User Interface to Gamess-US, Gaussian, Molcas, Molpro, \nMopac, MPQC ,Orca, FireFly and Q-Chem\n" + "Gabedit is a Graphical User Interface to Gamess-US, Gaussian, Molcas, Molpro, \nMopac, MPQC , NWChem, Orca, FireFly and Q-Chem\n" "computational chemistry packages.\n" "It can display a variety of calculation results including support for most major molecular file formats.\n" "The advanced 'Molecule Builder' allows to rapidly sketch in molecules and examine them in 3D\n" "Graphics can be exported to various formats, including animations\n" "\n" "Gabedit can creates input file for the computational chemistry packages(CCP) cited above.\n" - "Gabedit can graphically display a variety of the CPP calculation results, including the following\n" - " - Molecular orbitals\n" - " - Surfaces from the electron density, electrostatic potential, NMR shielding density.....\n" - " - Contours (colorcoded), Planes colorcoded, Dipole. XYZ axes and the principal axes of the molecule.\n" - " - Animation of the normal modes corresponding to vibrational frequencies.\n" - " - Animation of the rotation of geometry, surfaces, contours, planes colorcoded.\n" + "Gabedit can graphically display a variety of the CCP calculation results\n" "Gabedit can display UV-Vis, IR and Raman computed spectra.\n" - "Gabedit can generate a povray file for geometry (including hydrogen's bond),\n" - "surfaces (including colorcoded surfaces), contours, planes colorcoded.\n" - "Gabedit can save picture in BMP, JPEG, PNG, PPM and PS format.\n" - "Gabedit can generate automatically a series of pictures for animation(vibration, geometry convergence, ....).\n" + "Gabedit can generate a povray file for geometry, surfaces, contours, planes colorcoded.\n" + "Gabedit can save picture in BMP, JPEG, PNG, PPM, PDF and PS format.\n" + "It can generate automatically a series of pictures for animation(vibration, geometry convergence, ....).\n" ) ); @@ -825,7 +819,7 @@ add_label(GTK_BOX(commands_network_page), _( - "To execute Gamess-US, Gaussian, Molcas, Molpro, \nMopac, MPQC, Orca, FireFly and Q-Chem program, " + "To execute Gamess-US, Gaussian, Molcas, Molpro, \nMopac, MPQC, NWChem, Orca, FireFly and Q-Chem program, " "GABEDIT needs to know commands system.\n" "GABEDIT needs to know network protocols.\n" "You can change them after installation (Settings/Preferences)." diff -Nru gabedit-2.3.7/src/Common/MenuToolBar.c gabedit-2.4.0/src/Common/MenuToolBar.c --- gabedit-2.3.7/src/Common/MenuToolBar.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Common/MenuToolBar.c 2011-09-22 14:25:07.000000000 +0000 @@ -150,6 +150,7 @@ else if(!strcmp(name,"MolproInput")) new_molpro(NULL, NULL); else if(!strcmp(name,"MopacInput")) new_mopac(NULL, NULL); else if(!strcmp(name,"MPQCInput")) new_mpqc(NULL, NULL); + else if(!strcmp(name,"NWChemInput")) new_nwchem(NULL, NULL); else if(!strcmp(name,"OrcaInput")) new_orca(NULL, NULL); else if(!strcmp(name,"FireFlyInput")) new_firefly(NULL, NULL); else if(!strcmp(name,"QChemInput")) new_qchem(NULL, NULL); @@ -200,6 +201,7 @@ else if(!strcmp(name,"ToolsIRSpectrumGabedit")) { createIRSpectrum(Fenetre,GABEDIT_TYPEFILE_GABEDIT);} else if(!strcmp(name,"ToolsIRSpectrumDalton")) { createIRSpectrum(Fenetre,GABEDIT_TYPEFILE_DALTON);} else if(!strcmp(name,"ToolsIRSpectrumGamess")) { createIRSpectrum(Fenetre,GABEDIT_TYPEFILE_GAMESS);} + else if(!strcmp(name,"ToolsIRSpectrumNWChem")) { createIRSpectrum(Fenetre,GABEDIT_TYPEFILE_NWCHEM);} else if(!strcmp(name,"ToolsIRSpectrumOrca")) { createIRSpectrum(Fenetre,GABEDIT_TYPEFILE_ORCA);} else if(!strcmp(name,"ToolsIRSpectrumFireFly")) { createIRSpectrum(Fenetre,GABEDIT_TYPEFILE_FIREFLY);} else if(!strcmp(name,"ToolsIRSpectrumGaussian")) { createIRSpectrum(Fenetre,GABEDIT_TYPEFILE_GAUSSIAN);} @@ -211,6 +213,7 @@ else if(!strcmp(name,"ToolsRamanSpectrumGabedit")) { createRamanSpectrum(Fenetre,GABEDIT_TYPEFILE_GABEDIT);} else if(!strcmp(name,"ToolsRamanSpectrumGamess")) { createRamanSpectrum(Fenetre,GABEDIT_TYPEFILE_GAMESS);} else if(!strcmp(name,"ToolsRamanSpectrumGaussian")) { createRamanSpectrum(Fenetre,GABEDIT_TYPEFILE_GAUSSIAN);} + else if(!strcmp(name,"ToolsRamanSpectrumNWChem")) { createRamanSpectrum(Fenetre,GABEDIT_TYPEFILE_NWCHEM);} else if(!strcmp(name,"ToolsRamanSpectrumOrca")) { createRamanSpectrum(Fenetre,GABEDIT_TYPEFILE_ORCA);} else if(!strcmp(name,"ToolsRamanSpectrumFireFly")) { createRamanSpectrum(Fenetre,GABEDIT_TYPEFILE_GAMESS);} else if(!strcmp(name,"ToolsRamanSpectrumMolden")) { createRamanSpectrum(Fenetre,GABEDIT_TYPEFILE_MOLDEN);} @@ -219,12 +222,14 @@ else if(!strcmp(name,"ToolsUVSpectrumGamess")) { createUVSpectrum(Fenetre,GABEDIT_TYPEFILE_GAMESS);} else if(!strcmp(name,"ToolsUVSpectrumGaussian")) { createUVSpectrum(Fenetre,GABEDIT_TYPEFILE_GAUSSIAN);} else if(!strcmp(name,"ToolsUVSpectrumFireFly")) { createUVSpectrum(Fenetre,GABEDIT_TYPEFILE_FIREFLY);} + else if(!strcmp(name,"ToolsUVSpectrumNWChem")) { createUVSpectrum(Fenetre,GABEDIT_TYPEFILE_NWCHEM);} else if(!strcmp(name,"ToolsUVSpectrumOrca")) { createUVSpectrum(Fenetre,GABEDIT_TYPEFILE_ORCA);} else if(!strcmp(name,"ToolsUVSpectrumQChem")) { createUVSpectrum(Fenetre,GABEDIT_TYPEFILE_QCHEM);} else if(!strcmp(name,"ToolsUVSpectrumTxt")) { createUVSpectrum(Fenetre,GABEDIT_TYPEFILE_TXT);} else if(!strcmp(name,"ToolsECDSpectrumGabedit")) { createECDSpectrum(Fenetre,GABEDIT_TYPEFILE_GABEDIT);} else if(!strcmp(name,"ToolsECDSpectrumGaussian")) { createECDSpectrum(Fenetre,GABEDIT_TYPEFILE_GAUSSIAN);} + else if(!strcmp(name,"ToolsECDSpectrumNWChem")) { createECDSpectrum(Fenetre,GABEDIT_TYPEFILE_NWCHEM);} else if(!strcmp(name,"ToolsECDSpectrumOrca")) { createECDSpectrum(Fenetre,GABEDIT_TYPEFILE_ORCA);} else if(!strcmp(name,"ToolsECDSpectrumTxt")) { createECDSpectrum(Fenetre,GABEDIT_TYPEFILE_TXT);} @@ -257,6 +262,7 @@ {"MolproInput", GABEDIT_STOCK_MOLPRO, N_("Mol_pro input"), NULL, "New Molpro input file", G_CALLBACK (activate_action) }, {"MopacInput", GABEDIT_STOCK_MOPAC, N_("_Mopac input"), NULL, "New Mopac input file", G_CALLBACK (activate_action) }, {"MPQCInput", GABEDIT_STOCK_MPQC, N_("MP_QC input"), NULL, "New MPQC input file", G_CALLBACK (activate_action) }, + {"NWChemInput", GABEDIT_STOCK_NWCHEM, N_("_NWChem input"), NULL, "New NWChem input file", G_CALLBACK (activate_action) }, {"OrcaInput", GABEDIT_STOCK_ORCA, N_("_Orca input"), NULL, "New Orca input file", G_CALLBACK (activate_action) }, {"FireFlyInput", GABEDIT_STOCK_FIREFLY, N_("_FireFly input"), NULL, "New FireFly input file", G_CALLBACK (activate_action) }, {"QChemInput", GABEDIT_STOCK_QCHEM, N_("Q-_Chem input"), NULL, "New Q-Chem input file", G_CALLBACK (activate_action) }, @@ -322,6 +328,7 @@ {"ToolsIRSpectrumGamess", GABEDIT_STOCK_GAMESS, N_("Read frequencies and intensities from a _Gamess output file"), NULL, "Gamess", G_CALLBACK (activate_action) }, {"ToolsIRSpectrumGaussian", GABEDIT_STOCK_GAUSSIAN, N_("Read frequencies and intensities from a _Gaussian output file"), NULL, "Gaussian", G_CALLBACK (activate_action) }, {"ToolsIRSpectrumMolpro", GABEDIT_STOCK_MOLPRO, N_("Read frequencies and intensities from a _Molpro output file"), NULL, "Molpro", G_CALLBACK (activate_action) }, + {"ToolsIRSpectrumNWChem", GABEDIT_STOCK_NWCHEM, N_("Read frequencies and intensities from a _NWChem output file"), NULL, "NWChem", G_CALLBACK (activate_action) }, {"ToolsIRSpectrumOrca", GABEDIT_STOCK_ORCA, N_("Read frequencies and intensities from a _Orca output file"), NULL, "Orca", G_CALLBACK (activate_action) }, {"ToolsIRSpectrumFireFly", GABEDIT_STOCK_FIREFLY, N_("Read frequencies and intensities from a _FireFly output file"), NULL, "FireFly", G_CALLBACK (activate_action) }, {"ToolsIRSpectrumQChem", GABEDIT_STOCK_QCHEM, N_("Read frequencies and intensities from a _Q-Chem output file"), NULL, "QChem", G_CALLBACK (activate_action) }, @@ -333,6 +340,7 @@ {"ToolsRamanSpectrumGabedit", GABEDIT_STOCK_GABEDIT, N_("Read frequencies and intensities from a _Gabedit file"), NULL, "Gabedit", G_CALLBACK (activate_action) }, {"ToolsRamanSpectrumGamess", GABEDIT_STOCK_GAMESS, N_("Read frequencies and intensities from a Game_ss output file"), NULL, "Gamess", G_CALLBACK (activate_action) }, {"ToolsRamanSpectrumGaussian", GABEDIT_STOCK_GAUSSIAN, N_("Read frequencies and intensities from a _Gaussian output file"), NULL, "Gaussian", G_CALLBACK (activate_action) }, + {"ToolsRamanSpectrumNWChem", GABEDIT_STOCK_NWCHEM, N_("Read frequencies and intensities from a _NWChem output file"), NULL, "NWChem", G_CALLBACK (activate_action) }, {"ToolsRamanSpectrumOrca", GABEDIT_STOCK_ORCA, N_("Read frequencies and intensities from a _Orca output file"), NULL, "Orca", G_CALLBACK (activate_action) }, {"ToolsRamanSpectrumFireFly", GABEDIT_STOCK_FIREFLY, N_("Read frequencies and intensities from a _FireFly output file"), NULL, "FireFly", G_CALLBACK (activate_action) }, {"ToolsRamanSpectrumMolden", GABEDIT_STOCK_MOLDEN, N_("Read frequencies and intensities from a Mo_lden file"), NULL, "Molden", G_CALLBACK (activate_action) }, @@ -342,6 +350,7 @@ {"ToolsUVSpectrumGamess", GABEDIT_STOCK_GAMESS, N_("Read energies and intensities from a _Gamess output file"), NULL, "Gamess", G_CALLBACK (activate_action) }, {"ToolsUVSpectrumGaussian", GABEDIT_STOCK_GAUSSIAN, N_("Read energies and intensities from a _Gaussian output file"), NULL, "Gaussian", G_CALLBACK (activate_action) }, {"ToolsUVSpectrumFireFly", GABEDIT_STOCK_FIREFLY, N_("Read energies and intensities from a _FireFly output file"), NULL, "FireFly", G_CALLBACK (activate_action) }, + {"ToolsUVSpectrumNWChem", GABEDIT_STOCK_NWCHEM, N_("Read energies and intensities from a NWChem output file"), NULL, "NWChem", G_CALLBACK (activate_action) }, {"ToolsUVSpectrumOrca", GABEDIT_STOCK_ORCA, N_("Read energies and intensities from a Orca output file"), NULL, "Orca", G_CALLBACK (activate_action) }, {"ToolsUVSpectrumQChem", GABEDIT_STOCK_QCHEM, N_("Read energies and intensities from a Q_Chem output file"), NULL, "QChem", G_CALLBACK (activate_action) }, {"ToolsUVSpectrumTxt", NULL, N_("Read energies and intensities from an ASCII XY file(2 columns)"), NULL, "Txt", G_CALLBACK (activate_action) }, @@ -349,6 +358,7 @@ {"ToolsECDSpectrum", NULL, N_("_ECD spectrum")}, {"ToolsECDSpectrumGabedit", GABEDIT_STOCK_GABEDIT, N_("Read energies and intensities from a _Gabedit file"), NULL, "Gabedit", G_CALLBACK (activate_action) }, {"ToolsECDSpectrumGaussian", GABEDIT_STOCK_GAUSSIAN, N_("Read energies and intensities from a _Gaussian output file"), NULL, "Gaussian", G_CALLBACK (activate_action) }, + {"ToolsECDSpectrumNWChem", GABEDIT_STOCK_NWCHEM, N_("Read energies and intensities from a _NWChem output file"), NULL, "NWChem", G_CALLBACK (activate_action) }, {"ToolsECDSpectrumOrca", GABEDIT_STOCK_ORCA, N_("Read energies and intensities from a _Orca output file"), NULL, "Orca", G_CALLBACK (activate_action) }, {"ToolsECDSpectrumTxt", NULL, N_("Read energies and intensities from an ASCII XY file(2 columns)"), NULL, "Txt", G_CALLBACK (activate_action) }, @@ -417,6 +427,7 @@ " \n" " \n" " \n" +" \n" " \n" " \n" " \n" @@ -503,6 +514,7 @@ " \n" " \n" " \n" +" \n" " \n" " \n" " \n" @@ -515,6 +527,7 @@ " \n" " \n" " \n" +" \n" " \n" " \n" " \n" @@ -525,6 +538,7 @@ " \n" " \n" " \n" +" \n" " \n" " \n" " \n" @@ -534,6 +548,7 @@ " \n" " \n" " \n" +" \n" " \n" " \n" " \n" @@ -584,6 +599,7 @@ " \n" " \n" " \n" +" \n" " \n" " \n" " \n" diff -Nru gabedit-2.3.7/src/Common/Preferences.c gabedit-2.4.0/src/Common/Preferences.c --- gabedit-2.3.7/src/Common/Preferences.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Common/Preferences.c 2011-09-22 14:25:07.000000000 +0000 @@ -55,6 +55,7 @@ static GtkWidget *EntryFireFly = NULL; static GtkWidget *EntryQChem = NULL; static GtkWidget *EntryOrca = NULL; +static GtkWidget *EntryNWChem = NULL; static GtkWidget *ComboGamess = NULL; static GtkWidget *ComboGaussian = NULL; @@ -66,6 +67,7 @@ static GtkWidget *ComboFireFly = NULL; static GtkWidget *ComboQChem = NULL; static GtkWidget *ComboOrca = NULL; +static GtkWidget *ComboNWChem = NULL; static GtkWidget *ButtonGamess = NULL; static GtkWidget *ButtonGaussian = NULL; @@ -77,6 +79,7 @@ static GtkWidget *ButtonFireFly = NULL; static GtkWidget *ButtonQChem = NULL; static GtkWidget *ButtonOrca = NULL; +static GtkWidget *ButtonNWChem = NULL; static GtkWidget *EntryBatchType = NULL; GtkWidget *selectors[3]; @@ -889,6 +892,92 @@ gtk_widget_set_sensitive(ButtonOrca, TRUE); } /********************************************************************************/ +static void remove_nwchem_command() +{ + G_CONST_RETURN gchar *strcom; + GList *glist = NULL; + gint i; + gint inList = -1; + + if(nwchemCommands.numberOfCommands<2) + return; + + strcom = gtk_entry_get_text (GTK_ENTRY (EntryNWChem)); + + for(i=0;i=0;i--) + glist = g_list_append(glist,nwchemCommands.commands[i]); + + gtk_combo_box_entry_set_popdown_strings( ComboNWChem, glist) ; + + g_list_free(glist); + if(nwchemCommands.numberOfCommands<2) + gtk_widget_set_sensitive(ButtonNWChem, FALSE); + else + gtk_widget_set_sensitive(ButtonNWChem, TRUE); +} +/********************************************************************************/ static void remove_povray_command() { G_CONST_RETURN gchar *strcom; @@ -1700,7 +1789,7 @@ if(orcaDirectory) g_free(orcaDirectory); orcaDirectory = g_strdup(dirname); - t = g_strdup_printf("%s;%cPATH%c",orcaDirectory,'%','%'); + t = g_strdup_printf("%s;%s",orcaDirectory,g_getenv("PATH")); g_setenv("PATH",t,TRUE); g_free(t); } @@ -1720,6 +1809,40 @@ gtk_widget_show(dirSelector); } /********************************************************************************/ +static void set_entry_nwchemdir(GtkWidget* dirSelector, gint response_id) +{ + gchar* dirname = NULL; + gchar* t = NULL; + GtkWidget *entry; + if(response_id != GTK_RESPONSE_OK) return; + dirname = gabedit_folder_chooser_get_current_folder(GABEDIT_FOLDER_CHOOSER(dirSelector)); + + + entry = (GtkWidget*)(g_object_get_data(G_OBJECT(dirSelector),"EntryFile")); + gtk_entry_set_text(GTK_ENTRY(entry),dirname); + + if(nwchemDirectory) g_free(nwchemDirectory); + nwchemDirectory = g_strdup(dirname); + t = g_strdup_printf("%s;%s",nwchemDirectory,g_getenv("PATH")); + g_setenv("PATH",t,TRUE); + g_free(t); +} +/********************************************************************************/ +static void set_entry_nwchemDir_selection(GtkWidget* entry) +{ + GtkWidget *dirSelector; + dirSelector = selctionOfDir(set_entry_nwchemdir, _("Select NWChem folder"), GABEDIT_TYPEWIN_ORB); + gtk_window_set_modal (GTK_WINDOW (dirSelector), TRUE); + g_signal_connect(G_OBJECT(dirSelector),"delete_event", (GCallback)gtk_widget_destroy,NULL); + + g_object_set_data(G_OBJECT (dirSelector), "EntryFile", entry); + + g_signal_connect (dirSelector, "response", G_CALLBACK (set_entry_nwchemdir), GTK_OBJECT(dirSelector)); + g_signal_connect (dirSelector, "response", G_CALLBACK (gtk_widget_destroy), GTK_OBJECT(dirSelector)); + + gtk_widget_show(dirSelector); +} +/********************************************************************************/ static void set_entry_fireflydir(GtkWidget* dirSelector, gint response_id) { gchar* dirname = NULL; @@ -1734,7 +1857,7 @@ if(fireflyDirectory) g_free(fireflyDirectory); fireflyDirectory = g_strdup(dirname); - t = g_strdup_printf("%s;%cPATH%c",fireflyDirectory,'%','%'); + t = g_strdup_printf("%s;%s",fireflyDirectory,g_getenv("PATH")); g_setenv("PATH",t,TRUE); g_free(t); } @@ -1768,7 +1891,7 @@ if(mopacDirectory) g_free(mopacDirectory); mopacDirectory = g_strdup(dirname); - t = g_strdup_printf("%s;%cPATH%c",mopacDirectory,'%','%'); + t = g_strdup_printf("%s;%s",mopacDirectory,g_getenv("PATH")); g_setenv("PATH",t,TRUE); g_free(t); } @@ -1802,7 +1925,7 @@ if(povrayDirectory) g_free(povrayDirectory); povrayDirectory = g_strdup(dirname); - t = g_strdup_printf("%s;%cPATH%c",povrayDirectory,'%','%'); + t = g_strdup_printf("%s;%s",povrayDirectory,g_getenv("PATH")); g_setenv("PATH",t,TRUE); g_free(t); } @@ -1836,7 +1959,7 @@ if(gaussDirectory) g_free(gaussDirectory); gaussDirectory = g_strdup(dirname); - t = g_strdup_printf("%s;%cPATH%c",gaussDirectory,'%','%'); + t = g_strdup_printf("%s;%s",gaussDirectory,g_getenv("PATH")); g_setenv("PATH",t,TRUE); g_free(t); } @@ -2039,6 +2162,30 @@ g_signal_connect(G_OBJECT(button), "clicked",G_CALLBACK(help_commands),NULL); create_hseparator(vbox); + hbox = gtk_hbox_new (FALSE, 0); +/* ------------------------------------------------------------------*/ + gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3); + label = gtk_label_new (_("Command for execute NWChem : ")); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 3); + + combo = create_combo_box_entry(nwchemCommands.commands,nwchemCommands.numberOfCommands,TRUE,-1,-1); + ComboNWChem = combo; + EntryNWChem = GTK_BIN(combo)->child; + gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 3); + gtk_entry_set_text (GTK_ENTRY (EntryNWChem),NameCommandNWChem); + g_signal_connect(G_OBJECT (EntryNWChem), "activate", (GCallback)modify_nwchem_command, NULL); + button = create_button(Wins,_(" Remove from list ")); + ButtonNWChem = button; + gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 3); + if(nwchemCommands.numberOfCommands<2) + gtk_widget_set_sensitive(button, FALSE); + g_signal_connect(G_OBJECT(button), "clicked",G_CALLBACK(remove_nwchem_command),NULL); + + button = create_button(Wins,_(" Help ")); + gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 3); + g_signal_connect(G_OBJECT(button), "clicked",G_CALLBACK(help_commands),NULL); + + create_hseparator(vbox); /* ------------------------------------------------------------------*/ hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3); @@ -2263,6 +2410,50 @@ #endif #ifdef G_OS_WIN32 /********************************************************************************/ +void create_nwchem_directory(GtkWidget *Wins,GtkWidget *vbox,gboolean expand) +{ + GtkWidget *frame; + GtkWidget *button; + + frame = gtk_frame_new (NULL); + gtk_widget_show (frame); + gtk_box_pack_start (GTK_BOX (vbox), frame, expand, expand, 0); + gtk_frame_set_label_align (GTK_FRAME (frame), 0.5, 0.5); + + vbox = gtk_vbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (frame), vbox); + + + { + GtkWidget* entry; + GtkWidget *table = gtk_table_new(1,3,FALSE); + + if(!nwchemDirectory) nwchemDirectory = g_strdup_printf("%s",g_get_home_dir()); + + gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); + + add_label_table(table,_("NWChem directory : "),0,0); + entry = gtk_entry_new (); + gtk_widget_set_size_request(GTK_WIDGET(entry),-1,32); + gtk_table_attach(GTK_TABLE(table),entry,1,1+1,0,0+1, + (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), + (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), + 3,3); + gtk_entry_set_text (GTK_ENTRY (entry),nwchemDirectory); + gtk_editable_set_editable((GtkEditable*)entry,FALSE); + gtk_widget_set_sensitive(entry, FALSE); + button = create_button_pixmap(Wins,open_xpm,NULL); + GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); + g_signal_connect_swapped(GTK_OBJECT (button), "clicked", + G_CALLBACK(set_entry_nwchemDir_selection), + GTK_OBJECT(entry)); + add_widget_table(table,button,0,2); + } + gtk_widget_show_all(frame); +} +#endif +#ifdef G_OS_WIN32 +/********************************************************************************/ void create_firefly_directory(GtkWidget *Wins,GtkWidget *vbox,gboolean expand) { GtkWidget *frame; @@ -2510,7 +2701,7 @@ /*if(strcmp(dirname,pscpplinkDirectory)!=0)*/ { - gchar* t = g_strdup_printf("%s;%cPATH%c",dirname,'%','%'); + gchar* t = g_strdup_printf("%s;%s",dirname,g_getenv("PATH")); g_setenv("PATH",t,TRUE); g_free(t); } @@ -2654,6 +2845,7 @@ #ifdef G_OS_WIN32 create_gamess_directory(Wins,vbox,FALSE); create_orca_directory(Wins,vbox,FALSE); + create_nwchem_directory(Wins,vbox,FALSE); create_firefly_directory(Wins,vbox,FALSE); create_mopac_directory(Wins,vbox,FALSE); create_gauss_directory(Wins,vbox,FALSE); @@ -2886,9 +3078,10 @@ GtkWidget* combo; GtkWidget *table = gtk_table_new(2,5,FALSE); static gchar* typeButton[] = {"RGBA","DOUBLEBUFFER" ,"ALPHASIZE","DEPTHSIZE"}; - static gchar* values[] = {"5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30"}; + static gchar* values[] = {"5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","40","50","60","80","100"}; static gchar* typeEntry[] = {"CYLINDER","SPHERE"}; gushort i; + gint nv = sizeof(values)/sizeof(gchar*); frame = gtk_frame_new (_("OpenGL Options")); @@ -2906,7 +3099,7 @@ i = 0; add_label_table(table,_(" Number Of Subdivisions for a Cylinder "),i,0); add_label_table(table," : ",i,1); - combo = create_combo_box_entry(values,26,TRUE,-1,-1); + combo = create_combo_box_entry(values,nv,TRUE,-1,-1); EntryCylinder = GTK_BIN(combo)->child; add_widget_table(table,combo,i,2); gtk_editable_set_editable((GtkEditable*)EntryCylinder,FALSE); @@ -2916,7 +3109,7 @@ i = 1; add_label_table(table,_(" Number Of Subdivisions for a Sphere "),i,0); add_label_table(table," : ",i,1); - combo = create_combo_box_entry(values,26,TRUE,-1,-1); + combo = create_combo_box_entry(values,nv,TRUE,-1,-1); EntrySphere = GTK_BIN(combo)->child; add_widget_table(table,combo,i,2); gtk_editable_set_editable((GtkEditable*)EntrySphere,FALSE); diff -Nru gabedit-2.3.7/src/Common/Run.c gabedit-2.4.0/src/Common/Run.c --- gabedit-2.3.7/src/Common/Run.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Common/Run.c 2011-09-22 14:25:07.000000000 +0000 @@ -53,6 +53,7 @@ static GtkWidget* ButtonMolpro = NULL; static GtkWidget* ButtonMPQC = NULL; static GtkWidget* ButtonOrca = NULL; +static GtkWidget* ButtonNWChem = NULL; static GtkWidget* ButtonFireFly = NULL; static GtkWidget* ButtonQChem = NULL; static GtkWidget* ButtonMopac = NULL; @@ -137,6 +138,8 @@ #ifdef G_OS_WIN32 /*************************************************************************************************************/ static gchar* listLocalGamess[] = { + "gamess.11-32.exe 1", + "gamess.11-64.exe 1", "gamess.00.exe", "gamess.01.exe", "gamess.02.exe", "gamess.03.exe", "gamess.04.exe", "gamess.05.exe", "gamess.06.exe", "gamess.07.exe", "gamess.08.exe", "gamess.09.exe" }; @@ -160,7 +163,7 @@ if(fileopen.command && !strstr(fileopen.command,"exe")) { if(fileopen.command) g_free(fileopen.command); - fileopen.command = g_strdup("gamess.05.exe"); + fileopen.command = g_strdup("gamess.11-32.exe"); } } else @@ -282,6 +285,22 @@ iprogram = PROG_IS_ORCA; } else + if(button == ButtonNWChem ) + { + for(i=0;i0) + gtk_entry_set_text (GTK_ENTRY (EntryCommand), fileopen.command); + gtk_label_set_text(GTK_LABEL(LabelExtFile), ".nw"); + gtk_widget_show(LabelDataFile); + iprogram = PROG_IS_NWCHEM; + } + else if(button == ButtonQChem ) { for(i=0;i parameters.gms\n",'%','%'); + fprintf(file,"echo AUXDATADIR=%cAUXDATADIR%c>> parameters.gms\n",'%','%'); + fprintf(file,"echo RESTARTDIR=%cRESTARTDIR%c>> parameters.gms\n",'%','%'); + fprintf(file,"echo SCRARTCHDIR=%cSCRATCHDIR%c>> parameters.gms\n",'%','%'); + fflush(file); + + fprintf(file,"mkdir %cRESTARTDIR%c\n",'%','%'); + fprintf(file,"mkdir %cSCRATCHDIR%c\n",'%','%'); + fflush(file); + + if(strstr(command,"11-64")) + fprintf(file,"%s\\rungms.bat %c~n1.inp 11-64 %d 0 %cnameLog%c\n",gamessDirectory,'%',nproc,'%','%'); + else + fprintf(file,"%s\\rungms.bat %c~n1.inp 11-32 %d 0 %cnameLog%c\n",gamessDirectory,'%',nproc,'%','%'); + + fprintf(file,"del/S/F/P %cRESTARTDIR%c\n",'%','%'); + fprintf(file,"rmdir %cRESTARTDIR%c\n",'%','%'); + fprintf(file,"del/S/F/P %cSCRATCHDIR%c\n",'%','%'); + fprintf(file,"rmdir %cSCRATCHDIR%c\n",'%','%'); + + fclose(file); + return TRUE; +} #endif /***********************************************************************************************************/ static gboolean create_cmd_firefly(G_CONST_RETURN gchar* command, gboolean local, gchar* cmddir, gchar* cmdfile, gchar* cmdall) @@ -1067,6 +1131,79 @@ return TRUE; } /***********************************************************************************************************/ +static gboolean create_cmd_nwchem(G_CONST_RETURN gchar* command, gboolean local, gchar* cmddir, gchar* cmdfile, gchar* cmdall) +{ + FILE* fcmd = NULL; + gchar* commandStr = g_strdup(command); +#ifndef G_OS_WIN32 + gchar buffer[BSIZE]; +#endif + delete_last_spaces(commandStr); + delete_first_spaces(commandStr); + + if(local) + sprintf(cmddir,"%s", fileopen.localdir); + else + sprintf(cmddir,"%s%stmp", gabedit_directory(), G_DIR_SEPARATOR_S); + +#ifndef G_OS_WIN32 + sprintf(cmdfile,"%s.cmd", fileopen.projectname); +#else + if(!local) sprintf(cmdfile,"%s.cmd", fileopen.projectname); + else sprintf(cmdfile,"%s.bat", fileopen.projectname); +#endif + sprintf(cmdall,"%s%s%s",cmddir,G_DIR_SEPARATOR_S,cmdfile); + + fcmd = FOpen(cmdall, "w"); + if(!fcmd) + { + if(local) Message(_("\nI can not create cmd file\n"),_("Error"),TRUE); + return FALSE; + } +#ifndef G_OS_WIN32 + fprintf(fcmd,"#!/bin/sh\n"); +#else + if(local) + { + if(strstr(nwchemDirectory,"\"")) fprintf(fcmd,"set PATH=%s;%cPATH%c\n",nwchemDirectory,'%','%'); + else fprintf(fcmd,"set PATH=\"%s\";%cPATH%c\n",nwchemDirectory,'%','%'); + } +#endif + + if(local) + { +#ifdef G_OS_WIN32 + addUnitDisk(fcmd, fileopen.localdir); +#endif + fprintf(fcmd,"cd %s\n", fileopen.localdir); + } + else fprintf(fcmd,"cd %s\n", fileopen.remotedir); + + + if(!strcmp(commandStr,"nwchem") || !strcmp(commandStr,"nohup nwchem")) + { +#ifdef G_OS_WIN32 + fprintf(fcmd,"del %s.db\n",fileopen.projectname); +#else + fprintf(fcmd,"rm -f %s.db\n",fileopen.projectname); +#endif + fprintf(fcmd,"%s %s > %s.out &\n",command,fileopen.datafile,fileopen.projectname); + fprintf(fcmd,"exit\n"); + } + else + { + fprintf(fcmd,"%s %s &\n",command,fileopen.datafile); + fprintf(fcmd,"exit\n"); + } + fclose(fcmd); +#ifndef G_OS_WIN32 + sprintf(buffer,"chmod u+x %s",cmdall); + system(buffer); +#endif + if(commandStr) g_free(commandStr); + return TRUE; +} +/***********************************************************************************************************/ static gboolean create_cmd_qchem(G_CONST_RETURN gchar* command, gboolean local, gchar* cmddir, gchar* cmdfile, gchar* cmdall) { FILE* fcmd = NULL; @@ -1375,6 +1512,8 @@ if(!createGamessCsh(buffer)) return FALSE; } + if(!strstr(command,"11-")) + { winsockCheck(stderr); gethostname(localhost,100); fprintf(fcmd,"@echo off\n"); @@ -1399,6 +1538,19 @@ gamessDirectory,fileopen.projectname, fileopen.localdir,fileopen.projectname); fprintf(fcmd,_("echo Job %s.inp finished.\n"),fileopen.projectname); + } + else + { + gchar com[BSIZE]; + gint nproc = 0; + gchar buffer[BSIZE]; + sprintf(buffer,"%s\\gabeditRunGms.csh",gamessDirectory); + sprintf(buffer,"%s%sgabeditRun.bat",cmddir,G_DIR_SEPARATOR_S); + sscanf(command,"%s %d",com,&nproc); + if(nproc<1) nproc = 1; + if(!createGamessBat(buffer,com,nproc)) return FALSE; + fprintf(fcmd,"%s %s\n",buffer,fileopen.datafile); + } } #endif @@ -2019,6 +2171,153 @@ g_free(ferr); } /********************************************************************************/ +static void run_remote_nwchem(GtkWidget *b,gpointer data) +{ + gchar *fout = g_strdup_printf("%s%stmp%sfout",gabedit_directory(),G_DIR_SEPARATOR_S,G_DIR_SEPARATOR_S); + gchar *ferr = g_strdup_printf("%s%stmp%sferr",gabedit_directory(),G_DIR_SEPARATOR_S,G_DIR_SEPARATOR_S); + + gchar cmdfile[BSIZE]; + gchar cmddir[BSIZE]; + gchar cmdall[BSIZE]; + + GtkWidget* Win; + GtkWidget* Text[2]; + GtkWidget* Frame[2]; + gchar *temp; + gchar *NomFichier; + gchar *Command; + GtkWidget **entryall; + GtkWidget *entry; + G_CONST_RETURN gchar *entrytext0; + gchar *entrytext; + gchar* title; + gint code = 0; + G_CONST_RETURN gchar *localdir; + + + entryall=(GtkWidget **)data; + entry=entryall[0]; + entrytext0 = gtk_entry_get_text(GTK_ENTRY(entry)); + localdir = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER(buttonDirSelector)); + entrytext = get_dir_file_name(localdir,entrytext0); + + temp = get_suffix_name_file(entrytext); + fileopen.projectname = get_name_file(temp); + fileopen.localdir = get_name_dir(temp); + g_free(temp); + fileopen.datafile = g_strdup_printf("%s.nw",fileopen.projectname); + fileopen.outputfile=g_strdup_printf("%s.out",fileopen.projectname); + fileopen.logfile=g_strdup_printf("%s.out",fileopen.projectname); + fileopen.moldenfile=g_strdup_printf("%s.out",fileopen.projectname); + + fileopen.remotehost = g_strdup(gtk_entry_get_text(GTK_ENTRY(entryall[2]))); + fileopen.remoteuser = g_strdup(gtk_entry_get_text(GTK_ENTRY(entryall[3]))); + fileopen.remotepass = g_strdup(gtk_entry_get_text(GTK_ENTRY(entryall[4]))); + fileopen.remotedir = g_strdup(gtk_entry_get_text(GTK_ENTRY(entryall[5]))); + fileopen.command = g_strdup(gtk_entry_get_text(GTK_ENTRY(entryall[1]))); + + /* fileopen.netWorkProtocol Deja defini dans run_program*/ + +/* Debug("remote nwchem : %s %s %s\n",fileopen.remotehost,fileopen.remoteuser,fileopen.remotedir);*/ + + /* save file */ + NomFichier = g_strdup_printf("%s%s%s",fileopen.localdir,G_DIR_SEPARATOR_S,fileopen.datafile); + + CreeFeuille(treeViewProjects, noeud[GABEDIT_TYPENODE_NWCHEM],fileopen.projectname,fileopen.datafile,fileopen.localdir, + fileopen.remotehost,fileopen.remoteuser,fileopen.remotepass,fileopen.remotedir,GABEDIT_TYPENODE_NWCHEM, fileopen.command, fileopen.netWorkProtocol); + add_host(fileopen.remotehost,fileopen.remoteuser,fileopen.remotepass,fileopen.remotedir); + +/* Save file in local host */ + if(!save_local_doc(NomFichier)) return; + + data_modify(FALSE); + + entry=entryall[1]; + entrytext0 = gtk_entry_get_text(GTK_ENTRY(entry)); + + title = g_strdup_printf(_("Run NWChem at host :%s, Login : %s"),fileopen.remotehost,fileopen.remoteuser); + Win = create_text_result_command(Text,Frame,title); + g_free(title); + gtk_widget_show_all(Win); + while( gtk_events_pending() ) gtk_main_iteration(); + gtk_widget_set_sensitive(Win, FALSE); + + if(!this_is_a_backspace(fileopen.remotedir)) + { + /* Make Working directory */ + /* Debug("Make dir remote nwchem : %s %s %s\n",fileopen.remotehost,fileopen.remoteuser,fileopen.remotedir);*/ + Command = g_strdup_printf("mkdir %s",fileopen.remotedir); + /*rsh (fout,ferr,Command,fileopen.remoteuser,fileopen.remotehost);*/ + remote_command (fout,ferr,Command,fileopen.remotehost,fileopen.remoteuser,fileopen.remotepass); + g_free(Command); + gabedit_text_insert (GABEDIT_TEXT(Text[0]), NULL, NULL, NULL,_("\nMake Working Directory remote host :\n "),-1); + gabedit_text_insert (GABEDIT_TEXT(Text[1]), NULL, NULL, NULL,_("\nMake Working Directory remote host :\n "),-1); + put_text_in_texts_widget(Text,fout,ferr); + while( gtk_events_pending() ) + gtk_main_iteration(); + } + + if(code == 0) + { + /* put file.com */ + /* Debug("Put File remote nwchem : %s %s %s\n",fileopen.remotehost,fileopen.remoteuser,fileopen.remotedir);*/ + code = put_file(fout,ferr,fileopen.datafile,fileopen.localdir,fileopen.remotedir, + fileopen.remotehost,fileopen.remoteuser,fileopen.remotepass); + gabedit_text_insert (GABEDIT_TEXT(Text[0]), NULL, NULL, NULL,_("\nPut Data File at remote host :\n "),-1); + gabedit_text_insert (GABEDIT_TEXT(Text[1]), NULL, NULL, NULL,_("\nPut Data File at remote host :\n "),-1); + put_text_in_texts_widget(Text,fout,ferr); + while( gtk_events_pending() ) + gtk_main_iteration(); + } + if( code==0 ) + { + if(!create_cmd_nwchem(entrytext0, FALSE, cmddir, cmdfile, cmdall)) + { + gabedit_text_insert (GABEDIT_TEXT(Text[1]), NULL, NULL, NULL,_("\nI can not create cmd file\n"),-1); + gtk_widget_set_sensitive(Win, TRUE); + return; + } + code = 0; + + } + if(code == 0) + { + code = put_file(fout,ferr,cmdfile,cmddir,"./", + fileopen.remotehost,fileopen.remoteuser,fileopen.remotepass); + gabedit_text_insert (GABEDIT_TEXT(Text[0]), NULL, NULL, NULL,_("\nPut CMD File at remote host :\n "),-1); + gabedit_text_insert (GABEDIT_TEXT(Text[1]), NULL, NULL, NULL,_("\nPut CMD File at remote host :\n "),-1); + put_text_in_texts_widget(Text,fout,ferr); + unlink(cmdall); + while( gtk_events_pending() ) + gtk_main_iteration(); + } + if(code == 0) + { + Command = g_strdup_printf("chmod u+x %s",cmdfile); + /*rsh (fout,ferr,Command,fileopen.remoteuser,fileopen.remotehost);*/ + remote_command (fout,ferr,Command,fileopen.remotehost,fileopen.remoteuser,fileopen.remotepass); + gabedit_text_insert (GABEDIT_TEXT(Text[0]), NULL, NULL, NULL,_("\nchmod for cmd file :\n"),-1); + gabedit_text_insert (GABEDIT_TEXT(Text[1]), NULL, NULL, NULL,_("\nchmod for cmd file :\n"),-1); + put_text_in_texts_widget(Text,fout,ferr); + while( gtk_events_pending() ) + gtk_main_iteration(); + } + if(code == 0) + { + Command = g_strdup_printf("./%s>/dev/null&",cmdfile); + remote_command (fout,ferr,Command,fileopen.remotehost,fileopen.remoteuser,fileopen.remotepass); + gabedit_text_insert (GABEDIT_TEXT(Text[0]), NULL, NULL, NULL,_("\nRun NWChem at remote host :\n"),-1); + gabedit_text_insert (GABEDIT_TEXT(Text[1]), NULL, NULL, NULL,_("\nRun NWChem at remote host :\n"),-1); + put_text_in_texts_widget(Text,fout,ferr); + while( gtk_events_pending() ) + gtk_main_iteration(); + } + gtk_widget_set_sensitive(Win, TRUE); + + g_free(fout); + g_free(ferr); +} +/********************************************************************************/ static void run_remote_firefly(GtkWidget *b,gpointer data) { gchar *fout = g_strdup_printf("%s%stmp%sfout",gabedit_directory(),G_DIR_SEPARATOR_S,G_DIR_SEPARATOR_S); @@ -3467,6 +3766,110 @@ g_free(ferr); } /********************************************************************************/ +static void run_local_nwchem(GtkWidget *b,gpointer data) +{ +#ifdef G_OS_WIN32 + gchar *fout = g_strdup_printf("\"%s%stmp%sfout\"",gabedit_directory(),G_DIR_SEPARATOR_S,G_DIR_SEPARATOR_S); + gchar *ferr = g_strdup_printf("\"%s%stmp%sferr\"",gabedit_directory(),G_DIR_SEPARATOR_S,G_DIR_SEPARATOR_S); +#else + gchar *fout = g_strdup_printf("%s%stmp%sfout",gabedit_directory(),G_DIR_SEPARATOR_S,G_DIR_SEPARATOR_S); + gchar *ferr = g_strdup_printf("%s%stmp%sferr",gabedit_directory(),G_DIR_SEPARATOR_S,G_DIR_SEPARATOR_S); +#endif + + GtkWidget* Win; + GtkWidget* Text[2]; + GtkWidget* Frame[2]; + gchar *strout; + gchar *strerr; + gchar *temp; + gchar *NomFichier; + gchar Command[BSIZE]; + GtkWidget **entryall; + GtkWidget *entry; + G_CONST_RETURN gchar *entrytext0; + gchar *entrytext; + gchar* title; + G_CONST_RETURN gchar *localdir; + gchar cmdFileAllName[BSIZE]; + gchar cmdDir[BSIZE]; + gchar cmdFile[BSIZE]; + + + unlink(fout); + unlink(ferr); + + entryall=(GtkWidget **)data; + entry=entryall[0]; + entrytext0 = gtk_entry_get_text(GTK_ENTRY(entry)); + localdir = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER(buttonDirSelector)); + entrytext = get_dir_file_name(localdir,entrytext0); + + temp = get_suffix_name_file(entrytext); + fileopen.projectname = get_name_file(temp); + fileopen.localdir = get_name_dir(temp); + g_free(temp); + fileopen.datafile = g_strdup_printf("%s.nw",fileopen.projectname); + fileopen.outputfile=g_strdup_printf("%s.out",fileopen.projectname); + fileopen.logfile=g_strdup_printf("%s.out",fileopen.projectname); + fileopen.moldenfile=g_strdup_printf("%s.out",fileopen.projectname); + fileopen.remotehost = NULL; + fileopen.remoteuser = NULL; + fileopen.remotedir = NULL; + + /* save file */ + NomFichier = g_strdup_printf("%s%s%s",fileopen.localdir,G_DIR_SEPARATOR_S,fileopen.datafile); + + fileopen.remotehost = NULL; + fileopen.remoteuser = NULL; + fileopen.remotepass = NULL; + fileopen.remotedir = NULL; + fileopen.command = g_strdup(gtk_entry_get_text(GTK_ENTRY(entryall[1]))); + CreeFeuille(treeViewProjects, noeud[GABEDIT_TYPENODE_NWCHEM],fileopen.projectname,fileopen.datafile,fileopen.localdir, + fileopen.remotehost,fileopen.remoteuser,fileopen.remotepass,fileopen.remotedir,GABEDIT_TYPENODE_NWCHEM, fileopen.command, fileopen.netWorkProtocol); + +/* Save file in local host */ + if(!save_local_doc(NomFichier)) return; + + data_modify(FALSE); + + entry=entryall[1]; + entrytext0 = gtk_entry_get_text(GTK_ENTRY(entry)); + + if(!create_cmd_nwchem(entrytext0, TRUE, cmdDir, cmdFile, cmdFileAllName)) return; +#ifdef G_OS_WIN32 + sprintf(Command ,"\"%s\"",cmdFileAllName); +#else + sprintf(Command ,"%s",cmdFileAllName); +#endif + + run_local_command(fout,ferr,Command,TRUE); + title = g_strdup_printf(_("Run NWChem in local : %s"),Command); + Win = create_text_result_command(Text,Frame,title); + g_free(title); + strout = cat_file(fout,FALSE); + strerr = cat_file(ferr,FALSE); + if(!strout && !strerr) + destroy_children(Win); + else + { + if(strout) + { + gabedit_text_insert (GABEDIT_TEXT(Text[0]), NULL, NULL, NULL,strout,-1); + g_free(strout); + } + if(strerr) + { + gabedit_text_insert (GABEDIT_TEXT(Text[1]), NULL, NULL, NULL,strerr,-1); + g_free(strerr); + } + gtk_widget_show_all(Win); + if(!strout) + gtk_widget_hide(Frame[0]); + } + g_free(fout); + g_free(ferr); +} +/********************************************************************************/ static void run_local_firefly(GtkWidget *b,gpointer data) { #ifdef G_OS_WIN32 @@ -4455,6 +4858,7 @@ else if (GTK_TOGGLE_BUTTON (ButtonMPQC)->active) run_local_mpqc(NULL,data); else if (GTK_TOGGLE_BUTTON (ButtonMolpro)->active) run_local_molpro(NULL,data); else if (GTK_TOGGLE_BUTTON (ButtonOrca)->active) run_local_orca(NULL,data); + else if (GTK_TOGGLE_BUTTON (ButtonNWChem)->active) run_local_nwchem(NULL,data); else if (GTK_TOGGLE_BUTTON (ButtonFireFly)->active) run_local_firefly(NULL,data); else if (GTK_TOGGLE_BUTTON (ButtonQChem)->active) run_local_qchem(NULL,data); else if (GTK_TOGGLE_BUTTON (ButtonMopac)->active) run_local_mopac(NULL,data); @@ -4468,6 +4872,7 @@ else if (GTK_TOGGLE_BUTTON (ButtonMPQC)->active) run_remote_mpqc(NULL,data); else if (GTK_TOGGLE_BUTTON (ButtonMolpro)->active) run_remote_molpro(NULL,data); else if (GTK_TOGGLE_BUTTON (ButtonOrca)->active) run_remote_orca(NULL,data); + else if (GTK_TOGGLE_BUTTON (ButtonNWChem)->active) run_remote_nwchem(NULL,data); else if (GTK_TOGGLE_BUTTON (ButtonFireFly)->active) run_remote_firefly(NULL,data); else if (GTK_TOGGLE_BUTTON (ButtonQChem)->active) run_remote_qchem(NULL,data); else if (GTK_TOGGLE_BUTTON (ButtonMopac)->active) run_remote_mopac(NULL,data); @@ -4602,14 +5007,18 @@ ButtonOrca = gtk_radio_button_new_with_label( gtk_radio_button_get_group (GTK_RADIO_BUTTON (ButtonGauss)), "Orca "); add_widget_table(Table,ButtonOrca,2,0); + ButtonNWChem = gtk_radio_button_new_with_label( gtk_radio_button_get_group (GTK_RADIO_BUTTON (ButtonGauss)), "NWChem "); + add_widget_table(Table,ButtonNWChem,2,1); + + ButtonFireFly = gtk_radio_button_new_with_label( gtk_radio_button_get_group (GTK_RADIO_BUTTON (ButtonGauss)), "FireFly "); - add_widget_table(Table,ButtonFireFly,2,1); + add_widget_table(Table,ButtonFireFly,2,2); ButtonQChem = gtk_radio_button_new_with_label( gtk_radio_button_get_group (GTK_RADIO_BUTTON (ButtonGauss)), "Q-Chem "); - add_widget_table(Table,ButtonQChem,2,2); + add_widget_table(Table,ButtonQChem,3,0); ButtonOther = gtk_radio_button_new_with_label( gtk_radio_button_get_group (GTK_RADIO_BUTTON (ButtonGauss)), "Other "); - add_widget_table(Table,ButtonOther,3,0); + add_widget_table(Table,ButtonOther,3,1); return frame; } /********************************************************************************/ @@ -4657,9 +5066,7 @@ (GtkAttachOptions)(GTK_FILL|GTK_EXPAND) , (GtkAttachOptions)(GTK_FILL|GTK_SHRINK), 1,1); - if(fileopen.localdir && strcmp(fileopen.localdir,"NoName")!=0) gtk_file_chooser_set_current_folder( - GTK_FILE_CHOOSER(buttonDirSelector), - fileopen.localdir); + if(fileopen.localdir && strcmp(fileopen.localdir,"NoName")!=0) gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(buttonDirSelector), fileopen.localdir); gtk_widget_show_all(frame); g_object_set_data (G_OBJECT (frame), "ButtonDirSelector",buttonDirSelector); @@ -4746,6 +5153,8 @@ sprintf(buffer,"%s.inp",entrytext); else if (ButtonOrca && GTK_TOGGLE_BUTTON (ButtonOrca)->active) sprintf(buffer,"%s.inp",entrytext); + else if (ButtonNWChem && GTK_TOGGLE_BUTTON (ButtonNWChem)->active) + sprintf(buffer,"%s.nw",entrytext); else if (ButtonMopac && GTK_TOGGLE_BUTTON (ButtonMopac)->active) sprintf(buffer,"%s.mop",entrytext); else sprintf(buffer,"%s.com",entrytext); @@ -5142,6 +5551,7 @@ g_signal_connect(G_OBJECT(ButtonFireFly), "clicked",G_CALLBACK(set_default_entrys),NULL); g_signal_connect(G_OBJECT(ButtonQChem), "clicked",G_CALLBACK(set_default_entrys),NULL); g_signal_connect(G_OBJECT(ButtonOrca), "clicked",G_CALLBACK(set_default_entrys),NULL); + g_signal_connect(G_OBJECT(ButtonNWChem), "clicked",G_CALLBACK(set_default_entrys),NULL); g_signal_connect(G_OBJECT(ButtonMopac), "clicked",G_CALLBACK(set_default_entrys),NULL); g_signal_connect(G_OBJECT(ButtonOther), "clicked",G_CALLBACK(set_default_entrys),NULL); @@ -5152,6 +5562,7 @@ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ButtonMPQC), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ButtonFireFly), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ButtonOrca), FALSE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ButtonNWChem), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ButtonQChem), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ButtonMopac), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ButtonOther), FALSE); @@ -5163,6 +5574,7 @@ else if(strstr(type,"Molcas")) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ButtonMolcas), TRUE); else if(strstr(type,"MPQC")) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ButtonMPQC), TRUE); else if(strstr(type,"Orca")) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ButtonOrca), TRUE); + else if(strstr(type,"NWChem")) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ButtonNWChem), TRUE); else if(strstr(type,"Q-Chem")) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ButtonQChem), TRUE); else if(strstr(type,"Mopac")) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ButtonMopac), TRUE); else gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ButtonOther), TRUE); @@ -5236,6 +5648,9 @@ case PROG_IS_ORCA : create_run_dialogue_box(NULL,"Orca",(GCallback)run_program); break; + case PROG_IS_NWCHEM : + create_run_dialogue_box(NULL,"NWChem",(GCallback)run_program); + break; case PROG_IS_FIREFLY : create_run_dialogue_box(NULL,"FireFly",(GCallback)run_program); break; diff -Nru gabedit-2.3.7/src/Common/StockIcons.c gabedit-2.4.0/src/Common/StockIcons.c --- gabedit-2.3.7/src/Common/StockIcons.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Common/StockIcons.c 2011-09-22 14:25:07.000000000 +0000 @@ -65,6 +65,7 @@ #include "../../pixmaps/FireFly.xpm" #include "../../pixmaps/MoveAtom.xpm" #include "../../pixmaps/MPQC.xpm" +#include "../../pixmaps/NWChem.xpm" #include "../../pixmaps/New.xpm" #include "../../pixmaps/Next.xpm" #include "../../pixmaps/No.xpm" @@ -177,6 +178,7 @@ add_one_icon(icon_factory, GABEDIT_STOCK_ADF, adf_xpm); add_one_icon(icon_factory, GABEDIT_STOCK_DALTON, dalton_xpm); add_one_icon(icon_factory, GABEDIT_STOCK_GAMESS, gamess_xpm); + add_one_icon(icon_factory, GABEDIT_STOCK_NWCHEM, nwchem_xpm); add_one_icon(icon_factory, GABEDIT_STOCK_FIREFLY, firefly_xpm); add_one_icon(icon_factory, GABEDIT_STOCK_MOVE_ATOM, move_atom_xpm); add_one_icon(icon_factory, GABEDIT_STOCK_MPQC, mpqc_xpm); diff -Nru gabedit-2.3.7/src/Common/StockIcons.h gabedit-2.4.0/src/Common/StockIcons.h --- gabedit-2.3.7/src/Common/StockIcons.h 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Common/StockIcons.h 2011-09-22 14:25:07.000000000 +0000 @@ -46,6 +46,7 @@ #define GABEDIT_STOCK_ADF "gabedit-adf" #define GABEDIT_STOCK_DALTON "gabedit-dalton" #define GABEDIT_STOCK_GAMESS "gabedit-gamess" +#define GABEDIT_STOCK_NWCHEM "gabedit-nwchem" #define GABEDIT_STOCK_FIREFLY "gabedit-firefly" #define GABEDIT_STOCK_MOVE_ATOM "gabedit-move-atom" #define GABEDIT_STOCK_MPQC "gabedit-mpqc" diff -Nru gabedit-2.3.7/src/Display/Dep.mk gabedit-2.4.0/src/Display/Dep.mk --- gabedit-2.3.7/src/Display/Dep.mk 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Display/Dep.mk 2011-09-22 15:59:32.000000000 +0000 @@ -114,6 +114,14 @@ ../Utils/Constants.h ../Utils/Zlm.h ../Utils/../Common/GabeditType.h \ ../Geometry/GeomGlobal.h GeomDraw.h GLArea.h UtilsOrb.h Basis.h \ GeomOrbXYZ.h AtomicOrbitals.h StatusOrb.h Orbitals.h BondsOrb.h +OrbitalsNWChem.o: OrbitalsNWChem.c ../../Config.h GlobalOrb.h \ + ../Files/GabeditFileChooser.h ../../gl2ps/gl2ps.h Grid.h \ + ../MultiGrid/PoissonMG.h ../MultiGrid/GridMG.h ../MultiGrid/DomainMG.h \ + ../MultiGrid/TypesMG.h IsoSurface.h ../Common/GabeditType.h \ + ../Utils/AtomsProp.h ../Utils/UtilsInterface.h ../Utils/Utils.h \ + ../Utils/Constants.h ../Utils/Zlm.h ../Utils/../Common/GabeditType.h \ + ../Geometry/GeomGlobal.h GeomDraw.h GLArea.h UtilsOrb.h Basis.h \ + GeomOrbXYZ.h AtomicOrbitals.h StatusOrb.h Orbitals.h BondsOrb.h OrbitalsMopac.o: OrbitalsMopac.c ../../Config.h GlobalOrb.h \ ../Files/GabeditFileChooser.h ../../gl2ps/gl2ps.h Grid.h \ ../MultiGrid/PoissonMG.h ../MultiGrid/GridMG.h ../MultiGrid/DomainMG.h \ @@ -131,7 +139,7 @@ ../Utils/GabeditTextEdit.h ../Utils/Constants.h ../Spectrum/DOS.h \ GeomDraw.h GLArea.h UtilsOrb.h Basis.h GeomOrbXYZ.h AtomicOrbitals.h \ StatusOrb.h Orbitals.h OrbitalsGamess.h OrbitalsMolpro.h \ - OrbitalsQChem.h OrbitalsMopac.h OrbitalsOrca.h + OrbitalsQChem.h OrbitalsNWChem.h OrbitalsMopac.h OrbitalsOrca.h StatusOrb.o: StatusOrb.c ../../Config.h GlobalOrb.h \ ../Files/GabeditFileChooser.h ../../gl2ps/gl2ps.h Grid.h \ ../MultiGrid/PoissonMG.h ../MultiGrid/GridMG.h ../MultiGrid/DomainMG.h \ @@ -333,7 +341,7 @@ ../Geometry/GeomGlobal.h ../Files/FolderChooser.h \ ../Files/GabeditFolderChooser.h ../Common/Help.h ../Common/StockIcons.h \ ../Display/PovrayGL.h ../Display/Images.h ../Display/UtilsOrb.h \ - ../Display/BondsOrb.h ../../pixmaps/Open.xpm + ../Display/BondsOrb.h ../Utils/GabeditXYPlot.h ../../pixmaps/Open.xpm AnimationMD.o: AnimationMD.c ../../Config.h ../Common/Global.h \ ../Common/../Files/GabeditFileChooser.h \ ../Common/../Common/GabeditType.h GlobalOrb.h \ diff -Nru gabedit-2.3.7/src/Display/GeomOrbXYZ.c gabedit-2.4.0/src/Display/GeomOrbXYZ.c --- gabedit-2.3.7/src/Display/GeomOrbXYZ.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Display/GeomOrbXYZ.c 2011-09-22 14:25:07.000000000 +0000 @@ -3323,6 +3323,331 @@ glarea_rafresh(GLArea); return TRUE; } +/********************************************************************************/ +void gl_get_charges_from_nwchem_output_file(FILE* fd,gint N) +{ + guint taille=BSIZE; + gchar t[BSIZE]; + gchar d3[BSIZE]; + gchar d4[BSIZE]; + gchar d[BSIZE]; + gchar* pdest; + gint i; + + + for(i=0;i0 && (gint)numgeom-1 == num) break; + }while(!feof(fd)); + + Ncenters = j+1; + fclose(fd); + g_free(t); + for(i=0;i<5;i++) g_free(AtomCoord[i]); + if(Ncenters == 0 ) g_free(GeomOrb); + else + { + DefineType(); + } + buildBondsOrb(); + reset_grid_limits(); + init_atomic_orbitals(); + set_status_label_info(_("Geometry"),_("Ok")); + RebuildGeom = TRUE; + if(this_is_a_new_geometry()) free_objects_all(); + glarea_rafresh(GLArea); + return lineg; +} +/********************************************************************************/ +static void gl_get_charges_from_aimall_file(FILE* fd,gint N) +{ + guint taille=BSIZE; + gchar t[BSIZE]; + gchar dump[BSIZE]; + gchar d[BSIZE]; + gchar* pdest; + gint i; + + + while(!feof(fd) ) + { + pdest = NULL; + if(!fgets(t,taille,fd)) break; + pdest = strstr( t, "Atom A q(A)"); + if(pdest) + { + if(!fgets(t,taille,fd)) break; + for(i=0;i0) + { + gl_get_charges_from_aimall_file(fd,Ncenters); + /* PrintGeomOrb();*/ + } + + fclose(fd); + g_free(t); + for(i=0;i<5;i++) g_free(AtomCoord[i]); + if(Ncenters == 0 ) g_free(GeomOrb); + else + { + DefineType(); + /* PrintGeomOrb();*/ + } + RebuildGeom = TRUE; + buildBondsOrb(); + reset_grid_limits(); + init_atomic_orbitals(); + set_status_label_info(_("Geometry"),_("Ok")); + return TRUE; +} +/********************************************************************************/ +void gl_read_aimall_file_sel(GabeditFileChooser *SelecFile, gint response_id) +{ + gchar *FileName; + + if(response_id != GTK_RESPONSE_OK) return; + FileName = gabedit_file_chooser_get_current_file(SelecFile); + gtk_widget_hide(GTK_WIDGET(SelecFile)); + while( gtk_events_pending() ) gtk_main_iteration(); + + add_objects_for_new_grid(); + gl_read_aimall_file(FileName); +} /********************************************************/ void gl_read_first_dalton_file(GabeditFileChooser *SelecFile, gint response_id) { @@ -3640,6 +3965,36 @@ if(this_is_a_new_geometry()) free_objects_all(); glarea_rafresh(GLArea); } +/********************************************************/ +void gl_read_first_nwchem_file(GabeditFileChooser *SelecFile, gint response_id) +{ + gchar *FileName; + if(response_id != GTK_RESPONSE_OK) return; + FileName = gabedit_file_chooser_get_current_file(SelecFile); + gtk_widget_hide(GTK_WIDGET(SelecFile)); + while( gtk_events_pending() ) gtk_main_iteration(); + + add_objects_for_new_grid(); + gl_read_nwchem_file_geomi(FileName,1); + RebuildGeom = TRUE; + if(this_is_a_new_geometry()) free_objects_all(); + glarea_rafresh(GLArea); +} +/********************************************************/ +void gl_read_last_nwchem_file(GabeditFileChooser *SelecFile, gint response_id) +{ + gchar *FileName; + if(response_id != GTK_RESPONSE_OK) return; + FileName = gabedit_file_chooser_get_current_file(SelecFile); + gtk_widget_hide(GTK_WIDGET(SelecFile)); + while( gtk_events_pending() ) + gtk_main_iteration(); + add_objects_for_new_grid(); + gl_read_nwchem_file_geomi(FileName,-1); + RebuildGeom = TRUE; + if(this_is_a_new_geometry()) free_objects_all(); + glarea_rafresh(GLArea); +} /*******************************************************/ void gl_read_molden_file(GabeditFileChooser *SelecFile, gint response_id) { @@ -3672,6 +4027,7 @@ if(fileType == GABEDIT_TYPEFILE_XYZ) Ok = gl_read_xyz_file(fileName); else if(fileType == GABEDIT_TYPEFILE_PDB) Ok = gl_read_pdb_file(fileName); else if(fileType == GABEDIT_TYPEFILE_HIN) Ok = gl_read_hin_file(fileName); + else if(fileType == GABEDIT_TYPEFILE_AIMALL) Ok = gl_read_aimall_file(fileName); else if(fileType == GABEDIT_TYPEFILE_DALTON) Ok = gl_read_dalton_file_geomi(fileName,-1); else if(fileType == GABEDIT_TYPEFILE_GAMESS) Ok = gl_read_gamess_file_geomi(fileName,-1); else if(fileType == GABEDIT_TYPEFILE_FIREFLY) Ok = gl_read_gamess_file_geomi(fileName,-1); @@ -3683,6 +4039,7 @@ else if(fileType == GABEDIT_TYPEFILE_MPQC) Ok = gl_read_mpqc_file_geomi(fileName,-1); else if(fileType == GABEDIT_TYPEFILE_ORCA) Ok = gl_read_orca_file_geomi(fileName,-1); else if(fileType == GABEDIT_TYPEFILE_QCHEM) Ok = gl_read_qchem_file_geomi(fileName,-1); + else if(fileType == GABEDIT_TYPEFILE_NWCHEM) Ok = (0!=gl_read_nwchem_file_geomi(fileName,-1)); else if(fileType == GABEDIT_TYPEFILE_GABEDIT) Ok = gl_read_gabedit_file_geom(fileName); else if(fileType == GABEDIT_TYPEFILE_MOLDEN) Ok = gl_read_molden_file_geom(fileName); else if(fileType == GABEDIT_TYPEFILE_GAUSSIAN_FCHK) Ok = gl_read_fchk_gaussn_file_geom(fileName); @@ -3691,6 +4048,7 @@ fileType == GABEDIT_TYPEFILE_FIREFLYINPUT|| fileType == GABEDIT_TYPEFILE_GAMESSINPUT|| fileType == GABEDIT_TYPEFILE_QCHEMINPUT|| + fileType == GABEDIT_TYPEFILE_NWCHEMINPUT|| fileType == GABEDIT_TYPEFILE_MOPACINPUT|| fileType == GABEDIT_TYPEFILE_MPQCINPUT|| fileType == GABEDIT_TYPEFILE_GAUSSIANINPUT|| diff -Nru gabedit-2.3.7/src/Display/GeomOrbXYZ.h gabedit-2.4.0/src/Display/GeomOrbXYZ.h --- gabedit-2.3.7/src/Display/GeomOrbXYZ.h 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Display/GeomOrbXYZ.h 2011-09-22 14:25:07.000000000 +0000 @@ -27,6 +27,7 @@ void gl_read_xyz_file_sel(GabeditFileChooser *SelecFile, gint response_id); void gl_read_pdb_file_sel(GabeditFileChooser *SelecFile, gint response_id); void gl_read_hin_file_sel(GabeditFileChooser *SelecFile, gint response_id); +void gl_read_aimall_file_sel(GabeditFileChooser *SelecFile, gint response_id); void gl_read_first_dalton_file(GabeditFileChooser *SelecFile, gint response_id); void gl_read_last_dalton_file(GabeditFileChooser *SelecFile, gint response_id); void gl_read_first_gamess_file(GabeditFileChooser *SelecFile, gint response_id); @@ -44,6 +45,8 @@ void gl_read_last_mopac_output_file(GabeditFileChooser *SelecFile, gint response_id); void gl_read_first_mopac_aux_file(GabeditFileChooser *SelecFile, gint response_id); void gl_read_last_mopac_aux_file(GabeditFileChooser *SelecFile, gint response_id); +void gl_read_first_nwchem_file(GabeditFileChooser *SelecFile, gint response_id); +void gl_read_last_nwchem_file(GabeditFileChooser *SelecFile, gint response_id); void gl_read_first_qchem_file(GabeditFileChooser *SelecFile, gint response_id); void gl_read_last_qchem_file(GabeditFileChooser *SelecFile, gint response_id); void gl_read_first_orca_file(GabeditFileChooser *SelecFile, gint response_id); @@ -61,6 +64,7 @@ gboolean gl_read_mpqc_file_geomi(gchar *FileName,gint num); gboolean gl_read_orca_file_geomi(gchar *FileName,gint num); gboolean gl_read_qchem_file_geomi(gchar *FileName,gint num); +gulong gl_read_nwchem_file_geomi(gchar *FileName,gint num); gboolean gl_read_xyz_file_geomi(gchar *FileName,gint num); void gl_read_gabedit_file(GabeditFileChooser *SelecFile, gint response_id); gboolean gl_read_gabedit_file_geom(gchar *FileName); diff -Nru gabedit-2.3.7/src/Display/Makefile gabedit-2.4.0/src/Display/Makefile --- gabedit-2.3.7/src/Display/Makefile 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Display/Makefile 2011-09-22 14:25:07.000000000 +0000 @@ -1,4 +1,4 @@ -OBJECTS = GeomOrbXYZ.o BondsOrb.o GeomDraw.o TriangleDraw.o UtilsOrb.o Basis.o Grid.o IsoSurface.o ViewOrb.o GLArea.o OrbitalsGamess.o OrbitalsMolpro.o OrbitalsOrca.o OrbitalsQChem.o OrbitalsMopac.o Orbitals.o StatusOrb.o AtomicOrbitals.o Images.o GridPlans.o Contours.o ContoursDraw.o PreferencesOrb.o GridCube.o GridAdfOrbitals.o GridAdfDensity.o Textures.o Dipole.o AxisGL.o PrincipalAxisGL.o Vibration.o VibrationDraw.o ColorMap.o GridMolcas.o GridQChem.o AnimationRotation.o AnimationIsoSurface.o AnimationContours.o AnimationPlanesMapped.o AnimationGeomConv.o AnimationMD.o PovrayGL.o ContoursPov.o PlanesMappedDraw.o PlanesMapped.o PlanesMappedPov.o SurfacesPov.o RingsPov.o MenuToolBarGL.o LabelsGL.o RingsOrb.o ExportGL.o CaptureOrbitals.o IntegralOrbitals.o GridCP.o AnimationGrids.o +OBJECTS = GeomOrbXYZ.o BondsOrb.o GeomDraw.o TriangleDraw.o UtilsOrb.o Basis.o Grid.o IsoSurface.o ViewOrb.o GLArea.o OrbitalsGamess.o OrbitalsMolpro.o OrbitalsOrca.o OrbitalsQChem.o OrbitalsNWChem.o OrbitalsMopac.o Orbitals.o StatusOrb.o AtomicOrbitals.o Images.o GridPlans.o Contours.o ContoursDraw.o PreferencesOrb.o GridCube.o GridAdfOrbitals.o GridAdfDensity.o Textures.o Dipole.o AxisGL.o PrincipalAxisGL.o Vibration.o VibrationDraw.o ColorMap.o GridMolcas.o GridQChem.o AnimationRotation.o AnimationIsoSurface.o AnimationContours.o AnimationPlanesMapped.o AnimationGeomConv.o AnimationMD.o PovrayGL.o ContoursPov.o PlanesMappedDraw.o PlanesMapped.o PlanesMappedPov.o SurfacesPov.o RingsPov.o MenuToolBarGL.o LabelsGL.o RingsOrb.o ExportGL.o CaptureOrbitals.o IntegralOrbitals.o GridCP.o AnimationGrids.o include ../../CONFIG diff -Nru gabedit-2.3.7/src/Display/MenuToolBarGL.c gabedit-2.4.0/src/Display/MenuToolBarGL.c --- gabedit-2.3.7/src/Display/MenuToolBarGL.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Display/MenuToolBarGL.c 2011-09-22 14:25:07.000000000 +0000 @@ -149,6 +149,8 @@ file_chooser_open(gl_read_pdb_file_sel,_("Read a pdb file"),GABEDIT_TYPEFILE_PDB,GABEDIT_TYPEWIN_ORB); else if(!strcmp(name,"GeometryHIN")) file_chooser_open(gl_read_hin_file_sel,_("Read a hyperchem file"),GABEDIT_TYPEFILE_HIN,GABEDIT_TYPEWIN_ORB); + else if(!strcmp(name,"GeometryAIMAll")) + file_chooser_open(gl_read_aimall_file_sel,_("Read a AIMAll file"),GABEDIT_TYPEFILE_AIMALL,GABEDIT_TYPEWIN_ORB); else if(!strcmp(name,"GeometryOpenBabel")) gl_create_babel_read_dialogue(); else if(!strcmp(name,"GeometryDaltonFirst")) @@ -195,9 +197,15 @@ file_chooser_open(gl_read_last_gamess_file,_("Read the last geometry in a FireFly output file"),GABEDIT_TYPEFILE_GAMESS,GABEDIT_TYPEWIN_ORB); else if(!strcmp(name ,"GeometryQChemFirst")) - file_chooser_open(gl_read_first_qchem_file,_("Read the first geometry from a Q-Chem output file"),GABEDIT_TYPEFILE_MPQC,GABEDIT_TYPEWIN_ORB); + file_chooser_open(gl_read_first_qchem_file,_("Read the first geometry from a Q-Chem output file"),GABEDIT_TYPEFILE_QCHEM,GABEDIT_TYPEWIN_ORB); else if(!strcmp(name ,"GeometryQChemLast")) - file_chooser_open(gl_read_last_qchem_file,_("Read the last geometry from a Q-Chem output file"),GABEDIT_TYPEFILE_MPQC,GABEDIT_TYPEWIN_ORB); + file_chooser_open(gl_read_last_qchem_file,_("Read the last geometry from a Q-Chem output file"),GABEDIT_TYPEFILE_QCHEM,GABEDIT_TYPEWIN_ORB); + + else if(!strcmp(name ,"GeometryNWChemFirst")) + file_chooser_open(gl_read_first_nwchem_file,_("Read the first geometry from a NWChem output file"),GABEDIT_TYPEFILE_NWCHEM,GABEDIT_TYPEWIN_ORB); + else if(!strcmp(name ,"GeometryNWChemLast")) + file_chooser_open(gl_read_last_nwchem_file,_("Read the last geometry from a NWChem output file"),GABEDIT_TYPEFILE_NWCHEM,GABEDIT_TYPEWIN_ORB); + else if(!strcmp(name ,"GeometryGabedit")) file_chooser_open(gl_read_gabedit_file,_("Read geometry from a gabedit file"),GABEDIT_TYPEFILE_GABEDIT,GABEDIT_TYPEWIN_ORB); else if(!strcmp(name ,"GeometryMolden")) @@ -217,6 +225,8 @@ file_chooser_open(read_orca_orbitals_sel_2mkl,_("Read Geometry and Orbitals from a Orca files"),GABEDIT_TYPEFILE_ORCA,GABEDIT_TYPEWIN_ORB); else if(!strcmp(name , "OrbitalsFireFly")) file_chooser_open(read_gamess_orbitals_sel,_("Read Geometry and Orbitals from a FireFly output file"),GABEDIT_TYPEFILE_GAMESS,GABEDIT_TYPEWIN_ORB); + else if(!strcmp(name , "OrbitalsNWChem")) + file_chooser_open(read_nwchem_orbitals_sel,_("Read Geometry and Orbitals from a NWChem output file"),GABEDIT_TYPEFILE_NWCHEM,GABEDIT_TYPEWIN_ORB); else if(!strcmp(name , "OrbitalsQChem")) file_chooser_open(read_qchem_orbitals_sel,_("Read Geometry and Orbitals from a Q-Chem output file"),GABEDIT_TYPEFILE_QCHEM,GABEDIT_TYPEWIN_ORB); else if(!strcmp(name , "OrbitalsMopac")) @@ -778,6 +788,7 @@ {"GeometryXYZ", NULL, N_("Read the geometry from a _xyz file"), NULL, "Read the geometry from a xyz file", G_CALLBACK (activate_action) }, {"GeometryPDB", GABEDIT_STOCK_PDB, N_("Read the geometry from a _pdb file"), NULL, "Read the geometry from a pdb file", G_CALLBACK (activate_action) }, {"GeometryHIN", NULL, N_("Read the geometry from a _hyperchem file"), NULL, "Read the geometry from a hyperchem file", G_CALLBACK (activate_action) }, + {"GeometryAIMAll", NULL, N_("Read the geometry from a _AIMAll file"), NULL, "Read the geometry from a AIMAll file", G_CALLBACK (activate_action) }, {"GeometryOpenBabel", GABEDIT_STOCK_OPEN_BABEL, N_("Other format (using Open _Babel)"), NULL, "Other format (using Open _Babel)", G_CALLBACK (activate_action) }, {"GeometryDalton", GABEDIT_STOCK_DALTON, N_("Geometry _Dalton")}, {"GeometryDaltonFirst", GABEDIT_STOCK_DALTON, N_("Read the _first geometry from a Dalton output log file"), @@ -830,6 +841,11 @@ NULL, "Read the first geometry from a FireFly output file", G_CALLBACK (activate_action) }, {"GeometryFireFlyLast", GABEDIT_STOCK_FIREFLY, N_("Read the _last geometry from a FireFly output log file"), NULL, "Read the last geometry from a FireFly output file", G_CALLBACK (activate_action) }, + {"GeometryNWChem", GABEDIT_STOCK_NWCHEM, N_("Geometry _NWChem")}, + {"GeometryNWChemFirst", GABEDIT_STOCK_NWCHEM, N_("Read the _first geometry from a NWChem output file"), + NULL, "Read the first geometry from a _NWChem output file", G_CALLBACK (activate_action) }, + {"GeometryNWChemLast", GABEDIT_STOCK_NWCHEM, N_("Read the _last geometry from a _NWChem output file"), + NULL, "Read the last geometry from a _NWChem output file", G_CALLBACK (activate_action) }, {"GeometryQChem", GABEDIT_STOCK_QCHEM, N_("Geometry Q-_Chem")}, {"GeometryQChemFirst", GABEDIT_STOCK_QCHEM, N_("Read the _first geometry from a Q-Chem output file"), NULL, "Read the first geometry from a Q-Chem output file", G_CALLBACK (activate_action) }, @@ -860,6 +876,8 @@ NULL, "Read geometry and orbitals from a Orca output files", G_CALLBACK (activate_action) }, {"OrbitalsFireFly", GABEDIT_STOCK_FIREFLY, N_("Read geometry and orbitals from a _FireFly output file"), NULL, "Read geometry and orbitals from a FireFly output file", G_CALLBACK (activate_action) }, + {"OrbitalsNWChem", GABEDIT_STOCK_NWCHEM, N_("Read geometry and orbitals from a _NWChem output file"), + NULL, "Read geometry and orbitals from a NWChem output file", G_CALLBACK (activate_action) }, {"OrbitalsQChem", GABEDIT_STOCK_QCHEM, N_("Read geometry and orbitals from a Q-_Chem output file"), NULL, "Read geometry and orbitals from a Q-Chem output file", G_CALLBACK (activate_action) }, {"OrbitalsMopac", GABEDIT_STOCK_MOPAC, N_("Read geometry and orbitals from a _Mopac aux file"), @@ -1510,6 +1528,7 @@ " \n" " \n" " \n" +" \n" " \n" " \n" " \n" @@ -1558,6 +1577,11 @@ " \n" " \n" " \n" +" \n" +" \n" +" \n" +" \n" +" \n" " \n" " \n" " \n" @@ -1583,6 +1607,7 @@ " \n" " \n" " \n" +" \n" " \n" " \n" " \n" diff -Nru gabedit-2.3.7/src/Display/Orbitals.c gabedit-2.4.0/src/Display/Orbitals.c --- gabedit-2.3.7/src/Display/Orbitals.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Display/Orbitals.c 2011-09-22 14:25:07.000000000 +0000 @@ -39,6 +39,7 @@ #include "OrbitalsGamess.h" #include "OrbitalsMolpro.h" #include "OrbitalsQChem.h" +#include "OrbitalsNWChem.h" #include "OrbitalsMopac.h" #include "OrbitalsOrca.h" @@ -2474,6 +2475,19 @@ read_qchem_orbitals(FileName); } /********************************************************************************/ +void read_nwchem_orbitals_sel(GabeditFileChooser *SelecFile, gint response_id) +{ + gchar *FileName; + + if(response_id != GTK_RESPONSE_OK) return; + FileName = gabedit_file_chooser_get_current_file(SelecFile); + gtk_widget_hide(GTK_WIDGET(SelecFile)); + while( gtk_events_pending() ) gtk_main_iteration(); + + add_objects_for_new_grid(); + read_nwchem_orbitals(FileName); +} +/********************************************************************************/ void read_mopac_orbitals_sel(GabeditFileChooser *SelecFile, gint response_id) { gchar *FileName; @@ -2582,6 +2596,7 @@ else if(fileType == GABEDIT_TYPEFILE_MOPAC) read_mopac_orbitals(fileName); else if(fileType == GABEDIT_TYPEFILE_MOPAC_AUX) read_mopac_orbitals(fileName); else if(fileType == GABEDIT_TYPEFILE_ORCA) read_orca_orbitals_from_output_file(fileName); + else if(fileType == GABEDIT_TYPEFILE_NWCHEM) read_nwchem_orbitals(fileName); else if(fileType == GABEDIT_TYPEFILE_QCHEM) read_qchem_orbitals(fileName); else if(fileType == GABEDIT_TYPEFILE_GABEDIT) read_gabedit_orbitals(fileName); else if(fileType == GABEDIT_TYPEFILE_MOLDEN) read_molden_orbitals(fileName); diff -Nru gabedit-2.3.7/src/Display/Orbitals.h gabedit-2.4.0/src/Display/Orbitals.h --- gabedit-2.3.7/src/Display/Orbitals.h 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Display/Orbitals.h 2011-09-22 14:25:07.000000000 +0000 @@ -38,6 +38,7 @@ void read_orca_orbitals_sel_2mkl(GabeditFileChooser *SelecFile, gint response_id); void read_orca_orbitals_sel(GabeditFileChooser *SelecFile, gint response_id); void read_qchem_orbitals_sel(GabeditFileChooser *SelecFile, gint response_id); +void read_nwchem_orbitals_sel(GabeditFileChooser *SelecFile, gint response_id); void read_mopac_orbitals_sel(GabeditFileChooser *SelecFile, gint response_id); void read_gabedit_orbitals_sel(GabeditFileChooser *SelecFile, gint response_id); void save_gabedit_orbitals_sel(GabeditFileChooser *SelecFile, gint response_id); diff -Nru gabedit-2.3.7/src/Display/OrbitalsMolpro.c gabedit-2.4.0/src/Display/OrbitalsMolpro.c --- gabedit-2.3.7/src/Display/OrbitalsMolpro.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Display/OrbitalsMolpro.c 2011-09-22 14:25:07.000000000 +0000 @@ -1047,6 +1047,7 @@ if(OccOrbitals [k]>0) Nocc = k+1; /* + printf("Nocc=%d\n",Nocc); Debug("NumSym = %d NumOrbs = %d\n",i,j); Debug("NBasis= %d NumOrbs = %d\n",BasisBySym[numsym].Nbasis,OrbitalsBySym[i].Orbs[j].ncoefs); */ @@ -1057,7 +1058,7 @@ c = OrbitalsBySym[i].Orbs[j].coefs[n]; for(ic=0;ic0 || NBetaOrb>0) { diff -Nru gabedit-2.3.7/src/Display/OrbitalsNWChem.c gabedit-2.4.0/src/Display/OrbitalsNWChem.c --- gabedit-2.3.7/src/Display/OrbitalsNWChem.c 1970-01-01 00:00:00.000000000 +0000 +++ gabedit-2.4.0/src/Display/OrbitalsNWChem.c 2011-09-22 14:25:07.000000000 +0000 @@ -0,0 +1,1151 @@ +/* OrbitalsNWChem.c */ +/********************************************************************************************************** +Copyright (c) 2002-2011 Abdul-Rahman Allouche. All rights reserved + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the Gabedit), to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions + of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +************************************************************************************************************/ + +#include "../../Config.h" +#include "GlobalOrb.h" +#include "../Utils/AtomsProp.h" +#include "../Utils/UtilsInterface.h" +#include "../Utils/Utils.h" +#include "../Utils/Constants.h" +#include "../Utils/Zlm.h" +#include "../Geometry/GeomGlobal.h" +#include "GeomDraw.h" +#include "GLArea.h" +#include "UtilsOrb.h" +#include "Basis.h" +#include "GeomOrbXYZ.h" +#include "AtomicOrbitals.h" +#include "StatusOrb.h" +#include "Basis.h" +#include "Orbitals.h" +#include "GeomOrbXYZ.h" +#include "BondsOrb.h" + +/********************************************************************************/ +typedef enum +{ + GABEDIT_ORBLOCALTYPE_BOYS=0, + GABEDIT_ORBLOCALTYPE_EDMISTON, + GABEDIT_ORBLOCALTYPE_PIPEK, + GABEDIT_ORBLOCALTYPE_UNKNOWN +} GabEditOrbLocalType; + +static gchar* titlesLocalOrb[GABEDIT_ORBLOCALTYPE_PIPEK+1]= +{ + "BOYS ORBITAL LOCALIZATION", + "EDMISTON-RUEDENBERG ENERGY LOCALIZATION", + "MOLECULAR ORBITALS LOCALIZED BY THE POPULATION METHOD" +}; + +typedef enum +{ + GABEDIT_ORBTYPE_ALPHA = 0, + GABEDIT_ORBTYPE_BETA, + GABEDIT_ORBTYPE_RESTRICTED, + GABEDIT_ORBTYPE_MCSCF, + GABEDIT_ORBTYPE_EIGENVECTORS, + GABEDIT_ORBTYPE_BOYS_ALPHA, + GABEDIT_ORBTYPE_BOYS_BETA, + GABEDIT_ORBTYPE_BOYS, + GABEDIT_ORBTYPE_EDMISTON_ALPHA, + GABEDIT_ORBTYPE_EDMISTON_BETA, + GABEDIT_ORBTYPE_EDMISTON, + GABEDIT_ORBTYPE_PIPEK_ALPHA, + GABEDIT_ORBTYPE_PIPEK_BETA, + GABEDIT_ORBTYPE_PIPEK, +} GabEditOrbType; +static gchar* titlesOrb[GABEDIT_ORBTYPE_PIPEK+1]= +{ + "Final Alpha Molecular Orbital Analysis", + "Final Beta Molecular Orbital Analysis", + "Final Molecular Orbital Analysis", + "MCSCF OPTIMIZED ORBITALS", + "EIGENVECTORS", + "***** ALPHA ORBITAL LOCALIZATION *****", + "****** BETA ORBITAL LOCALIZATION *****", + "THE BOYS LOCALIZED ORBITALS ARE", + "***** ALPHA ORBITAL LOCALIZATION *****", + "****** BETA ORBITAL LOCALIZATION *****", + "EDMISTON-RUEDENBERG ENERGY LOCALIZED ORBITALS", + "***** ALPHA ORBITAL LOCALIZATION *****", + "****** BETA ORBITAL LOCALIZATION *****", + "THE PIPEK-MEZEY POPULATION LOCALIZED ORBITALS ARE" +}; +/********************************************************************************/ +static gboolean sphericalBasis = FALSE; +/********************************************************************************/ +static gulong read_geomorb_nwchem_file_geom(gchar *FileName) +{ + gulong lineg = gl_read_nwchem_file_geomi(FileName,-1); + if(Ncenters != 0 ) + { + DefineType(); + /* PrintGeomOrb();*/ + } + return lineg; +} +/********************************************************************************/ +static void DefineNWChemCartBasis() +{ + gint i,j,k,n; + gint l1,l2,l3; + gint L; + gint *l[3]={NULL,NULL,NULL}; + gint m; + + NAOrb = 0; + for(i=0;i=0;l3--) + for(l2=Type[GeomOrb[i].NumType].Ao[j].L-l3;l2>=0;l2--) + { + l1 = Type[GeomOrb[i].NumType].Ao[j].L-l2-l3; + l[0][m] = l1; + l[1][m] = l2; + l[2][m] = l3; + m++; + } + } + for(m=0;m<(L+1)*(L+2)/2;m++) + { + l1 = l[0][m]; + l2 = l[1][m]; + l3 = l[2][m]; + k++; + AOrb[k].numberOfFunctions=Type[GeomOrb[i].NumType].Ao[j].N; + AOrb[k].NumCenter = i; + AOrb[k].Gtf =g_malloc(AOrb[k].numberOfFunctions*sizeof(GTF)); + for(n=0;n=klend);kl +=klinc) + { + M = kl; + k++; + Stemp = getZlm(L,M); + + temp[k].numberOfFunctions=Stemp.numberOfCoefficients*Type[GeomOrb[i].NumType].Ao[j].N; + temp[k].NumCenter=i; + temp[k].Gtf =g_malloc(temp[k].numberOfFunctions*sizeof(GTF)); + Nc=-1; + for(N=0;N0) NAlphaOcc++; + NAlphaOrb = NOrb; + break; + + case GABEDIT_ORBTYPE_BETA : + case GABEDIT_ORBTYPE_BOYS_BETA: + case GABEDIT_ORBTYPE_EDMISTON_BETA: + case GABEDIT_ORBTYPE_PIPEK_BETA: + CoefBetaOrbitals = CoefOrbitals; + EnerBetaOrbitals = EnerOrbitals; + SymBetaOrbitals = SymOrbitals; + OccBetaOrbitals = OccOrbitals; + NBetaOcc = 0; + for(i=0;i0) NBetaOcc++; + NBetaOrb = NOrb; + break; + + case GABEDIT_ORBTYPE_RESTRICTED: + case GABEDIT_ORBTYPE_MCSCF: + case GABEDIT_ORBTYPE_EIGENVECTORS: + case GABEDIT_ORBTYPE_BOYS: + case GABEDIT_ORBTYPE_EDMISTON: + case GABEDIT_ORBTYPE_PIPEK: + CoefAlphaOrbitals = CoefOrbitals; + EnerAlphaOrbitals = EnerOrbitals; + SymAlphaOrbitals = SymOrbitals; + OccAlphaOrbitals = OccOrbitals; + NAlphaOcc = 0; + for(i=0;i0) NAlphaOcc++; + for(i=0;i=0 && j<=NOrb) CoefOrbitals[i][j-1]=c; + + if(strlen(t)>44) + { + k = sscanf(t+40,"%d %lf", &j, &c); + if(k==2 && j>=0 && j<=NOrb) CoefOrbitals[i][j-1]=c; + } + } + } + /* Debug("End ncart\n");*/ + + }while(!feof(fd)); + + /* Debug("End of read \n");*/ + fclose(fd); + g_free(t); + g_free(dum); + + CoefAlphaOrbitals = CoefOrbitals; + EnerAlphaOrbitals = EnerOrbitals; + return TRUE; +} +/********************************************************************************/ +void read_nwchem_orbitals(gchar* FileName) +{ + gint typefile; + gchar *t = NULL; + gint nrs = 0; + gchar** strbasis=NULL; + gint i; + gboolean Ok; + GabEditOrbLocalType typeLocal; + gint typebasis = -1; + /* gint j,jj; */ + gulong lineg = 0; + + typefile =get_type_file_orb(FileName); + if(typefile==GABEDIT_TYPEFILE_UNKNOWN) return; + + + if(typefile != GABEDIT_TYPEFILE_NWCHEM) + { + gchar buffer[BSIZE]; + sprintf(buffer,_("Sorry, I can not read this format from '%s' file\n"),FileName); + Message(buffer,_("Error"),TRUE); + return ; + } + + free_data_all(); + t = get_name_file(FileName); + set_status_label_info(_("File name"),t); + g_free(t); + set_status_label_info(_("File type"),"NWChem"); + set_status_label_info(_("Mol. Orb."),"Reading"); + + free_orbitals(); + + typebasis = get_type_basis_in_nwchem_file(FileName); + if(typebasis == -1) + { + gchar buffer[BSIZE]; + sprintf(buffer, + _( + "Sorry, Gabedit does not support mixed spherical and contaminant cartezian basis functions\n\n" + ) + ); + Message(buffer,_("Error"),TRUE); + set_status_label_info(_("File name"),_("Nothing")); + set_status_label_info(_("File type"),_("Nothing")); + set_status_label_info(_("Mol. Orb."),_("Nothing")); + return; + } + + lineg = read_geomorb_nwchem_file_geom(FileName); + if(lineg == 0) + { + free_geometry(); + set_status_label_info(_("File name"),_("Nothing")); + set_status_label_info(_("File type"),_("Nothing")); + set_status_label_info(_("Mol. Orb."),_("Nothing")); + return; + } + strbasis=read_basis_from_a_nwchem_output_file(FileName, &nrs,lineg); + /* printf("nrs=%d\n",nrs);*/ + if(strbasis==NULL) + { + if(GeomOrb) + { + init_atomic_orbitals(); + for(i=0;i-1 && i-1 && i-1) @@ -436,11 +438,11 @@ gchar buffer[BSIZE]; sprintf(buffer,_("Sorry, I can not read '%s' file, problem with basis set\n"),fileName); Message(buffer,_("Error"),TRUE); - if(numAtoms) g_free(numAtoms); + /* if(numAtoms) g_free(numAtoms);*/ return FALSE; } - resortAtoms(numAtoms); - if(numAtoms) g_free(numAtoms); + /*resortAtoms(numAtoms);*/ + /* if(numAtoms) g_free(numAtoms);*/ return TRUE; } #define NCOLS 6 diff -Nru gabedit-2.3.7/src/Display/OrbitalsQChem.c gabedit-2.4.0/src/Display/OrbitalsQChem.c --- gabedit-2.3.7/src/Display/OrbitalsQChem.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Display/OrbitalsQChem.c 2011-09-22 14:25:07.000000000 +0000 @@ -129,7 +129,7 @@ tmp = get_name_file(FileName); set_status_label_info(_("File name"),tmp); g_free(tmp); - set_status_label_info(_("File type"),"Dalton"); + set_status_label_info(_("File type"),"Q-Chem"); numgeom =1; do { diff -Nru gabedit-2.3.7/src/Display/PlanesMappedDraw.c gabedit-2.4.0/src/Display/PlanesMappedDraw.c --- gabedit-2.3.7/src/Display/PlanesMappedDraw.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Display/PlanesMappedDraw.c 2011-09-22 14:25:07.000000000 +0000 @@ -236,20 +236,21 @@ glMaterialdv(GL_FRONT_AND_BACK,GL_AMBIENT,Ambiant); glMateriali(GL_FRONT_AND_BACK,GL_SHININESS,120); glDisable ( GL_LIGHTING ) ; + glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); for(i=0;iN[i0]-1;i++) for(j=0;jN[i1]-1;j++) { - ii = i+1; - jj = j+1; - switch(i0) - { - case 0: - ix = i; - ix1 = ix2 = ii; - ix4 = ix3 = ix; - switch(i1) + ii = i+1; + jj = j+1; + switch(i0) { + case 0: + ix = i; + ix1 = ix2 = ii; + ix4 = ix3 = ix; + switch(i1) + { case 1 : iy = j; iz = ip; iy1 = iy4 = iy; iy2 = iy3 = jj ; iz1 = iz2 = iz3 = iz4 = iz; @@ -258,13 +259,14 @@ iy1 = iy2 = iy3 = iy4 = iy; iz1 = iz4 = iz; iz2 = iz3 = jj ; break; - } - break; - case 1: iy = i; - iy1 = iy2 = ii; - iy3 = iy4 = iy ; - switch(i1) - { + } + break; + case 1: + iy = i; + iy1 = iy2 = ii; + iy3 = iy4 = iy ; + switch(i1) + { case 0 : ix = j; iz = ip; iz1 = iz2 = iz3 = iz4 = iz; ix1 = ix4 = ix; ix2 = ix3 = jj ; @@ -273,8 +275,8 @@ ix1 = ix2 = ix3 = ix4 = ix; iz1 = iz4 = iz; iz2 = iz3 = jj ; break; - } - break; + } + break; case 2: iz = i; iz1 = iz2 = ii; iz3 = iz4 = iz ; @@ -284,55 +286,53 @@ iy1 = iy2 = iy3 = iy4 = iy; ix1 = ix4 = ix; ix2 = ix3 = jj ; break; - case 1 : ix = ip;iy = j; + case 1 : ix = ip;iy = j; ix1 = ix2 = ix3 = ix4 = ix; iy1 = iy4 = iy; iy2 = iy3 = jj ; break; } break; - } - - - glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); - glBegin(GL_POLYGON); - + } - set_Color_From_colorMap(colorMap, Diffuse, plansgrid->point[ix][iy][iz].C[3]); - glMaterialdv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse); - glMaterialdv(GL_FRONT_AND_BACK,GL_AMBIENT,Diffuse); - glColor4dv(Diffuse); - x = plansgrid->point[ix][iy][iz].C[0] + Gap[0]; - y = plansgrid->point[ix][iy][iz].C[1] + Gap[1]; - z = plansgrid->point[ix][iy][iz].C[2] + Gap[2]; - glVertex3f(x,y,z); - - set_Color_From_colorMap(colorMap, Diffuse, plansgrid->point[ix1][iy1][iz1].C[3]); - glMaterialdv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse); - glMaterialdv(GL_FRONT_AND_BACK,GL_AMBIENT,Diffuse); - glColor4dv(Diffuse); - x = plansgrid->point[ix1][iy1][iz1].C[0] + Gap[0]; - y = plansgrid->point[ix1][iy1][iz1].C[1] + Gap[1]; - z = plansgrid->point[ix1][iy1][iz1].C[2] + Gap[2]; - glVertex3f(x,y,z); - set_Color_From_colorMap(colorMap, Diffuse, plansgrid->point[ix2][iy2][iz2].C[3]); - glMaterialdv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse); - glMaterialdv(GL_FRONT_AND_BACK,GL_AMBIENT,Diffuse); - glColor4dv(Diffuse); - x = plansgrid->point[ix2][iy2][iz2].C[0] + Gap[0]; - y = plansgrid->point[ix2][iy2][iz2].C[1] + Gap[1]; - z = plansgrid->point[ix2][iy2][iz2].C[2] + Gap[2]; - glVertex3f(x,y,z); - set_Color_From_colorMap(colorMap, Diffuse, plansgrid->point[ix3][iy3][iz3].C[3]); - glMaterialdv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse); - glMaterialdv(GL_FRONT_AND_BACK,GL_AMBIENT,Diffuse); - glColor4dv(Diffuse); - x = plansgrid->point[ix3][iy3][iz3].C[0] + Gap[0]; - y = plansgrid->point[ix3][iy3][iz3].C[1] + Gap[1]; - z = plansgrid->point[ix3][iy3][iz3].C[2] + Gap[2]; - glVertex3f(x,y,z); - glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); - glEnd(); + glBegin(GL_POLYGON); + set_Color_From_colorMap(colorMap, Diffuse, plansgrid->point[ix][iy][iz].C[3]); + glMaterialdv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse); + glMaterialdv(GL_FRONT_AND_BACK,GL_AMBIENT,Diffuse); + glColor4dv(Diffuse); + x = plansgrid->point[ix][iy][iz].C[0] + Gap[0]; + y = plansgrid->point[ix][iy][iz].C[1] + Gap[1]; + z = plansgrid->point[ix][iy][iz].C[2] + Gap[2]; + glVertex3f(x,y,z); + + set_Color_From_colorMap(colorMap, Diffuse, plansgrid->point[ix1][iy1][iz1].C[3]); + glMaterialdv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse); + glMaterialdv(GL_FRONT_AND_BACK,GL_AMBIENT,Diffuse); + glColor4dv(Diffuse); + x = plansgrid->point[ix1][iy1][iz1].C[0] + Gap[0]; + y = plansgrid->point[ix1][iy1][iz1].C[1] + Gap[1]; + z = plansgrid->point[ix1][iy1][iz1].C[2] + Gap[2]; + glVertex3f(x,y,z); + + set_Color_From_colorMap(colorMap, Diffuse, plansgrid->point[ix2][iy2][iz2].C[3]); + glMaterialdv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse); + glMaterialdv(GL_FRONT_AND_BACK,GL_AMBIENT,Diffuse); + glColor4dv(Diffuse); + x = plansgrid->point[ix2][iy2][iz2].C[0] + Gap[0]; + y = plansgrid->point[ix2][iy2][iz2].C[1] + Gap[1]; + z = plansgrid->point[ix2][iy2][iz2].C[2] + Gap[2]; + glVertex3f(x,y,z); + + set_Color_From_colorMap(colorMap, Diffuse, plansgrid->point[ix3][iy3][iz3].C[3]); + glMaterialdv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse); + glMaterialdv(GL_FRONT_AND_BACK,GL_AMBIENT,Diffuse); + glColor4dv(Diffuse); + x = plansgrid->point[ix3][iy3][iz3].C[0] + Gap[0]; + y = plansgrid->point[ix3][iy3][iz3].C[1] + Gap[1]; + z = plansgrid->point[ix3][iy3][iz3].C[2] + Gap[2]; + glVertex3f(x,y,z); + glEnd(); } + glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); glEnable ( GL_LIGHTING ) ; } /*********************************************************************************************************/ diff -Nru gabedit-2.3.7/src/Display/UtilsOrb.c gabedit-2.4.0/src/Display/UtilsOrb.c --- gabedit-2.3.7/src/Display/UtilsOrb.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Display/UtilsOrb.c 2011-09-22 14:25:07.000000000 +0000 @@ -213,6 +213,7 @@ ktype = GABEDIT_TYPEFILE_GAUSSIAN_FCHK; g_free(t); fclose(fd); + printf("GABEDIT_TYPEFILE_GAUSSIAN_FCHK\n"); return ktype; } rewind(fd); @@ -252,6 +253,11 @@ ktype = GABEDIT_TYPEFILE_QCHEM; break; } + if(strstr(t,"Northwest Computational Chemistry Package")) + { + ktype = GABEDIT_TYPEFILE_NWCHEM; + break; + } g_strup(t); if(strstr(t, "ENTERING GAUSSIAN" )) { @@ -414,6 +420,43 @@ 0 : cartezian 1 : Spherical */ +gint get_type_basis_in_nwchem_file(gchar *fileName) +{ + gchar *t; + FILE *fd; + guint taille=BSIZE; + gint ktype = -1; + + t=g_malloc(taille); + fd = FOpen(fileName, "rb"); + + if(fd ==NULL) + { + gchar buffer[BSIZE]; + sprintf(buffer,_("Sorry, I can not open '%s' file\n"),fileName); + Message(buffer,_("Error"),TRUE); + + g_free(t); + return ktype; + } + ktype = 0; + while(!feof(fd)) + { + fgets(t,taille,fd); + if(strstr( t, "ao basis") && strstr( t, "spherical")) {ktype=1;break;} + if(strstr( t, "ao basis") && strstr( t, "cart")) {ktype=0;break;} + } + fclose(fd); + g_free(t); + return ktype; + +} +/**********************************************************/ +/* return + -1 : undefined + 0 : cartezian + 1 : Spherical +*/ gint get_type_basis_in_qchem_file(gchar *fileName) { gchar *t; diff -Nru gabedit-2.3.7/src/Display/UtilsOrb.h gabedit-2.4.0/src/Display/UtilsOrb.h --- gabedit-2.3.7/src/Display/UtilsOrb.h 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Display/UtilsOrb.h 2011-09-22 14:25:07.000000000 +0000 @@ -35,6 +35,7 @@ gint get_type_basis_in_gamess_file(gchar *fileName); gint get_type_basis_in_gaussian_file(gchar *fileName); gint get_type_basis_in_qchem_file(gchar *fileName); +gint get_type_basis_in_nwchem_file(gchar *fileName); gint get_type_basis_in_gabedit_file(gchar *fileName); gint get_type_basis_in_molden_file(gchar *fileName); gboolean testi(char c); diff -Nru gabedit-2.3.7/src/Display/Vibration.c gabedit-2.4.0/src/Display/Vibration.c --- gabedit-2.3.7/src/Display/Vibration.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Display/Vibration.c 2011-09-22 14:25:07.000000000 +0000 @@ -707,6 +707,290 @@ /* Show all */ gtk_widget_show_all (Win); } +//HERE +/********************************************************************************/ +static void print_gaussian_along_vibration_one_geometry(gchar* fileNameBas, FILE* file, G_CONST_RETURN gchar* keys, gint mode, gdouble delta) +{ + gint i; + gchar ad = '+'; + if(delta<0) ad ='-'; + + fprintf(file,"# %s\n",keys); + fprintf(file,"# Test Symm(PG=C1)\n"); + fprintf(file,"# Units(Ang,Deg)\n"); + fprintf(file,"\nMode: freq=%lf Mass= %lf Q= Qeq %c %lf\n\n", + vibration.modes[mode].frequence, + vibration.modes[mode].effectiveMass, + ad, + fabs(delta)*BOHR_TO_ANG + ); + + fprintf(file,"%d %d\n", totalCharge, spinMultiplicity); + for(i=0;i0;i--) + if(fileNameBas[i]=='.') + { + fileNameBas[i]='\0'; + break; + } + + j = rowSelected; + print_gaussian_along_vibration_one_geometry(fileNameBas, file, allKeys, j, delta); + fclose(file); + if(fileNameBas) g_free(fileNameBas); + gtk_widget_destroy(Win); + { + gchar* t = g_strdup_printf(_("The %s file was created"),fileName); + Message(t,_("Error"),TRUE); + if(t)g_free(t); + } +} +/********************************************************************************/ +static GtkWidget* add_inputGauss_entrys_along_one_frequency(GtkWidget *Wins,GtkWidget *vbox) +{ + GtkWidget* entry; + GtkWidget* sep; + GtkWidget *table = gtk_table_new(11,4,FALSE); + GtkWidget* comboSpinMultiplicity = NULL; + GtkWidget* comboCharge = NULL; + GtkWidget* buttonDirSelector = NULL; + GtkWidget* entryFileName = NULL; + GtkWidget* entryDelta = NULL; + GtkWidget* label = NULL; + gint i; + gint j; + + totalCharge = 0; + spinMultiplicity=1; + + gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); + +/*----------------------------------------------------------------------------------*/ + i = 0; + j = 0; + add_label_table(table,_("Working Folder"),(gushort)i,(gushort)j); + j = 1; + label = gtk_label_new(":"); + gtk_table_attach(GTK_TABLE(table),label, j,j+1,i,i+1, + (GtkAttachOptions)(GTK_FILL|GTK_SHRINK) , + (GtkAttachOptions)(GTK_FILL|GTK_SHRINK), + 1,1); + j = 2; + buttonDirSelector = gtk_file_chooser_button_new(_("Select your folder"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); + gtk_widget_set_size_request(GTK_WIDGET(buttonDirSelector),(gint)(ScreenHeight*0.2),-1); + gtk_table_attach(GTK_TABLE(table),buttonDirSelector, + j,j+4,i,i+1, + (GtkAttachOptions)(GTK_FILL|GTK_EXPAND), + (GtkAttachOptions)(GTK_FILL|GTK_SHRINK), + 1,1); + g_object_set_data(G_OBJECT(Wins), "ButtonDirSelector", buttonDirSelector); +/*----------------------------------------------------------------------------------*/ + i++; + j = 0; + add_label_table(table,_("File name"),(gushort)i,(gushort)j); + j = 1; + label = gtk_label_new(":"); + gtk_table_attach(GTK_TABLE(table),label, j,j+1,i,i+1, + (GtkAttachOptions)(GTK_FILL|GTK_SHRINK) , + (GtkAttachOptions)(GTK_FILL|GTK_SHRINK), + 1,1); + j = 2; + entryFileName = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(entryFileName),"freq.com"); + gtk_widget_set_size_request(GTK_WIDGET(entryFileName),(gint)(ScreenHeight*0.2),-1); + gtk_table_attach(GTK_TABLE(table),entryFileName, j,j+4,i,i+1, + (GtkAttachOptions)(GTK_FILL|GTK_EXPAND), + (GtkAttachOptions)(GTK_FILL|GTK_SHRINK), + 1,1); + g_object_set_data(G_OBJECT(Wins), "EntryFileName", entryFileName); +/*----------------------------------------------------------------------------------*/ + i++; + j = 0; + add_label_table(table,_("Step (Ang)"),(gushort)i,(gushort)j); + j = 1; + label = gtk_label_new(":"); + gtk_table_attach(GTK_TABLE(table),label, j,j+1,i,i+1, + (GtkAttachOptions)(GTK_FILL|GTK_SHRINK) , + (GtkAttachOptions)(GTK_FILL|GTK_SHRINK), + 1,1); + j = 2; + entryDelta = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(entryDelta),"0.1"); + gtk_widget_set_size_request(GTK_WIDGET(entryDelta),(gint)(ScreenHeight*0.2),-1); + gtk_table_attach(GTK_TABLE(table),entryDelta, j,j+4,i,i+1, + (GtkAttachOptions)(GTK_FILL|GTK_EXPAND), + (GtkAttachOptions)(GTK_FILL|GTK_SHRINK), + 1,1); + g_object_set_data(G_OBJECT(Wins), "EntryDelta", entryDelta); +/*----------------------------------------------------------------------------------*/ + i++; + comboCharge = addChargeToTable(table, i); +/*----------------------------------------------------------------------------------*/ + i++; + comboSpinMultiplicity = addSpinToTable(table, i); +/*----------------------------------------------------------------------------------*/ + i++; + sep = gtk_hseparator_new (); + gtk_table_attach(GTK_TABLE(table),sep,0,0+4,i,i+1, + (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), + (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), + 2,2); + + if(GTK_IS_COMBO_BOX(comboCharge)) + g_object_set_data(G_OBJECT (GTK_BIN(comboCharge)->child), "ComboSpinMultiplicity", comboSpinMultiplicity); + setComboCharge(comboCharge); + setComboSpinMultiplicity(comboSpinMultiplicity); + g_signal_connect(G_OBJECT(GTK_BIN(comboCharge)->child),"changed", G_CALLBACK(changedEntryCharge),NULL); +/*----------------------------------------------------------------------------------*/ + i++; + add_label_table(table,_(" Energy keywords "),i,0); + add_label_table(table,":",i,1); + entry = gtk_entry_new (); + g_object_set_data(G_OBJECT(Wins), "EntryEnergyKeywords", entry); + gtk_widget_set_size_request(GTK_WIDGET(entry),-1,32); + gtk_table_attach(GTK_TABLE(table),entry,2,2+4,i,i+1, + (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), + (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), + 3,3); + gtk_entry_set_text (GTK_ENTRY (entry),"B3LYP/6-311++G** SCF(Tight) Int=UltraFine"); + gtk_editable_set_editable((GtkEditable*)entry,TRUE); + gtk_widget_set_sensitive(entry, TRUE); +/*----------------------------------------------------------------------------------*/ + i++; + add_label_table(table,_(" Prop. keywords "),i,0); + add_label_table(table,":",i,1); + entry = gtk_entry_new (); + g_object_set_data(G_OBJECT(Wins), "EntryPropKeywords", entry); + gtk_widget_set_size_request(GTK_WIDGET(entry),-1,32); + gtk_table_attach(GTK_TABLE(table),entry,2,2+4,i,i+1, + (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), + (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), + 3,3); + gtk_entry_set_text (GTK_ENTRY (entry),"NMR"); + gtk_editable_set_editable((GtkEditable*)entry,TRUE); + gtk_widget_set_sensitive(entry, TRUE); +/*----------------------------------------------------------------------------------*/ + i++; + sep = gtk_hseparator_new (); + gtk_table_attach(GTK_TABLE(table),sep,0,0+4,i,i+1, + (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), + (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), + 3,3); +/*----------------------------------------------------------------------------------*/ + i++; + sep = gtk_hseparator_new (); + gtk_table_attach(GTK_TABLE(table),sep,0,0+4,i,i+1, + (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), + (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), + 3,3); +/*----------------------------------------------------------------------------------*/ + + gtk_widget_show_all(table); + return entry; +} +/********************************************************************************************************/ +static void create_gaussian_along_vibration_file_dlg() +{ + GtkWidget *Win; + GtkWidget *frame; + GtkWidget *vboxall; + GtkWidget* vbox; + GtkWidget* entryKeywords; + + if(vibration.numberOfFrequences<1) + { + gchar* t = g_strdup_printf(_("Sorry\n You should read the geometries befor")); + Message(t,_("Error"),TRUE); + return; + } + + /* Principal Window */ + Win = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(Win),"Create a Gaussian input file along the selected mode"); + gtk_window_set_position(GTK_WINDOW(Win),GTK_WIN_POS_CENTER); + gtk_container_set_border_width (GTK_CONTAINER (Win), 2); + gtk_window_set_transient_for(GTK_WINDOW(Win),GTK_WINDOW(PrincipalWindow)); + gtk_window_set_modal (GTK_WINDOW (Win), TRUE); + + add_glarea_child(Win,"Input Gaussian"); + g_signal_connect(G_OBJECT(Win),"delete_event",(GCallback)delete_child,NULL); + + vboxall = create_vbox(Win); + + frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type( GTK_FRAME(frame),GTK_SHADOW_ETCHED_OUT); + gtk_container_set_border_width (GTK_CONTAINER (frame), 2); + gtk_box_pack_start(GTK_BOX(vboxall), frame,TRUE,TRUE,0); + gtk_widget_show (frame); + vbox = gtk_vbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (frame), vbox); + + gtk_widget_realize(Win); + + entryKeywords = add_inputGauss_entrys_along_one_frequency(Win,vbox); + add_cancel_ok_button(Win,vbox,entryKeywords,(GCallback)print_gaussian_along_vibration_geometries); + + /* Show all */ + gtk_widget_show_all (Win); +} /********************************************************************************/ static void reset_last_directory(GtkWidget *dirSelector, gpointer data) { @@ -3625,6 +3909,159 @@ read_qchem_file_frequencies(FileName); } /********************************************************************************/ +static gboolean read_nwchem_file_frequencies(gchar *FileName) +{ + gchar t[BSIZE]; + gchar sdum1[BSIZE]; + gboolean OK; + FILE *fd; + guint taille=BSIZE; + gint idum; + gint nf; + + gdouble freq[6] = {0,0,0,0,0,0}; + gdouble IRIntensity[6] = {0,0,0,0,0,0}; + gdouble mass[6] = {1,1,1,1,1,1}; + gdouble RamanIntensity[6]={0,0,0,0,0,0}; + gdouble v[6][3]; + gchar sym[6][BSIZE]; + gint i; + gint j; + gint k; + gint nfOld; + + + Dipole.def = FALSE; + free_vibration(); + vibration.numberOfAtoms = Ncenters; + vibration.geometry = g_malloc(Ncenters*sizeof(VibrationGeom)); + for(j=0;j=2 ) + { + fgets(t,taille,fd); + fgets(t,taille,fd); + fgets(t,taille,fd); + fgets(t,taille,fd); + OK = TRUE; + break; + } + } + if(!OK) break; + while(!feof(fd) ) + { + nf = sscanf(t,"%d %d %d %d %d %d",&idum,&idum,&idum,&idum,&idum,&idum); + if(nf<1) break; + for(i=0;i<6;i++) sprintf(sym[i],"UNKNOWN"); + + if(!fgets(t,taille,fd)) break;/* back space line */ + if(!fgets(t,taille,fd)) break; + sscanf(t,"%s %lf %lf %lf %lf %lf %lf", sdum1,&freq[0],&freq[1],&freq[2],&freq[3],&freq[4],&freq[5]); + if(!fgets(t,taille,fd)) break;/* back space line */ + + for(i=0;i<6;i++) RamanIntensity[i] = 0; + + nfOld = vibration.numberOfFrequences; + vibration.numberOfFrequences += nf; + vibration.modes = g_realloc( vibration.modes, vibration.numberOfFrequences*sizeof(VibrationMode)); + + for(k=0;k\n" " \n" " \n" +" \n" " \n" " \n" " \n" @@ -4664,6 +5113,7 @@ " \n" " \n" " \n" +" \n" " \n" " \n" " \n" @@ -4686,11 +5136,13 @@ " \n" " \n" " \n" +" \n" " \n" " \n" " \n" " \n" " \n" +" \n" " \n" " \n" " \n" @@ -4829,6 +5281,7 @@ else if(fileType == GABEDIT_TYPEFILE_MOPAC_AUX) read_mopac_aux_file(selecFile, response_id); else if(fileType == GABEDIT_TYPEFILE_ORCA) read_orca_file(selecFile, response_id); else if(fileType == GABEDIT_TYPEFILE_QCHEM) read_qchem_file(selecFile, response_id); + else if(fileType == GABEDIT_TYPEFILE_NWCHEM) read_nwchem_file(selecFile, response_id); else if(fileType == GABEDIT_TYPEFILE_GABEDIT) read_gabedit_molden_file(selecFile, response_id); else if(fileType == GABEDIT_TYPEFILE_MOLDEN) read_gabedit_molden_file(selecFile, response_id); else if(fileType == GABEDIT_TYPEFILE_UNKNOWN) diff -Nru gabedit-2.3.7/src/Files/Dep.mk gabedit-2.4.0/src/Files/Dep.mk --- gabedit-2.3.7/src/Files/Dep.mk 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Files/Dep.mk 2011-09-22 15:59:32.000000000 +0000 @@ -20,10 +20,10 @@ ../../pixmaps/GamessMini.xpm ../../pixmaps/FireFlyMini.xpm \ ../../pixmaps/Gaussian.xpm ../../pixmaps/MolproMini.xpm \ ../../pixmaps/MolcasMini.xpm ../../pixmaps/MPQCMini.xpm \ - ../../pixmaps/OrcaMini.xpm ../../pixmaps/QChemMini.xpm \ - ../../pixmaps/MopacMini.xpm ../../pixmaps/GabeditMini.xpm \ - ../../pixmaps/Book_close.xpm ../../pixmaps/Page.xpm \ - ../Common/StockIcons.h ../Files/ListeFiles.h + ../../pixmaps/NWChemMini.xpm ../../pixmaps/OrcaMini.xpm \ + ../../pixmaps/QChemMini.xpm ../../pixmaps/MopacMini.xpm \ + ../../pixmaps/GabeditMini.xpm ../../pixmaps/Book_close.xpm \ + ../../pixmaps/Page.xpm ../Common/StockIcons.h ../Files/ListeFiles.h GabeditFolderChooser.o: GabeditFolderChooser.c ../../Config.h \ GabeditFolderChooser.h GabeditFileChooser.o: GabeditFileChooser.c ../../Config.h \ diff -Nru gabedit-2.3.7/src/Files/FileChooser.c gabedit-2.4.0/src/Files/FileChooser.c --- gabedit-2.3.7/src/Files/FileChooser.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Files/FileChooser.c 2011-09-22 14:25:07.000000000 +0000 @@ -34,7 +34,7 @@ { GtkWidget *gabeditFileChooser; gchar* patternsfiles[] = { "*", - "*.inp","*.com","*.mop", + "*.inp","*.com","*.mop","*.nw", "*.log","*.out","*.fchk", "*.aux","*.gab","*.xyz","*.mol2","*.mol","*.tnk","*.pdb","*.hin","*.zmt","*.gzmt", "*.hf","*.gcube","*.cube","*.CUBE","*.grid","*.M2Msi","*.t41","*.dx","*.trj","*.irc","*.txt","*", NULL}; @@ -101,6 +101,10 @@ gabedit_file_chooser_set_filter(GABEDIT_FILE_CHOOSER(gabeditFileChooser),"*.out"); temp = g_strdup_printf("%s.out",fileopen.projectname); break; + case GABEDIT_TYPEFILE_NWCHEM : + gabedit_file_chooser_set_filter(GABEDIT_FILE_CHOOSER(gabeditFileChooser),"*.out"); + temp = g_strdup_printf("%s.out",fileopen.projectname); + break; case GABEDIT_TYPEFILE_MOPAC : gabedit_file_chooser_set_filter(GABEDIT_FILE_CHOOSER(gabeditFileChooser),"*.out"); temp = g_strdup_printf("%s.out",fileopen.projectname); @@ -153,6 +157,10 @@ gabedit_file_chooser_set_filter(GABEDIT_FILE_CHOOSER(gabeditFileChooser),"*.hin"); temp = g_strdup_printf("%s.hin",fileopen.projectname); break; + case GABEDIT_TYPEFILE_AIMALL : + gabedit_file_chooser_set_filter(GABEDIT_FILE_CHOOSER(gabeditFileChooser),"*.sum"); + temp = g_strdup_printf("%s.sum",fileopen.projectname); + break; case GABEDIT_TYPEFILE_GZMAT : gabedit_file_chooser_set_filter(GABEDIT_FILE_CHOOSER(gabeditFileChooser),"*.gzmt"); temp = g_strdup_printf("%s.gzmt",fileopen.projectname); @@ -193,6 +201,10 @@ gabedit_file_chooser_set_filter(GABEDIT_FILE_CHOOSER(gabeditFileChooser),"*.inp"); temp = g_strdup_printf("%s.inp",fileopen.projectname); break; + case GABEDIT_TYPEFILE_NWCHEMINPUT : + gabedit_file_chooser_set_filter(GABEDIT_FILE_CHOOSER(gabeditFileChooser),"*.nw"); + temp = g_strdup_printf("%s.nw",fileopen.projectname); + break; case GABEDIT_TYPEFILE_MOPACINPUT : gabedit_file_chooser_set_filter(GABEDIT_FILE_CHOOSER(gabeditFileChooser),"*.mop"); temp = g_strdup_printf("%s.mop",fileopen.projectname); @@ -346,7 +358,7 @@ void choose_file_to_open() { GtkWidget *gabeditFileChooser; - gchar* patternsfiles[] = {"*.com","*.mop","*.inp","*.xyz","*.zmt","*.gzmt","*",NULL}; + gchar* patternsfiles[] = {"*.com","*.mop","*.inp","*.nw","*.xyz","*.zmt","*.gzmt","*",NULL}; gabeditFileChooser = gabedit_file_chooser_new(_("Open file"), GTK_FILE_CHOOSER_ACTION_OPEN); gabedit_file_chooser_hide_hidden(GABEDIT_FILE_CHOOSER(gabeditFileChooser)); diff -Nru gabedit-2.3.7/src/Files/ListeFiles.c gabedit-2.4.0/src/Files/ListeFiles.c --- gabedit-2.3.7/src/Files/ListeFiles.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Files/ListeFiles.c 2011-09-22 14:25:07.000000000 +0000 @@ -48,6 +48,7 @@ #include "../../pixmaps/MolproMini.xpm" #include "../../pixmaps/MolcasMini.xpm" #include "../../pixmaps/MPQCMini.xpm" +#include "../../pixmaps/NWChemMini.xpm" #include "../../pixmaps/OrcaMini.xpm" #include "../../pixmaps/QChemMini.xpm" #include "../../pixmaps/MopacMini.xpm" @@ -64,6 +65,7 @@ static GdkPixbuf *molproPixbuf = NULL; static GdkPixbuf *mpqcPixbuf = NULL; static GdkPixbuf *fireflyPixbuf = NULL; +static GdkPixbuf *nwchemPixbuf = NULL; static GdkPixbuf *orcaPixbuf = NULL; static GdkPixbuf *qchemPixbuf = NULL; static GdkPixbuf *mopacPixbuf = NULL; @@ -115,6 +117,7 @@ if(!molcasPixbuf) molcasPixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) molcas_mini_xpm); if(!molproPixbuf) molproPixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) molpro_mini_xpm); if(!mpqcPixbuf) mpqcPixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) mpqc_mini_xpm); + if(!nwchemPixbuf) nwchemPixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) nwchem_mini_xpm); if(!orcaPixbuf) orcaPixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) orca_mini_xpm); if(!qchemPixbuf) qchemPixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) qchem_mini_xpm); if(!mopacPixbuf) mopacPixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) mopac_mini_xpm); @@ -250,6 +253,12 @@ fileopen.logfile = g_strdup_printf("%s.out",fileopen.projectname); fileopen.moldenfile=g_strdup_printf("%s.out",fileopen.projectname); } + else if(data->itype == PROG_IS_NWCHEM) + { + fileopen.outputfile = g_strdup_printf("%s.out",fileopen.projectname); + fileopen.logfile = g_strdup_printf("%s.out",fileopen.projectname); + fileopen.moldenfile=g_strdup_printf("%s.out",fileopen.projectname); + } else if(data->itype == PROG_IS_MOPAC) { fileopen.outputfile = g_strdup_printf("%s.out",fileopen.projectname); @@ -643,6 +652,7 @@ data->itype == PROG_IS_MOLPRO || data->itype == PROG_IS_MPQC || data->itype == PROG_IS_ORCA || data->itype == PROG_IS_QCHEM + || data->itype == PROG_IS_NWCHEM || data->itype == PROG_IS_MOPAC || data->itype == PROG_IS_GAMESS || data->itype == PROG_IS_FIREFLY @@ -683,6 +693,9 @@ case PROG_IS_QCHEM : t = g_strdup_printf("%s, %s.out, %s.out, %s.out",data->datafile,data->projectname,data->projectname,data->projectname); break; + case PROG_IS_NWCHEM : + t = g_strdup_printf("%s, %s.out, %s.out, %s.out",data->datafile,data->projectname,data->projectname,data->projectname); + break; case PROG_IS_MOPAC : t = g_strdup_printf("%s, %s.out, %s.aux, %s.out",data->datafile,data->projectname,data->projectname,data->projectname); @@ -954,7 +967,7 @@ LabelLeft[2] = g_strdup(_("Directory")); - if(data->itype == PROG_IS_GAUSS || data->itype == PROG_IS_MOLCAS || data->itype == PROG_IS_MOLPRO || data->itype == PROG_IS_MPQC || data->itype == PROG_IS_GAMESS || data->itype == PROG_IS_FIREFLY || data->itype == PROG_IS_QCHEM || data->itype == PROG_IS_MOPAC || data->itype == PROG_IS_ORCA ) + if(data->itype == PROG_IS_GAUSS || data->itype == PROG_IS_MOLCAS || data->itype == PROG_IS_MOLPRO || data->itype == PROG_IS_MPQC || data->itype == PROG_IS_GAMESS || data->itype == PROG_IS_FIREFLY || data->itype == PROG_IS_QCHEM || data->itype == PROG_IS_NWCHEM || data->itype == PROG_IS_MOPAC || data->itype == PROG_IS_ORCA ) LabelLeft[3] = g_strdup(_("Files")); else LabelLeft[3] = g_strdup(_("File")); @@ -1027,6 +1040,10 @@ t = g_strdup_printf("%s, %s.out",data->datafile,data->projectname); break; + case PROG_IS_NWCHEM : + t = g_strdup_printf("%s, %s.out",data->datafile,data->projectname); + break; + case PROG_IS_MOPAC : t = g_strdup_printf("%s, %s.out, %s.aux",data->datafile,data->projectname,data->projectname); break; @@ -1074,7 +1091,7 @@ LabelLeft[0] = g_strdup(_("Host")); LabelLeft[1] = g_strdup(_("Login")); LabelLeft[2] = g_strdup(_("Directory")); - if(data->itype == PROG_IS_GAUSS || data->itype == PROG_IS_MOLCAS ||data->itype == PROG_IS_MOLPRO || data->itype == PROG_IS_MPQC || data->itype == PROG_IS_GAMESS || data->itype == PROG_IS_FIREFLY || data->itype == PROG_IS_QCHEM || data->itype == PROG_IS_MOPAC || data->itype == PROG_IS_ORCA ) + if(data->itype == PROG_IS_GAUSS || data->itype == PROG_IS_MOLCAS ||data->itype == PROG_IS_MOLPRO || data->itype == PROG_IS_MPQC || data->itype == PROG_IS_GAMESS || data->itype == PROG_IS_FIREFLY || data->itype == PROG_IS_QCHEM || data->itype == PROG_IS_NWCHEM || data->itype == PROG_IS_MOPAC || data->itype == PROG_IS_ORCA ) LabelLeft[3] = g_strdup(_("Files")); else LabelLeft[3] = g_strdup(_("File")); @@ -1134,6 +1151,10 @@ t = g_strdup_printf("%s, %s.out",data->datafile,data->projectname); break; + case PROG_IS_NWCHEM : + t = g_strdup_printf("%s, %s.out",data->datafile,data->projectname); + break; + case PROG_IS_MOPAC : t = g_strdup_printf("%s, %s.out, %s.aux",data->datafile,data->projectname, data->projectname); break; @@ -1690,6 +1711,7 @@ set_fileopen(data); + if(iprogram == PROG_IS_MOLPRO ) read_geom_in_molpro_input(NomFichier); else if(iprogram == PROG_IS_GAUSS) read_geom_in_gauss_input(NomFichier); else if(iprogram == PROG_IS_GAMESS) read_geom_in_gamess_input(NomFichier); @@ -1701,9 +1723,12 @@ } else if(iprogram == PROG_IS_MPQC) read_geom_in_mpqc_input(NomFichier); else if(iprogram == PROG_IS_QCHEM) read_geom_in_qchem_input(NomFichier); + else if(iprogram == PROG_IS_NWCHEM) read_geom_in_nwchem_input(NomFichier); else if(iprogram == PROG_IS_ORCA) read_geom_in_orca_input(NomFichier); else if(iprogram == PROG_IS_MOPAC) read_geom_in_mopac_input(NomFichier); +/* printf("iprogram=%d nwchem=%d orca=%d\n",iprogram,PROG_IS_NWCHEM,PROG_IS_ORCA);*/ + data_modify(FALSE); if(GeomConvIsOpen) find_energy_all(NULL,NULL); @@ -1726,6 +1751,7 @@ case GABEDIT_TYPENODE_FIREFLY: case GABEDIT_TYPENODE_ORCA: case GABEDIT_TYPENODE_QCHEM: + case GABEDIT_TYPENODE_NWCHEM: case GABEDIT_TYPENODE_MOPAC: case NBNOD-1: if(imodif == DATA_MOD_YES) @@ -1889,6 +1915,7 @@ noeud[GABEDIT_TYPENODE_MOLPRO]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Molpro"); noeud[GABEDIT_TYPENODE_MOPAC]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Mopac"); noeud[GABEDIT_TYPENODE_MPQC]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"MPQC"); + noeud[GABEDIT_TYPENODE_NWCHEM]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"NWChem"); noeud[GABEDIT_TYPENODE_ORCA]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"ORCA"); noeud[GABEDIT_TYPENODE_QCHEM]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Q-Chem"); noeud[GABEDIT_TYPENODE_GABEDIT]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Gabedit"); @@ -2003,6 +2030,7 @@ noeud[GABEDIT_TYPENODE_MOLPRO]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Molpro"); noeud[GABEDIT_TYPENODE_MOPAC]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Mopac"); noeud[GABEDIT_TYPENODE_MPQC]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"MPQC"); + noeud[GABEDIT_TYPENODE_NWCHEM]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"NWChem"); noeud[GABEDIT_TYPENODE_ORCA]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"ORCA"); noeud[GABEDIT_TYPENODE_QCHEM]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Q-Chem"); noeud[GABEDIT_TYPENODE_GABEDIT]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Gabedit"); @@ -2074,6 +2102,7 @@ noeud[GABEDIT_TYPENODE_MOLPRO]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Molpro"); noeud[GABEDIT_TYPENODE_MOPAC]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Mopac"); noeud[GABEDIT_TYPENODE_MPQC]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"MPQC"); + noeud[GABEDIT_TYPENODE_NWCHEM]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"NWChem"); noeud[GABEDIT_TYPENODE_ORCA]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"ORCA"); noeud[GABEDIT_TYPENODE_QCHEM]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Q-Chem"); noeud[GABEDIT_TYPENODE_GABEDIT]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Gabedit"); @@ -2212,6 +2241,8 @@ else if(strstr(t,"MPQC")) gtk_tree_store_set (store, node, LIST_PIXBUF, mpqcPixbuf, -1); else + if(strstr(t,"NWCHEM")) gtk_tree_store_set (store, node, LIST_PIXBUF, nwchemPixbuf, -1); + else if(strstr(t,"ORCA")) gtk_tree_store_set (store, node, LIST_PIXBUF, orcaPixbuf, -1); else if(strstr(t,"Q-CHEM")) gtk_tree_store_set (store, node, LIST_PIXBUF, qchemPixbuf, -1); @@ -2373,20 +2404,21 @@ GtkWidget *button; gchar * title = N_("Clear list of projects"); gchar *buttonlabel[NBNOD]={ + "FireFly list", "Gamess list", "Gaussian list", "Molcas list", "Molpro list", "Mopac list", "MPQC list", + "NWChem list", "Orca list", - "FireFly list", "Q-Chem list", "Gabedit list", "xyz list", "Mol2 list", - "Tinker list", "PDB list", + "Tinker list", "Gaussian z-matrix list", "Mopac z-matrix list", "HypercChem (hin) list", @@ -2546,6 +2578,7 @@ noeud[GABEDIT_TYPENODE_MOLPRO]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Molpro"); noeud[GABEDIT_TYPENODE_MOPAC]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Mopac"); noeud[GABEDIT_TYPENODE_MPQC]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"MPQC"); + noeud[GABEDIT_TYPENODE_NWCHEM]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"NWChem"); noeud[GABEDIT_TYPENODE_ORCA]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"ORCA"); noeud[GABEDIT_TYPENODE_QCHEM]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Q-Chem"); noeud[GABEDIT_TYPENODE_GABEDIT]=CreeNoeud(GTK_TREE_VIEW(treeViewProjects),"Gabedit"); diff -Nru gabedit-2.3.7/src/Gaussian/Gaussian.c gabedit-2.4.0/src/Gaussian/Gaussian.c --- gabedit-2.3.7/src/Gaussian/Gaussian.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Gaussian/Gaussian.c 2011-09-22 14:25:07.000000000 +0000 @@ -744,7 +744,7 @@ { if(Variables[i].Used) { - gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL,_("Variables :\n"),-1); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL,"Variables :\n",-1); break; } } diff -Nru gabedit-2.3.7/src/Geometry/DrawGeomCairo.c gabedit-2.4.0/src/Geometry/DrawGeomCairo.c --- gabedit-2.3.7/src/Geometry/DrawGeomCairo.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Geometry/DrawGeomCairo.c 2011-09-22 14:25:07.000000000 +0000 @@ -10997,7 +10997,7 @@ StatusRotation = Status; gtk_statusbar_pop(GTK_STATUSBAR(StatusRotation),idStatusRotation); gtk_statusbar_push(GTK_STATUSBAR(StatusRotation),idStatusRotation, - _(" Press the Midle mouse button and move your mouse for a \"Rotation\". ")); + _(" Press the Middle mouse button and move your mouse for a \"Rotation\". ")); /* Mode Status */ diff -Nru gabedit-2.3.7/src/Geometry/DrawGeomGL.c gabedit-2.4.0/src/Geometry/DrawGeomGL.c --- gabedit-2.3.7/src/Geometry/DrawGeomGL.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Geometry/DrawGeomGL.c 2011-09-22 14:25:07.000000000 +0000 @@ -10102,6 +10102,7 @@ void drawGeom() { if(!GeomDrawingArea) return; + if(!GTK_IS_WIDGET(GeomDrawingArea)) return; redraw(GeomDrawingArea); } /*****************************************************************************/ @@ -10952,7 +10953,7 @@ StatusRotation = Status; gtk_statusbar_pop(GTK_STATUSBAR(StatusRotation),idStatusRotation); gtk_statusbar_push(GTK_STATUSBAR(StatusRotation),idStatusRotation, - _(" Press the Midle mouse button and move your mouse for a \"Rotation\". ")); + _(" Press the Middle mouse button and move your mouse for a \"Rotation\". ")); /* Mode Status */ diff -Nru gabedit-2.3.7/src/Geometry/EnergiesCurves.c gabedit-2.4.0/src/Geometry/EnergiesCurves.c --- gabedit-2.3.7/src/Geometry/EnergiesCurves.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Geometry/EnergiesCurves.c 2011-09-22 14:25:07.000000000 +0000 @@ -69,6 +69,7 @@ if(GeomConv->fileType == GABEDIT_TYPEFILE_GAUSSIAN) read_geom_from_gaussian_file(GeomConv->GeomFile,GeomConv->NumGeom[k]); if(GeomConv->fileType == GABEDIT_TYPEFILE_MOLPRO) read_geom_from_molpro_file(GeomConv->GeomFile,GeomConv->NumGeom[k]); if(GeomConv->fileType == GABEDIT_TYPEFILE_QCHEM) read_geom_from_qchem_file(GeomConv->GeomFile,GeomConv->NumGeom[k]); + if(GeomConv->fileType == GABEDIT_TYPEFILE_NWCHEM) read_geom_from_nwchem_file(GeomConv->GeomFile,GeomConv->NumGeom[k]); if(GeomConv->fileType == GABEDIT_TYPEFILE_ORCA) read_geom_from_orca_file(GeomConv->GeomFile,GeomConv->NumGeom[k]); if(GeomConv->fileType == GABEDIT_TYPEFILE_MOLDEN) read_geom_from_molden_geom_conv_file(GeomConv->GeomFile,GeomConv->NumGeom[k]); if(GeomConv->fileType == GABEDIT_TYPEFILE_GABEDIT) read_geom_from_gabedit_geom_conv_file(GeomConv->GeomFile,GeomConv->NumGeom[k]); @@ -580,7 +581,10 @@ Message(_("Sorry\n I can not read energies from your molpro log file\n"),_("Error"),TRUE); break; case GABEDIT_TYPEFILE_QCHEM : - Message(_("Sorry\n I can not read energies from your molpro log file\n"),_("Error"),TRUE); + Message(_("Sorry\n I can not read energies from your qchem output file\n"),_("Error"),TRUE); + break; + case GABEDIT_TYPEFILE_NWCHEM : + Message(_("Sorry\n I can not read energies from your nwchem output file\n"),_("Error"),TRUE); break; case GABEDIT_TYPEFILE_MOLDEN : Message(_("Sorry\n I can not read energies from your molden file\n"),_("Error"),TRUE); @@ -736,6 +740,9 @@ case GABEDIT_TYPEFILE_QCHEM : Message(_("Sorry\n I can not read energies from your q-chem output file\n"),_("Error"),TRUE); break; + case GABEDIT_TYPEFILE_NWCHEM : + Message(_("Sorry\n I can not read energies from your nwchem output file\n"),_("Error"),TRUE); + break; case GABEDIT_TYPEFILE_MOLDEN : Message(_("Sorry\n I can not read energies from your molden file\n"),_("Error"),TRUE); break; diff -Nru gabedit-2.3.7/src/Geometry/GeomConversion.c gabedit-2.4.0/src/Geometry/GeomConversion.c --- gabedit-2.3.7/src/Geometry/GeomConversion.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Geometry/GeomConversion.c 2011-09-22 14:25:07.000000000 +0000 @@ -186,7 +186,7 @@ guint k; gdouble angle; gdouble dihsgn; - static gdouble precision = 1e-6; + static gdouble precision = 1e-4; W1 = gxyz[i].P; W2 = gxyz[j].P; @@ -371,10 +371,11 @@ k = i-1; if(k!=-1) { - A = get_X_position(k,k+1); - insert_dummy_atom_gxyz(k,A); - Ok = TRUE; - break; + printf("Warning : insert dummy atom : %d %d %d %d are linear\n",i-2,i-1,i,i+1); + A = get_X_position(k,k+1); + insert_dummy_atom_gxyz(k,A); + Ok = TRUE; + break; } } } diff -Nru gabedit-2.3.7/src/Geometry/GeomXYZ.c gabedit-2.4.0/src/Geometry/GeomXYZ.c --- gabedit-2.3.7/src/Geometry/GeomXYZ.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Geometry/GeomXYZ.c 2011-09-22 14:25:07.000000000 +0000 @@ -221,7 +221,7 @@ SpinElectrons[i]=0; for(i=0;i2) - break; + if(ngrad>2) + break; + } + + } +} +/********************************************************************************/ +void read_geom_from_qchem_file(gchar *NomFichier, gint numgeometry) +{ + gchar *t; + gboolean OK; + gchar *AtomCoord[5]; + FILE *fd; + guint taille=BSIZE; + guint idummy; + guint i; + gint j=0; + gint l; + gint numgeom; + gchar *pdest; + long int geomposok = 0; + + for(i=0;i<5;i++) AtomCoord[i]=g_malloc(taille*sizeof(gchar)); + + t=g_malloc(taille*sizeof(gchar)); + fd = FOpen(NomFichier, "r"); + if(fd ==NULL) + { + g_free(t); + t = g_strdup_printf(_("Sorry\nI can not open %s file "),NomFichier); + MessageGeom(t,_("Error"),TRUE); + g_free(t); + return; + } + numgeom =0; + OK=FALSE; + while(!feof(fd)) + { + if(!fgets(t,taille,fd))break; + pdest = strstr( t, "Atom X Y Z"); + if(pdest) + { + if(!fgets(t,taille,fd))break; + pdest = strstr( t, "----------------------------------------"); + } + if ( pdest ) + { + numgeom++; + geomposok = ftell(fd); + if(numgeom == numgeometry ) + { + OK = TRUE; + break; + } + if(numgeometry<0) + { + OK = TRUE; + } + } + } + if(numgeom == 0) + { + g_free(t); + t = g_strdup_printf(_("Sorry\nI can not read geometry in %s file "),NomFichier); + MessageGeom(t,_("Error"),TRUE); + g_free(t); + return; + } + j=-1; + fseek(fd, geomposok, SEEK_SET); + while(!feof(fd) ) + { + if(!fgets(t,taille,fd))break; + pdest = strstr( t, "----------------------------------" ); + if (pdest) + { + geomposok = ftell(fd); + get_charges_from_qchem_output_file(fd,j+1); + fseek(fd, geomposok, SEEK_SET); + get_dipole_from_qchem_output_file(fd); + break; + } + j++; + if(GeomXYZ==NULL) GeomXYZ=g_malloc(sizeof(GeomXYZAtomDef)); + else GeomXYZ=g_realloc(GeomXYZ,(j+1)*sizeof(GeomXYZAtomDef)); + GeomXYZ[j].typeConnections = NULL; + + sscanf(t,"%d %s %s %s %s",&idummy,AtomCoord[0],AtomCoord[1],AtomCoord[2],AtomCoord[3]); + AtomCoord[0][0]=toupper(AtomCoord[0][0]); + l=strlen(AtomCoord[0]); + if(isdigit(AtomCoord[0][1]))l=1; + if (l==2) AtomCoord[0][1]=tolower(AtomCoord[0][1]); + if(l==1)sprintf(t,"%c",AtomCoord[0][0]); + else sprintf(t,"%c%c",AtomCoord[0][0],AtomCoord[0][1]); + + GeomXYZ[j].Nentry=NUMBER_LIST_XYZ; + GeomXYZ[j].Symb=g_strdup(t); + GeomXYZ[j].mmType=g_strdup(GeomXYZ[j].Symb); + GeomXYZ[j].pdbType=g_strdup(GeomXYZ[j].Symb); + GeomXYZ[j].Residue=g_strdup(GeomXYZ[j].Symb); + GeomXYZ[j].ResidueNumber=0; + if(Units == 0 ) + { + GeomXYZ[j].X=g_strdup(ang_to_bohr(AtomCoord[1])); + GeomXYZ[j].Y=g_strdup(ang_to_bohr(AtomCoord[2])); + GeomXYZ[j].Z=g_strdup(ang_to_bohr(AtomCoord[3])); + } + else + { + GeomXYZ[j].X=g_strdup(AtomCoord[1]); + GeomXYZ[j].Y=g_strdup(AtomCoord[2]); + GeomXYZ[j].Z=g_strdup(AtomCoord[3]); + } + GeomXYZ[j].Charge=g_strdup("0.0"); + GeomXYZ[j].Layer=g_strdup(" "); + } + NcentersXYZ = j+1; + + fclose(fd); + calculMMTypes(FALSE); + g_free(t); + for(i=0;i<5;i++) g_free(AtomCoord[i]); + if(GeomIsOpen && MethodeGeom == GEOM_IS_XYZ) + { + clearList(list); + append_list(); + } + MethodeGeom = GEOM_IS_XYZ; + if(GeomDrawingArea != NULL) rafresh_drawing(); + if(iprogram == PROG_IS_GAUSS && GeomIsOpen) set_spin_of_electrons(); +} +/********************************************************************************/ +void get_charges_from_nwchem_output_file(FILE* fd,gint N) +{ + guint taille=BSIZE; + gchar t[BSIZE]; + gchar d3[BSIZE]; + gchar d4[BSIZE]; + gchar d[BSIZE]; + gchar* pdest; + gint i; + + + for(i=0;i=2) AtomCoord[0][1]=tolower(AtomCoord[0][1]); + + GeomXYZtemp[j].Nentry=NUMBER_LIST_XYZ; + get_symb_type_charge(AtomCoord[0],symb,type,charge); + { + gint k; + for(k=0;k<(gint)strlen(symb);k++) if(isdigit(symb[k])) symb[k] = ' '; + delete_all_spaces(symb); + } + + GeomXYZtemp[j].Symb=g_strdup(symb); + GeomXYZtemp[j].mmType=g_strdup(type); + GeomXYZtemp[j].pdbType=g_strdup(type); + GeomXYZtemp[j].Charge=g_strdup(charge); + + GeomXYZtemp[j].Residue=g_strdup("DUM"); + GeomXYZtemp[j].ResidueNumber=0; + if(!test(AtomCoord[1]) || !test(AtomCoord[2]) || !test(AtomCoord[3])) Uvar = TRUE; + GeomXYZtemp[j].X=g_strdup(AtomCoord[1]); + GeomXYZtemp[j].Y=g_strdup(AtomCoord[2]); + GeomXYZtemp[j].Z=g_strdup(AtomCoord[3]); + + GeomXYZtemp[j].Layer=g_strdup(" "); + GeomXYZtemp[j].typeConnections = NULL; + } + else + OK = FALSE; + } +/* Variables */ + Nvar=0; + fseek(file, 0L, SEEK_SET); + if(Uvar) + { + OK =FALSE; + while(!feof(file) && Uvar) + { + if(!fgets(t,taille,file)) break; + g_strup(t); + if(strstr(t,"VARIABLE")) + { + OK = TRUE; + break; + } + } + } + while(!feof(file) && Uvar && OK ) + { + g_strup(t); + for(k=0;k<(gint)strlen(t);k++) if(t[k]=='=') t[k] = ' '; + for(j=0;j5 && strstr(t,"MULT") && sscanf(strstr(t,"MULT")+4,"%d",&k) && k>0 ) mult=k; + if(strlen(t)>6 && strstr(t,"NOPEN") && sscanf(strstr(t,"NOOPEN")+5,"%d",&k) && k>0 ) mult=2*k; + if(mult>0 && icharge) break; + } + fclose(file); + g_free(t); + if(OK) + { + TotalCharges[0] = globalCharge; + if(mult>0) SpinMultiplicities[0] = mult; + else reset_spin_of_electrons(); + } + + for(i=0;i<5;i++) g_free(AtomCoord[i]); + if( !OK || Ncent <1 ) + { + FreeGeomXYZ(GeomXYZtemp,VariablesXYZtemp,Ncent, Nvar); + MessageGeom(_("Sorry\n I can not read geometry in NWChem input file"),_("Error"),TRUE); + return; + } + if(GeomXYZ) freeGeomXYZ(GeomXYZ); + if(VariablesXYZ) freeVariablesXYZ(VariablesXYZ); + GeomXYZ = GeomXYZtemp; + NcentersXYZ = Ncent; + NVariablesXYZ = Nvar; + VariablesXYZ = VariablesXYZtemp; + MethodeGeom = GEOM_IS_XYZ; + calculMMTypes(FALSE); + if( Units== 0 ) GeomXYZ_Change_Unit(FALSE); + if(GeomIsOpen) + create_geomXYZ_interface (GABEDIT_TYPEFILEGEOM_UNKNOWN); + + if(GeomDrawingArea != NULL) + rafresh_drawing(); + set_last_directory(NomFichier); +} +/*************************************************************************************/ void read_XYZ_from_orca_input_file(gchar *NomFichier) { gchar *t; @@ -11464,6 +12045,7 @@ gchar* patternsmol2[] = {"*.mol2","*",NULL}; gchar* patternspdb[] = {"*.pdb","*",NULL}; gchar* patternshin[] = {"*.hin","*",NULL}; + gchar* patternsaimall[] = {"*.sum","*",NULL}; gchar* patternstnk[] = {"*.tnk","*",NULL}; gchar* patternslog[] = {"*.log","*",NULL}; gchar* patternsout[] = {"*.out","*.log","*",NULL}; @@ -11553,13 +12135,21 @@ gabedit_file_chooser_set_filters(GABEDIT_FILE_CHOOSER(SelecFile),patternsout); break; case GABEDIT_TYPEFILEGEOM_ORCAOUTFIRST : - SelecFile = gabedit_file_chooser_new(_("Read the first geometry from a ORCA-Chem output file"), GTK_FILE_CHOOSER_ACTION_OPEN); + SelecFile = gabedit_file_chooser_new(_("Read the first geometry from a ORCA output file"), GTK_FILE_CHOOSER_ACTION_OPEN); gabedit_file_chooser_set_filters(GABEDIT_FILE_CHOOSER(SelecFile),patternsout); break; case GABEDIT_TYPEFILEGEOM_ORCAOUTLAST : SelecFile = gabedit_file_chooser_new(_("Read the last geometry from a ORCA output file"), GTK_FILE_CHOOSER_ACTION_OPEN); gabedit_file_chooser_set_filters(GABEDIT_FILE_CHOOSER(SelecFile),patternsout); break; + case GABEDIT_TYPEFILEGEOM_NWCHEMOUTFIRST : + SelecFile = gabedit_file_chooser_new(_("Read the first geometry from a NWCHEM output file"), GTK_FILE_CHOOSER_ACTION_OPEN); + gabedit_file_chooser_set_filters(GABEDIT_FILE_CHOOSER(SelecFile),patternsout); + break; + case GABEDIT_TYPEFILEGEOM_NWCHEMOUTLAST : + SelecFile = gabedit_file_chooser_new(_("Read the last geometry from a NWCHEM output file"), GTK_FILE_CHOOSER_ACTION_OPEN); + gabedit_file_chooser_set_filters(GABEDIT_FILE_CHOOSER(SelecFile),patternsout); + break; case GABEDIT_TYPEFILEGEOM_QCHEMOUTFIRST : SelecFile = gabedit_file_chooser_new(_("Read the first geometry from a Q-Chem output file"), GTK_FILE_CHOOSER_ACTION_OPEN); gabedit_file_chooser_set_filters(GABEDIT_FILE_CHOOSER(SelecFile),patternsout); @@ -11592,6 +12182,10 @@ SelecFile = gabedit_file_chooser_new(_("Read hyperchem file"), GTK_FILE_CHOOSER_ACTION_OPEN); gabedit_file_chooser_set_filters(GABEDIT_FILE_CHOOSER(SelecFile),patternshin); break; + case GABEDIT_TYPEFILEGEOM_AIMALL : + SelecFile = gabedit_file_chooser_new(_("Read AIMAll file"), GTK_FILE_CHOOSER_ACTION_OPEN); + gabedit_file_chooser_set_filters(GABEDIT_FILE_CHOOSER(SelecFile),patternsaimall); + break; case GABEDIT_TYPEFILEGEOM_GABEDIT : SelecFile = gabedit_file_chooser_new(_("Read Gabedit file"), GTK_FILE_CHOOSER_ACTION_OPEN); gabedit_file_chooser_set_filters(GABEDIT_FILE_CHOOSER(SelecFile),patternsgab); @@ -11609,6 +12203,7 @@ case GABEDIT_TYPEFILEGEOM_MOLPROIN : return; case GABEDIT_TYPEFILEGEOM_MPQCIN : return; case GABEDIT_TYPEFILEGEOM_ORCAIN : return; + case GABEDIT_TYPEFILEGEOM_NWCHEMIN : return; case GABEDIT_TYPEFILEGEOM_QCHEMIN : return; case GABEDIT_TYPEFILEGEOM_MOPACIN : return; case GABEDIT_TYPEFILEGEOM_GAUSSIAN_ZMATRIX : return; @@ -11676,6 +12271,11 @@ case GABEDIT_TYPEFILEGEOM_QCHEMOUTLAST : g_signal_connect (SelecFile, "response", G_CALLBACK (read_last_qchem_file), GTK_OBJECT(SelecFile)); break; + case GABEDIT_TYPEFILEGEOM_NWCHEMOUTFIRST : + g_signal_connect (SelecFile, "response", G_CALLBACK (read_first_nwchem_file), GTK_OBJECT(SelecFile)); break; + case GABEDIT_TYPEFILEGEOM_NWCHEMOUTLAST : + g_signal_connect (SelecFile, "response", G_CALLBACK (read_last_nwchem_file), GTK_OBJECT(SelecFile)); break; + case GABEDIT_TYPEFILEGEOM_MOPACOUTFIRST : g_signal_connect (SelecFile, "response", G_CALLBACK (read_first_mopac_output_file), GTK_OBJECT(SelecFile)); break; case GABEDIT_TYPEFILEGEOM_MOPACOUTLAST : @@ -11691,6 +12291,8 @@ g_signal_connect (SelecFile, "response", G_CALLBACK (read_pdb_file), GTK_OBJECT(SelecFile)); break; case GABEDIT_TYPEFILEGEOM_HIN : g_signal_connect (SelecFile, "response", G_CALLBACK (read_hin_file), GTK_OBJECT(SelecFile)); break; + case GABEDIT_TYPEFILEGEOM_AIMALL : + g_signal_connect (SelecFile, "response", G_CALLBACK (read_aimall_file), GTK_OBJECT(SelecFile)); break; case GABEDIT_TYPEFILEGEOM_GABEDIT : g_signal_connect (SelecFile, "response", G_CALLBACK (read_gabedit_file), GTK_OBJECT(SelecFile)); break; case GABEDIT_TYPEFILEGEOM_MOPACOUTSCAN : @@ -11705,6 +12307,7 @@ case GABEDIT_TYPEFILEGEOM_MOLPROIN : case GABEDIT_TYPEFILEGEOM_MPQCIN : case GABEDIT_TYPEFILEGEOM_ORCAIN : + case GABEDIT_TYPEFILEGEOM_NWCHEMIN : case GABEDIT_TYPEFILEGEOM_QCHEMIN : case GABEDIT_TYPEFILEGEOM_MOPACIN : case GABEDIT_TYPEFILEGEOM_GAUSSIAN_ZMATRIX : @@ -11723,83 +12326,73 @@ GtkWidget * ButtonPDB = g_object_get_data(G_OBJECT(win),"ButtonPDB"); GtkWidget * ButtonHIN = g_object_get_data(G_OBJECT(win),"ButtonHIN"); GtkWidget * entry = g_object_get_data(G_OBJECT(win),"Entry"); - if (GTK_TOGGLE_BUTTON (ButtonXYZ)->active) - { - save_xyz_file_entry(entry); - } + GtkWidget * buttonDirSelector = g_object_get_data(G_OBJECT(win),"ButtonDirSelector"); + G_CONST_RETURN gchar *entrytext; + gchar *dirName; + gchar *fileName; + + entrytext = gtk_entry_get_text(GTK_ENTRY(entry)); + dirName = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER(buttonDirSelector)); + fileName = get_dir_file_name(dirName,entrytext); + if ((!fileName) || (strcmp(fileName,"") == 0)) return ; + if (GTK_TOGGLE_BUTTON (ButtonXYZ)->active) + { + save_xyz_file(fileName); + } else if (GTK_TOGGLE_BUTTON (ButtonMol2)->active) { - save_mol2_file_entry(entry); + save_mol2_file(fileName); } else if (GTK_TOGGLE_BUTTON (ButtonPDB)->active) { - save_pdb_file_entry(entry); + save_pdb_file(fileName); } if (GTK_TOGGLE_BUTTON (ButtonHIN)->active) { - save_hin_file_entry(entry); + save_hin_file(fileName); } else { - save_tinker_file_entry(entry); + save_tinker_file(fileName); } } /********************************************************************************/ -void reset_extended_xyz_file(GtkWidget* b,gpointer data) +static void reset_extended_file(gpointer data,G_CONST_RETURN gchar* ext) { GtkWidget* entry = GTK_WIDGET(data); G_CONST_RETURN gchar* entrytext = gtk_entry_get_text(GTK_ENTRY(entry)); - gchar* temp = get_suffix_name_file(entrytext); - gchar* t = g_strdup_printf("%s.xyz",temp); + gchar* temp = get_filename_without_ext(entrytext); + gchar* t = g_strdup_printf("%s.%s",temp,ext); gtk_entry_set_text(GTK_ENTRY(entry),t); g_free(t); g_free(temp); } /********************************************************************************/ -void reset_extended_mol2_file(GtkWidget* b,gpointer data) +static void reset_extended_xyz_file(GtkWidget* b,gpointer data) { - GtkWidget* entry = GTK_WIDGET(data); - G_CONST_RETURN gchar* entrytext = gtk_entry_get_text(GTK_ENTRY(entry)); - gchar* temp = get_suffix_name_file(entrytext); - gchar* t = g_strdup_printf("%s.mol2",temp); - gtk_entry_set_text(GTK_ENTRY(entry),t); - g_free(t); - g_free(temp); + reset_extended_file(data,"xyz"); } /********************************************************************************/ -void reset_extended_tinker_file(GtkWidget* b,gpointer data) +static void reset_extended_mol2_file(GtkWidget* b,gpointer data) { - GtkWidget* entry = GTK_WIDGET(data); - G_CONST_RETURN gchar* entrytext = gtk_entry_get_text(GTK_ENTRY(entry)); - gchar* temp = get_suffix_name_file(entrytext); - gchar* t = g_strdup_printf("%s.tnk",temp); - gtk_entry_set_text(GTK_ENTRY(entry),t); - g_free(t); - g_free(temp); + reset_extended_file(data,"mol2"); } /********************************************************************************/ -void reset_extended_pdb_file(GtkWidget* b,gpointer data) +static void reset_extended_tinker_file(GtkWidget* b,gpointer data) { - GtkWidget* entry = GTK_WIDGET(data); - G_CONST_RETURN gchar* entrytext = gtk_entry_get_text(GTK_ENTRY(entry)); - gchar* temp = get_suffix_name_file(entrytext); - gchar* t = g_strdup_printf("%s.pdb",temp); - gtk_entry_set_text(GTK_ENTRY(entry),t); - g_free(t); - g_free(temp); + reset_extended_file(data,"tnk"); } /********************************************************************************/ -void reset_extended_hin_file(GtkWidget* b,gpointer data) +static void reset_extended_pdb_file(GtkWidget* b,gpointer data) { - GtkWidget* entry = GTK_WIDGET(data); - G_CONST_RETURN gchar* entrytext = gtk_entry_get_text(GTK_ENTRY(entry)); - gchar* temp = get_suffix_name_file(entrytext); - gchar* t = g_strdup_printf("%s.hin",temp); - gtk_entry_set_text(GTK_ENTRY(entry),t); - g_free(t); - g_free(temp); + reset_extended_file(data,"pdb"); +} +/********************************************************************************/ +static void reset_extended_hin_file(GtkWidget* b,gpointer data) +{ + reset_extended_file(data,"hin"); } /********************************************************************************/ void create_window_save_xyzmol2tinkerpdbhin() @@ -11810,6 +12403,7 @@ GtkWidget *vboxframe; GtkWidget *hbox; GtkWidget *button; + GtkWidget *buttonDirSelector; GtkWidget *ButtonXYZ; GtkWidget *ButtonMol2; GtkWidget *ButtonTinker; @@ -11818,9 +12412,8 @@ GtkWidget *entry; GtkWidget *Win = WindowGeom; gchar *labelt = g_strdup(" File : "); - gchar *liste; gchar *titre=g_strdup("Save in xyz/mol2/tinker/Hyperchem file"); - static gchar* patterns[] = {"*.xyz *.mol2 *.tnk *.pdb *.hin","*.xyz","*.mol2","*.tnk","*.pdb","*.hin",NULL}; + gchar* fileName = g_strdup_printf("%s.xyz",fileopen.projectname); if(NcentersXYZ<1) { @@ -11829,7 +12422,6 @@ } if(!Win) Win = Fenetre; - liste = g_strdup_printf("%s%s%s.xyz",fileopen.localdir,G_DIR_SEPARATOR_S,fileopen.projectname); fp = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(fp),titre); @@ -11852,39 +12444,41 @@ vboxframe = create_vbox(frame); - hbox = gtk_hbox_new(TRUE, 10); - gtk_container_add (GTK_CONTAINER (vboxframe), hbox); + hbox = gtk_hbox_new(FALSE, 10); + //gtk_container_add (GTK_CONTAINER (vboxframe), hbox); + gtk_box_pack_start (GTK_BOX (vboxframe), hbox, FALSE, FALSE, 5); gtk_widget_show (hbox); ButtonXYZ = gtk_radio_button_new_with_label( NULL,"XYZ " ); gtk_box_pack_start (GTK_BOX (hbox), ButtonXYZ, FALSE, FALSE, 5); gtk_widget_show (ButtonXYZ); - ButtonMol2 = gtk_radio_button_new_with_label( - gtk_radio_button_get_group (GTK_RADIO_BUTTON (ButtonXYZ)), - "Mol2"); + ButtonMol2 = gtk_radio_button_new_with_label( gtk_radio_button_get_group (GTK_RADIO_BUTTON (ButtonXYZ)), "Mol2"); gtk_box_pack_start (GTK_BOX (hbox), ButtonMol2, FALSE, FALSE, 5); gtk_widget_show (ButtonMol2); - ButtonTinker = gtk_radio_button_new_with_label( - gtk_radio_button_get_group (GTK_RADIO_BUTTON (ButtonXYZ)), - "Tinker"); + ButtonTinker = gtk_radio_button_new_with_label( gtk_radio_button_get_group (GTK_RADIO_BUTTON (ButtonXYZ)), "Tinker"); gtk_box_pack_start (GTK_BOX (hbox), ButtonTinker, FALSE, FALSE, 5); gtk_widget_show (ButtonTinker); - ButtonPDB = gtk_radio_button_new_with_label( - gtk_radio_button_get_group (GTK_RADIO_BUTTON (ButtonXYZ)), - "PDB"); + + hbox = gtk_hbox_new(FALSE, 10); + gtk_box_pack_start (GTK_BOX (vboxframe), hbox, FALSE, FALSE, 5); + + + ButtonPDB = gtk_radio_button_new_with_label( gtk_radio_button_get_group (GTK_RADIO_BUTTON (ButtonXYZ)), "PDB"); gtk_box_pack_start (GTK_BOX (hbox), ButtonPDB, FALSE, FALSE, 5); gtk_widget_show (ButtonPDB); - ButtonHIN = gtk_radio_button_new_with_label( - gtk_radio_button_get_group (GTK_RADIO_BUTTON (ButtonXYZ)), - "Hyperchem"); + ButtonHIN = gtk_radio_button_new_with_label( gtk_radio_button_get_group (GTK_RADIO_BUTTON (ButtonXYZ)), "Hyperchem"); gtk_box_pack_start (GTK_BOX (hbox), ButtonHIN, FALSE, FALSE, 5); gtk_widget_show (ButtonHIN); create_hseparator(vboxframe); - hbox = create_hbox_browser(Win,vboxframe,labelt,liste,patterns); - entry = (GtkWidget*)(g_object_get_data(G_OBJECT(hbox),"Entry")); + create_table_browser(Win,vboxframe); + entry = (GtkWidget*)(g_object_get_data(G_OBJECT(Win),"EntryFileName")); + gtk_entry_set_text(GTK_ENTRY(entry),fileName); + buttonDirSelector = (GtkWidget*)(g_object_get_data(G_OBJECT(Win),"ButtonDirSelector")); + if(fileopen.localdir && strcmp(fileopen.localdir,"NoName")!=0) gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(buttonDirSelector), fileopen.localdir); + create_hseparator(vboxframe); g_signal_connect(G_OBJECT(ButtonXYZ),"clicked",(GCallback)reset_extended_xyz_file,(gpointer)(entry)); g_signal_connect(G_OBJECT(ButtonMol2),"clicked",(GCallback)reset_extended_mol2_file,(gpointer)(entry)); @@ -11898,6 +12492,7 @@ g_object_set_data(G_OBJECT (fp), "ButtonPDB",ButtonPDB); g_object_set_data(G_OBJECT (fp), "ButtonHIN",ButtonHIN); g_object_set_data(G_OBJECT (fp), "Entry",entry); + g_object_set_data(G_OBJECT (fp), "ButtonDirSelector",buttonDirSelector); create_hseparator(vboxall); hbox = gtk_hbox_new(FALSE, 0); @@ -11921,7 +12516,7 @@ g_free(labelt); - g_free(liste); + g_free(fileName); gtk_widget_show_all(fp); } diff -Nru gabedit-2.3.7/src/Geometry/GeomXYZ.h gabedit-2.4.0/src/Geometry/GeomXYZ.h --- gabedit-2.3.7/src/Geometry/GeomXYZ.h 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Geometry/GeomXYZ.h 2011-09-22 14:25:07.000000000 +0000 @@ -33,6 +33,7 @@ void read_XYZ_from_gauss_input_file(gchar *NomFichier, FilePosTypeGeom InfoFile ); void read_XYZ_from_gamess_input_file(gchar *NomFichier ); void read_XYZ_from_mpqc_input_file(gchar *NomFichier ); +void read_XYZ_from_nwchem_input_file(gchar *NomFichier ); void read_XYZ_from_orca_input_file(gchar *NomFichier ); void read_XYZ_from_qchem_input_file(gchar *NomFichier ); void read_XYZ_from_mopac_input_file(gchar *NomFichier ); @@ -45,6 +46,7 @@ void read_geom_from_mpqc_output_file(gchar *fileName, gint numGeometry); void read_geom_from_molpro_file(gchar *NomFichier, gint numgeometry); void read_geom_from_orca_file(gchar *NomFichier, gint numgeometry); +void read_geom_from_nwchem_file(gchar *NomFichier, gint numgeometry); void read_geom_from_qchem_file(gchar *NomFichier, gint numgeometry); void read_geom_from_mopac_output_file(gchar *NomFichier, gint numgeometry); void read_geom_from_gamess_irc_file(gchar *NomFichier, gint numgeometry); @@ -80,6 +82,7 @@ void read_last_dalton_file(GabeditFileChooser *SelecFile, gint response_id); void read_first_gamess_file(GabeditFileChooser *SelecFile, gint response_id); void read_last_gamess_file(GabeditFileChooser *SelecFile, gint response_id); +void read_aimall_file(GabeditFileChooser *SelecFile, gint response_id); void read_first_turbomole_file(GabeditFileChooser *SelecFile, gint response_id); void read_last_turbomole_file(GabeditFileChooser *SelecFile, gint response_id); void read_last_gaussian_file(GabeditFileChooser *SelecFile , gint response_id); @@ -89,6 +92,8 @@ void read_last_molpro_file(GabeditFileChooser *SelecFile , gint response_id); void read_first_orca_file(GabeditFileChooser *SelecFile , gint response_id); void read_last_orca_file(GabeditFileChooser *SelecFile , gint response_id); +void read_first_nwchem_file(GabeditFileChooser *SelecFile , gint response_id); +void read_last_nwchem_file(GabeditFileChooser *SelecFile , gint response_id); void read_first_qchem_file(GabeditFileChooser *SelecFile , gint response_id); void read_last_qchem_file(GabeditFileChooser *SelecFile , gint response_id); void read_first_mopac_output_file(GabeditFileChooser *SelecFile , gint response_id); diff -Nru gabedit-2.3.7/src/Geometry/GeomZmatrix.c gabedit-2.4.0/src/Geometry/GeomZmatrix.c --- gabedit-2.3.7/src/Geometry/GeomZmatrix.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Geometry/GeomZmatrix.c 2011-09-22 14:25:07.000000000 +0000 @@ -504,6 +504,7 @@ gdouble *Y = NULL; gdouble *Z = NULL; gint amax = ak; + gchar* t = NULL; if (NcentersZmat <= 1) return NULL; if (ai < 0) return NULL; @@ -564,7 +565,14 @@ g_free(X); g_free(Y); g_free(Z); - return get_angle_vectors(A,B); + t = get_angle_vectors(A,B); + if(t) + { + gchar* a = g_strdup_printf("%0.6lf",atof(t)); + g_free(t); + return a; + } + return NULL; } for (i = 3; i <(gint)NcentersZmat; i++) { @@ -698,7 +706,14 @@ g_free(X); g_free(Y); g_free(Z); - return get_angle_vectors(A,B); + t = get_angle_vectors(A,B); + if(t) + { + gchar* a = g_strdup_printf("%0.6lf",atof(t)); + g_free(t); + return a; + } + return NULL; } } /*****************************************************************************/ @@ -2294,38 +2309,43 @@ { GtkWidget * ButtonGZmat = g_object_get_data(G_OBJECT(win),"ButtonGZmat"); GtkWidget * entry = g_object_get_data(G_OBJECT(win),"Entry"); + GtkWidget * buttonDirSelector = g_object_get_data(G_OBJECT(win),"ButtonDirSelector"); + G_CONST_RETURN gchar *entrytext; + gchar *dirName; + gchar *fileName; + + entrytext = gtk_entry_get_text(GTK_ENTRY(entry)); + dirName = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER(buttonDirSelector)); + fileName = get_dir_file_name(dirName,entrytext); if (GTK_TOGGLE_BUTTON (ButtonGZmat)->active) { - /*Debug("Gaussian zmatrix file\n");*/ - save_gzmatrix_file_entry(entry); + save_gzmatrix_file(fileName); } else { - /*Debug("Mopac zmatrix file\n");*/ - save_mzmatrix_file_entry(entry); + save_mzmatrix_file(fileName); } } /********************************************************************************/ -void reset_extended_gzmat_file(GtkWidget* b,gpointer data) +static void reset_extended_file(gpointer data,G_CONST_RETURN gchar* ext) { GtkWidget* entry = GTK_WIDGET(data); G_CONST_RETURN gchar* entrytext = gtk_entry_get_text(GTK_ENTRY(entry)); - gchar* temp = get_suffix_name_file(entrytext); - gchar* t = g_strdup_printf("%s.gzmt",temp); + gchar* temp = get_filename_without_ext(entrytext); + gchar* t = g_strdup_printf("%s.%s",temp,ext); gtk_entry_set_text(GTK_ENTRY(entry),t); g_free(t); g_free(temp); } /********************************************************************************/ +void reset_extended_gzmat_file(GtkWidget* b,gpointer data) +{ + reset_extended_file(data,"gzmt"); +} +/********************************************************************************/ void reset_extended_mzmat_file(GtkWidget* b,gpointer data) { - GtkWidget* entry = GTK_WIDGET(data); - G_CONST_RETURN gchar* entrytext = gtk_entry_get_text(GTK_ENTRY(entry)); - gchar* temp = get_suffix_name_file(entrytext); - gchar* t = g_strdup_printf("%s.zmt",temp); - gtk_entry_set_text(GTK_ENTRY(entry),t); - g_free(t); - g_free(temp); + reset_extended_file(data,"zmt"); } /********************************************************************************/ void create_window_save_zmat() @@ -2341,9 +2361,9 @@ GtkWidget *entry; GtkWidget *Win = WindowGeom; gchar *labelt = g_strdup(" File : "); - gchar *liste; + gchar *fileName; gchar *titre=g_strdup("Save in Z-matrix file"); - static gchar* patterns[] = {"*.gzmt *.zmt","*.gzmt","*.zmt","*",NULL}; + GtkWidget* buttonDirSelector; if(NcentersZmat<1) { @@ -2352,7 +2372,7 @@ } if(!Win) Win = Fenetre; - liste = g_strdup_printf("%s%s%s.gzmt",fileopen.localdir,G_DIR_SEPARATOR_S,fileopen.projectname); + fileName = g_strdup_printf("%s.gzmt",fileopen.projectname); /* Fenetre principale */ fp = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(fp),titre); @@ -2381,26 +2401,19 @@ ButtonGZmat = gtk_radio_button_new_with_label( NULL,"Gaussian Z-matrix " ); gtk_box_pack_start (GTK_BOX (hbox), ButtonGZmat, FALSE, FALSE, 5); gtk_widget_show (ButtonGZmat); - ButtonMZmat = gtk_radio_button_new_with_label( - gtk_radio_button_get_group (GTK_RADIO_BUTTON (ButtonGZmat)), - "Mopac Z-matrix"); + ButtonMZmat = gtk_radio_button_new_with_label( gtk_radio_button_get_group (GTK_RADIO_BUTTON (ButtonGZmat)), "Mopac Z-matrix"); gtk_box_pack_start (GTK_BOX (hbox), ButtonMZmat, FALSE, FALSE, 5); gtk_widget_show (ButtonMZmat); create_hseparator(vboxframe); - /* - frame = gtk_frame_new ("Location&Name of file"); - gtk_container_set_border_width (GTK_CONTAINER (frame), 5); - gtk_container_add (GTK_CONTAINER (vboxall), frame); - gtk_widget_show (frame); + create_table_browser(Win,vboxframe); + entry = (GtkWidget*)(g_object_get_data(G_OBJECT(Win),"EntryFileName")); + gtk_entry_set_text(GTK_ENTRY(entry),fileName); + buttonDirSelector = (GtkWidget*)(g_object_get_data(G_OBJECT(Win),"ButtonDirSelector")); + if(fileopen.localdir && strcmp(fileopen.localdir,"NoName")!=0) gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(buttonDirSelector), fileopen.localdir); - vboxframe = create_vbox(frame); - */ - - hbox = create_hbox_browser(Win,vboxframe,labelt,liste,patterns); - entry = (GtkWidget*)(g_object_get_data(G_OBJECT(hbox),"Entry")); create_hseparator(vboxframe); g_signal_connect(G_OBJECT(ButtonGZmat),"clicked",(GCallback)reset_extended_gzmat_file,(gpointer)(entry)); g_signal_connect(G_OBJECT(ButtonMZmat),"clicked",(GCallback)reset_extended_mzmat_file,(gpointer)(entry)); @@ -2408,6 +2421,7 @@ g_object_set_data(G_OBJECT (fp), "ButtonGZmat",ButtonGZmat); g_object_set_data(G_OBJECT (fp), "ButtonMZmat",ButtonMZmat); g_object_set_data(G_OBJECT (fp), "Entry",entry); + g_object_set_data(G_OBJECT (fp), "ButtonDirSelector",buttonDirSelector); /* buttons */ create_hseparator(vboxall); hbox = gtk_hbox_new(FALSE, 0); @@ -2416,11 +2430,6 @@ - button = create_button(fp,_("Cancel")); - gtk_box_pack_end (GTK_BOX( hbox), button, FALSE, FALSE, 3); - g_signal_connect_swapped(G_OBJECT(button),"clicked",(GCallback)delete_child,GTK_OBJECT(fp)); - gtk_widget_show (button); - GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); button = create_button(fp,_("OK")); gtk_box_pack_end (GTK_BOX( hbox), button, FALSE, FALSE, 3); @@ -2430,8 +2439,14 @@ g_signal_connect_swapped(G_OBJECT(button), "clicked",G_CALLBACK(save_gmzmatrix_file),GTK_OBJECT(fp)); g_signal_connect_swapped(G_OBJECT(button),"clicked",(GCallback)delete_child,GTK_OBJECT(fp)); + button = create_button(fp,_("Cancel")); + gtk_box_pack_end (GTK_BOX( hbox), button, FALSE, FALSE, 3); + g_signal_connect_swapped(G_OBJECT(button),"clicked",(GCallback)delete_child,GTK_OBJECT(fp)); + gtk_widget_show (button); + GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); + g_free(labelt); - g_free(liste); + g_free(fileName); gtk_widget_show_all(fp); } @@ -4737,6 +4752,253 @@ set_last_directory(NomFichier); } /*************************************************************************************/ +void read_Zmat_from_nwchem_input_file(gchar *NomFichier) +{ + gchar *t; + gboolean OK; + gchar *AtomCoord[7]; + FILE *file; + guint taille=BSIZE; + guint i; + gint j; + gint k; + gboolean Uvar=FALSE; + GeomAtomDef* Geomtemp=NULL; + gint Ncent = 0; + gint Nvar = 0; + VariablesDef* Variablestemp=NULL; + gchar symb[BSIZE]; + gchar type[BSIZE]; + gchar charge[BSIZE]; + gint globalCharge, mult; + + if ( strcmp(NomFichier,"") == 0 ) return; + + file = FOpen(NomFichier, "r"); + OK=TRUE; + if(file==NULL) + { + MessageGeom(_("Sorry\n I can not read geometry in NWChem input file"),_("Error"),TRUE); + return; + } + t=g_malloc(taille*sizeof(gchar)); + for(i=0;i<5;i++) + AtomCoord[i]=g_malloc(taille*sizeof(char)); + + while(!feof(file)) + { + if(!fgets(t,taille,file)) + { + OK = FALSE; + break; + } + g_strup(t); + if(strstr(t,"* INT") && 4==sscanf(t,"%s %s %d %d",AtomCoord[0],AtomCoord[1],&globalCharge, &mult) ) + { + OK = TRUE; + break; + } + } + + for(i=0;i<7;i++) + AtomCoord[i]=g_malloc(taille*sizeof(gchar)); + + + Ncent = 0; + while(!feof(file) && OK ) + { + fgets(t,taille,file); + for(i=0;i<(gint)strlen(t);i++) if(t[i] != ' ') break; + if(i<=(gint)strlen(t) && t[i] == '*') break; + for(k=0;k<(gint)strlen(t);k++) if(t[k]=='{' || t[k]=='}') t[k] = ' '; + + i = sscanf(t,"%s ",AtomCoord[0]); + if(i != 1) + { + OK = FALSE; + break; + } + Ncent++; + if(Ncent==1) Geomtemp=g_malloc(Ncent*sizeof(GeomAtomDef)); + else Geomtemp=g_realloc(Geomtemp,Ncent*sizeof(GeomAtomDef)); + switch( Ncent ){ + case 1 : + Geomtemp[Ncent-1].Nentry=NUMBER_ENTRY_0; + + get_symb_type_charge(AtomCoord[0],symb,type,charge); + Geomtemp[Ncent-1].Symb = g_strdup(symb); + Geomtemp[Ncent-1].mmType = g_strdup(type); + Geomtemp[Ncent-1].pdbType = g_strdup(type); + Geomtemp[Ncent-1].Charge=g_strdup(charge); + + Geomtemp[Ncent-1].Residue=g_strdup("DUM"); + Geomtemp[Ncent-1].ResidueNumber=0; + Geomtemp[Ncent-1].Layer=g_strdup(" "); + break; + case 2 : + i = sscanf( + t,"%s %s %s %s %s", + AtomCoord[0],AtomCoord[1],AtomCoord[2], + AtomCoord[3],AtomCoord[4] + ); + if( i != 5 ) + { + Ncent--; + Geomtemp=g_realloc(Geomtemp,Ncent*sizeof(GeomAtomDef)); + OK = FALSE; + } + if( !test(AtomCoord[4]) ) Uvar = TRUE; + Geomtemp[Ncent-1].Nentry=NUMBER_ENTRY_R; + + get_symb_type_charge(AtomCoord[0],symb,type,charge); + Geomtemp[Ncent-1].Symb = g_strdup(symb); + Geomtemp[Ncent-1].mmType = g_strdup(type); + Geomtemp[Ncent-1].pdbType = g_strdup(type); + Geomtemp[Ncent-1].Charge=g_strdup(charge); + + Geomtemp[Ncent-1].Residue=g_strdup("DUM"); + Geomtemp[Ncent-1].ResidueNumber=0; + Geomtemp[Ncent-1].NR=g_strdup(AtomCoord[1]); + Geomtemp[Ncent-1].R=g_strdup(AtomCoord[4]); + Geomtemp[Ncent-1].Layer=g_strdup(" "); + break; + case 3 : + i = sscanf( + t,"%s %s %s %s %s %s", + AtomCoord[0],AtomCoord[1],AtomCoord[2], + AtomCoord[3],AtomCoord[4],AtomCoord[5] + ); + if(i != 6) + { + Ncent--; + Geomtemp=g_realloc(Geomtemp,Ncent*sizeof(GeomAtomDef)); + OK = FALSE; + } + if(!test(AtomCoord[4]) || !test(AtomCoord[5]) ) + Uvar = TRUE; + Geomtemp[Ncent-1].Nentry=NUMBER_ENTRY_ANGLE; + + get_symb_type_charge(AtomCoord[0],symb,type,charge); + Geomtemp[Ncent-1].Symb = g_strdup(symb); + Geomtemp[Ncent-1].mmType = g_strdup(type); + Geomtemp[Ncent-1].pdbType = g_strdup(type); + Geomtemp[Ncent-1].Charge=g_strdup(charge); + + Geomtemp[Ncent-1].Residue=g_strdup("DUM"); + Geomtemp[Ncent-1].ResidueNumber=0; + Geomtemp[Ncent-1].NR=g_strdup(AtomCoord[1]); + Geomtemp[Ncent-1].R=g_strdup(AtomCoord[4]); + Geomtemp[Ncent-1].NAngle=g_strdup(AtomCoord[2]); + Geomtemp[Ncent-1].Angle=g_strdup(AtomCoord[5]); + Geomtemp[Ncent-1].Layer=g_strdup(" "); + break; + default : + i = sscanf( + t,"%s %s %s %s %s %s %s", + AtomCoord[0],AtomCoord[1],AtomCoord[2], + AtomCoord[3],AtomCoord[4],AtomCoord[5],AtomCoord[6] + ); + if( i!= 7) + { + Ncent--; + Geomtemp=g_realloc(Geomtemp,Ncent*sizeof(GeomAtomDef)); + OK = FALSE; + } + if(!test(AtomCoord[4]) || !test(AtomCoord[5]) || !test(AtomCoord[6])) + Uvar = TRUE; + Geomtemp[Ncent-1].Nentry=NUMBER_ENTRY_DIHEDRAL; + + get_symb_type_charge(AtomCoord[0],symb,type,charge); + Geomtemp[Ncent-1].Symb = g_strdup(symb); + Geomtemp[Ncent-1].mmType = g_strdup(type); + Geomtemp[Ncent-1].pdbType = g_strdup(type); + Geomtemp[Ncent-1].Charge=g_strdup(charge); + + Geomtemp[Ncent-1].Residue=g_strdup("DUM"); + Geomtemp[Ncent-1].ResidueNumber=0; + Geomtemp[Ncent-1].NR=g_strdup(AtomCoord[1]); + Geomtemp[Ncent-1].R=g_strdup(AtomCoord[4]); + Geomtemp[Ncent-1].NAngle=g_strdup(AtomCoord[2]); + Geomtemp[Ncent-1].Angle=g_strdup(AtomCoord[5]); + Geomtemp[Ncent-1].NDihedral=g_strdup(AtomCoord[3]); + Geomtemp[Ncent-1].Dihedral=g_strdup(AtomCoord[6]); + Geomtemp[Ncent-1].Layer=g_strdup(" "); + }/*end switch*/ + }/*end while*/ +/* Variables */ + Nvar=0; + fseek(file, 0L, SEEK_SET); + if(Uvar) + { + OK =FALSE; + while(!feof(file) && Uvar) + { + if(!fgets(t,taille,file)) break; + g_strup(t); + if(strstr(t,"PARAS")) + { + OK = TRUE; + break; + } + } + } + while(!feof(file) && Uvar && OK ) + { + g_strup(t); + for(k=0;k<(gint)strlen(t);k++) if(t[k]=='=') t[k] = ' '; + for(j=0;jactive) + { + if (GTK_TOGGLE_BUTTON (Move23Button)->active) + listGroupAtoms = getListGroupe(&nGroupAtoms, geometry0, Natoms, i1, i2,i3,i4+Natoms); + else listGroupAtoms = getListGroupe(&nGroupAtoms, geometry0, Natoms, i1, i2,i3,i4); + } setTorsion(Natoms,geometry0,i1,i2,i3,i4,newA, listGroupAtoms,nGroupAtoms); if(listGroupAtoms) g_free(listGroupAtoms); rafresh_window_geom(); @@ -736,7 +743,7 @@ Frame = create_frame(Dialogue,vboxframe,NULL); vbox = create_vbox(Frame); - Table = gtk_table_new(16,2,FALSE); + Table = gtk_table_new(17,2,FALSE); gtk_container_add(GTK_CONTAINER(vbox),Table); i = 0; @@ -802,11 +809,18 @@ i = 15; hseparator = gtk_hseparator_new (); gtk_table_attach(GTK_TABLE(Table),hseparator,0,3,i,i+1,(GtkAttachOptions)(GTK_FILL|GTK_SHRINK) ,(GtkAttachOptions)(GTK_FILL|GTK_SHRINK),3,3); + i = 16; MoveGroupButton = gtk_check_button_new_with_label (_("Move group")); gtk_widget_show (MoveGroupButton); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (MoveGroupButton), TRUE); gtk_table_attach(GTK_TABLE(Table),MoveGroupButton,0,1,i,i+1,(GtkAttachOptions)(GTK_FILL|GTK_SHRINK) ,(GtkAttachOptions)(GTK_FILL|GTK_SHRINK),3,3); + + i = 17; + Move23Button = gtk_check_button_new_with_label (_("Move 2-3 group")); + gtk_widget_show (Move23Button); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (Move23Button), TRUE); + gtk_table_attach(GTK_TABLE(Table),Move23Button,0,1,i,i+1,(GtkAttachOptions)(GTK_FILL|GTK_SHRINK) ,(GtkAttachOptions)(GTK_FILL|GTK_SHRINK),3,3); } /************************************************************************************************************/ void create_frame_averaged(GtkWidget *Dialogue,GtkWidget *hbox) diff -Nru gabedit-2.3.7/src/Geometry/MenuToolBarGeom.c gabedit-2.4.0/src/Geometry/MenuToolBarGeom.c --- gabedit-2.3.7/src/Geometry/MenuToolBarGeom.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Geometry/MenuToolBarGeom.c 2011-09-22 14:25:07.000000000 +0000 @@ -413,6 +413,7 @@ else if(!strcmp(name,"ReadTinker")) { MethodeGeom = GEOM_IS_XYZ;selc_XYZ_file(GABEDIT_TYPEFILEGEOM_TINKER); } else if(!strcmp(name,"ReadPDB")) { MethodeGeom = GEOM_IS_XYZ;selc_XYZ_file(GABEDIT_TYPEFILEGEOM_PDB); } else if(!strcmp(name,"ReadHyperchem")) { MethodeGeom = GEOM_IS_XYZ;selc_XYZ_file(GABEDIT_TYPEFILEGEOM_HIN);} + else if(!strcmp(name,"ReadAIMAll")) { MethodeGeom = GEOM_IS_XYZ;selc_XYZ_file(GABEDIT_TYPEFILEGEOM_AIMALL);} else if(!strcmp(name,"ReadMol")) { MethodeGeom = GEOM_IS_XYZ;selc_XYZ_file(GABEDIT_TYPEFILEGEOM_MOL);} else if(!strcmp(name,"ReadGabedit")) { MethodeGeom = GEOM_IS_XYZ;selc_XYZ_file(GABEDIT_TYPEFILEGEOM_GABEDIT);} else if(!strcmp(name,"ReadGaussianZMat")) { MethodeGeom = GEOM_IS_ZMAT;selc_ZMatrix_file(); } @@ -448,6 +449,8 @@ else if(!strcmp(name,"ReadFireFlyLast")) { MethodeGeom = GEOM_IS_XYZ;selc_XYZ_file(GABEDIT_TYPEFILEGEOM_GAMESSLAST); } else if(!strcmp(name,"ReadOrcaFirst")) { MethodeGeom = GEOM_IS_XYZ;selc_XYZ_file(GABEDIT_TYPEFILEGEOM_ORCAOUTFIRST);} else if(!strcmp(name,"ReadOrcaLast")) { MethodeGeom = GEOM_IS_XYZ;selc_XYZ_file(GABEDIT_TYPEFILEGEOM_ORCAOUTLAST);} + else if(!strcmp(name,"ReadNWChemFirst")) { MethodeGeom = GEOM_IS_XYZ;selc_XYZ_file(GABEDIT_TYPEFILEGEOM_NWCHEMOUTFIRST);} + else if(!strcmp(name,"ReadNWChemLast")) { MethodeGeom = GEOM_IS_XYZ;selc_XYZ_file(GABEDIT_TYPEFILEGEOM_NWCHEMOUTLAST);} else if(!strcmp(name,"ReadQChemFirst")) { MethodeGeom = GEOM_IS_XYZ;selc_XYZ_file(GABEDIT_TYPEFILEGEOM_QCHEMOUTFIRST);} else if(!strcmp(name,"ReadQChemLast")) { MethodeGeom = GEOM_IS_XYZ;selc_XYZ_file(GABEDIT_TYPEFILEGEOM_QCHEMOUTLAST);} else if(!strcmp(name,"ReadUsingOpenBabel")) { create_babel_read_dialogue(); } @@ -472,6 +475,9 @@ else if(!strcmp(name,"ReadGeomConvOrca")) file_chooser_open(read_geometries_conv_orca,_("Load Geom. Conv. From ORCA output file"), GABEDIT_TYPEFILE_ORCA,GABEDIT_TYPEWIN_GEOM); + else if(!strcmp(name,"ReadGeomConvNWChem")) + file_chooser_open(read_geometries_conv_nwchem,_("Load Geom. Conv. From NWChem output file"), GABEDIT_TYPEFILE_NWCHEM,GABEDIT_TYPEWIN_GEOM); + else if(!strcmp(name,"ReadGeomConvQChem")) file_chooser_open(read_geometries_conv_qchem,_("Load Geom. Conv. From Q-Chem output file"), GABEDIT_TYPEFILE_QCHEM,GABEDIT_TYPEWIN_GEOM); @@ -936,6 +942,7 @@ {"ReadTinker", NULL, N_("_Tinker file"), NULL, "Read a Tinker file", G_CALLBACK (activate_action) }, {"ReadPDB", GABEDIT_STOCK_PDB, N_("_PDB file"), NULL, "Read a PDB file", G_CALLBACK (activate_action) }, {"ReadHyperchem", NULL, N_("_Hyperchem file"), NULL, "Read a Hyperchem file", G_CALLBACK (activate_action) }, + {"ReadAIMAll", NULL, N_("_AIMAll file"), NULL, "Read a AIMAll file", G_CALLBACK (activate_action) }, {"ReadMol", NULL, N_("_Mol file"), NULL, "Read a Mol file", G_CALLBACK (activate_action) }, {"ReadGabedit", GABEDIT_STOCK_GABEDIT, N_("_Gabedit file"), NULL, "Read a Gabedit file", G_CALLBACK (activate_action) }, {"ReadGaussianZMat", GABEDIT_STOCK_GAUSSIAN, N_("_Gaussian Z-Matrix file"), NULL, "Read a Gaussian Z-Matrix file", G_CALLBACK (activate_action) }, @@ -995,6 +1002,10 @@ {"ReadQChemFirst", GABEDIT_STOCK_QCHEM, N_("F_irst geometry from a Q-Chem output file"), NULL, "Read the first geometry from a Q-Chem output file", G_CALLBACK (activate_action) }, {"ReadQChemLast", GABEDIT_STOCK_QCHEM, N_("L_ast geometry from a Q-Chem output file"), NULL, "Read the last geometry from a Q-Chem output file", G_CALLBACK (activate_action) }, + {"NWChem", GABEDIT_STOCK_NWCHEM, "_NWChem"}, + {"ReadNWChemFirst", GABEDIT_STOCK_NWCHEM, N_("F_irst geometry from a NWChem output file"), NULL, "Read the first geometry from a NWChem output file", G_CALLBACK (activate_action) }, + {"ReadNWChemLast", GABEDIT_STOCK_NWCHEM, N_("L_ast geometry from a NWChem output file"), NULL, "Read the last geometry from a NWChem output file", G_CALLBACK (activate_action) }, + {"ReadUsingOpenBabel", GABEDIT_STOCK_OPEN_BABEL, N_("_Other format (using open babel)"), NULL, "Other format (using open babel)", G_CALLBACK (activate_action) }, {"ReadGeomConv", NULL, N_("Geometries _Convergence")}, @@ -1008,6 +1019,7 @@ {"ReadGeomConvMopac", GABEDIT_STOCK_MOPAC, N_("from a _Mopac aux file"), NULL, "Read Geometries Convergence from a Mopac aux file", G_CALLBACK (activate_action) }, {"ReadGeomConvMPQC", GABEDIT_STOCK_MPQC, N_("from a MP_QC output file"), NULL, "Read Geometries Convergence from a MPQC output file", G_CALLBACK (activate_action) }, {"ReadGeomConvOrca", GABEDIT_STOCK_ORCA, N_("from a _Orca output file"), NULL, "Read Geometries Convergence from a Orca output file", G_CALLBACK (activate_action) }, + {"ReadGeomConvNWChem", GABEDIT_STOCK_NWCHEM, N_("from a _NWChemoutput file"), NULL, "Read Geometries Convergence from a NWChem output file", G_CALLBACK (activate_action) }, {"ReadGeomConvQChem", GABEDIT_STOCK_QCHEM, N_("from a Q-_Chem output file"), NULL, "Read Geometries Convergence from a Q-Chem output file", G_CALLBACK (activate_action) }, {"ReadGeomConvGabedit", GABEDIT_STOCK_GABEDIT, N_("from a G_abedit file"), NULL, "Read Geometries Convergence from a Gabedit file", G_CALLBACK (activate_action) }, {"ReadGeomConvMolden", GABEDIT_STOCK_MOLDEN, N_("from a Mol_den file"), NULL, "Read Geometries Convergence from a Molden file", G_CALLBACK (activate_action) }, @@ -1228,6 +1240,7 @@ " \n" " \n" " \n" +" \n" " \n" " \n" " \n" @@ -1289,6 +1302,11 @@ " \n" " \n" " \n" +" \n" +" \n" +" \n" +" \n" +" \n" " \n" " \n" " \n" @@ -1306,6 +1324,7 @@ " \n" " \n" " \n" +" \n" " \n" " \n" " \n" diff -Nru gabedit-2.3.7/src/Geometry/ResultsAnalise.c gabedit-2.4.0/src/Geometry/ResultsAnalise.c --- gabedit-2.3.7/src/Geometry/ResultsAnalise.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Geometry/ResultsAnalise.c 2011-09-22 14:25:07.000000000 +0000 @@ -1904,6 +1904,143 @@ g_free(temp); } /*********************************************************************/ +DataGeomConv init_geom_nwchem_conv(gchar* namefile) +{ + DataGeomConv GeomConv; + gint i; + GeomConv.Npoint = 0; + GeomConv.Ntype = 3; + GeomConv.TypeData = g_malloc(GeomConv.Ntype*sizeof(gchar*) ); + GeomConv.fileType = GABEDIT_TYPEFILE_NWCHEM; + + GeomConv.TypeData[0] = g_strdup(_(" Energy ")); + GeomConv.TypeData[1] = g_strdup(_(" Gradient Max ")); + GeomConv.TypeData[2] = g_strdup(_(" Dep. Max ")); + + GeomConv.Data = g_malloc(GeomConv.Ntype*sizeof(gchar**) ); + for(i = 0;i0) + { + GeomConv[Ncalculs-1].Npoint++; + if(GeomConv[Ncalculs-1].Npoint == 1 ) + { + GeomConv[Ncalculs-1].NumGeom = g_malloc(GeomConv[Ncalculs-1].Npoint*sizeof(gint)); + for(i=0;(gint)i0 && GeomConv[Ncalculs-1].Npoint>0) GeomConv[Ncalculs-1].Npoint--; + if( Ncalculs>0 && GeomConv[Ncalculs-1].Npoint == 0) + { + GeomConv[Ncalculs-1] = free_geom_conv(GeomConv[Ncalculs-1]); + Ncalculs--; + if(Ncalculs>0) + GeomConv = g_realloc(GeomConv, Ncalculs*sizeof(DataGeomConv) ); + else + { + g_free(GeomConv); + GeomConv = NULL; + } + } + k = 0; + for(i=0;(gint)i=0 && i4>=0) { + if(i4>=NAtoms) + { + nG = i3; + nEx1 = i2; + nEx2 = i1; + nEx3 = i4-NAtoms; + } + else + { nG = i4; nEx1 = i3; nEx2 = i2; nEx3 = i1; + } } else if(i3>=0) { diff -Nru gabedit-2.3.7/src/NWChem/Dep.mk gabedit-2.4.0/src/NWChem/Dep.mk --- gabedit-2.3.7/src/NWChem/Dep.mk 1970-01-01 00:00:00.000000000 +0000 +++ gabedit-2.4.0/src/NWChem/Dep.mk 2011-09-22 15:59:34.000000000 +0000 @@ -0,0 +1,43 @@ +NWChem.o: NWChem.c ../../Config.h ../Common/Global.h \ + ../Common/../Files/GabeditFileChooser.h \ + ../Common/../Common/GabeditType.h ../NWChem/NWChemTypes.h \ + ../NWChem/NWChemGlobal.h ../NWChem/NWChemMolecule.h \ + ../NWChem/NWChemKeywords.h ../NWChem/NWChemBasis.h \ + ../NWChem/NWChemGuess.h ../Utils/UtilsInterface.h \ + ../Geometry/GeomGlobal.h ../Geometry/InterfaceGeom.h ../Utils/Utils.h \ + ../Utils/AtomsProp.h ../Utils/Constants.h ../Utils/GabeditTextEdit.h +NWChemMolecule.o: NWChemMolecule.c ../../Config.h ../Common/Global.h \ + ../Common/../Files/GabeditFileChooser.h \ + ../Common/../Common/GabeditType.h ../NWChem/NWChemTypes.h \ + ../NWChem/NWChemGlobal.h ../NWChem/NWChemKeywords.h \ + ../Geometry/GeomGlobal.h ../Geometry/GeomConversion.h \ + ../Geometry/GeomXYZ.h ../Geometry/Fragments.h ../Geometry/DrawGeom.h \ + ../Geometry/DrawGeomCairo.h ../Geometry/Fragments.h ../Utils/Utils.h \ + ../Utils/UtilsInterface.h ../Utils/Constants.h \ + ../Utils/GabeditTextEdit.h ../Geometry/InterfaceGeom.h \ + ../Common/Windows.h ../Utils/AtomsProp.h ../Symmetry/MoleculeSymmetry.h \ + ../Symmetry/MoleculeSymmetryInterface.h +NWChemKeywords.o: NWChemKeywords.c ../../Config.h ../Common/Global.h \ + ../Common/../Files/GabeditFileChooser.h \ + ../Common/../Common/GabeditType.h ../NWChem/NWChemTypes.h \ + ../NWChem/NWChemGlobal.h ../NWChem/NWChemMolecule.h \ + ../NWChem/NWChemBasis.h ../NWChem/NWChemGuess.h ../Utils/Utils.h \ + ../Utils/UtilsInterface.h ../Utils/GabeditTextEdit.h \ + ../Common/Windows.h ../Utils/Constants.h +NWChemGuess.o: NWChemGuess.c ../../Config.h ../Common/Global.h \ + ../Common/../Files/GabeditFileChooser.h \ + ../Common/../Common/GabeditType.h ../NWChem/NWChemTypes.h \ + ../NWChem/NWChemGlobal.h ../NWChem/NWChemBasis.h ../Utils/Utils.h \ + ../Utils/UtilsInterface.h ../Utils/GabeditTextEdit.h \ + ../Common/Windows.h ../Utils/Constants.h +NWChemBasis.o: NWChemBasis.c ../../Config.h ../Common/Global.h \ + ../Common/../Files/GabeditFileChooser.h \ + ../Common/../Common/GabeditType.h ../NWChem/NWChemTypes.h \ + ../NWChem/NWChemGlobal.h ../Geometry/GeomGlobal.h \ + ../Geometry/GeomConversion.h ../Geometry/GeomXYZ.h \ + ../Geometry/Fragments.h ../Geometry/DrawGeom.h \ + ../Geometry/DrawGeomCairo.h ../Geometry/Fragments.h ../Utils/Utils.h \ + ../Utils/UtilsInterface.h ../Utils/Constants.h \ + ../Geometry/InterfaceGeom.h ../Common/Windows.h ../Utils/AtomsProp.h \ + ../Utils/GabeditTextEdit.h ../Symmetry/MoleculeSymmetry.h \ + ../Symmetry/MoleculeSymmetryInterface.h diff -Nru gabedit-2.3.7/src/NWChem/Makefile gabedit-2.4.0/src/NWChem/Makefile --- gabedit-2.3.7/src/NWChem/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ gabedit-2.4.0/src/NWChem/Makefile 2011-09-22 14:25:07.000000000 +0000 @@ -0,0 +1,22 @@ +OBJECTS = NWChem.o NWChemMolecule.o NWChemKeywords.o NWChemGuess.o NWChemBasis.o + +include ../../CONFIG +CFLAGS = $(COMMONCFLAGS) $(GTKCFLAGS) + +all: compiling + +%.o : %.c + $(CC) -c $(CFLAGS) $< -o $@ + +compiling: $(OBJECTS) + +clean: + @$(RM) *.chk p *o gabedit *.com *.out *.log *.test test* *.cpp *old *.ps .*swp *~ + +#make dependance +SRCS = $(OBJECTS:%.o=%.c) +dep : + gcc -MM $(SRCS) > Dep.mk + +-include Dep.mk + diff -Nru gabedit-2.3.7/src/NWChem/NWChemBasis.c gabedit-2.4.0/src/NWChem/NWChemBasis.c --- gabedit-2.3.7/src/NWChem/NWChemBasis.c 1970-01-01 00:00:00.000000000 +0000 +++ gabedit-2.4.0/src/NWChem/NWChemBasis.c 2011-09-22 14:25:07.000000000 +0000 @@ -0,0 +1,661 @@ +/* NWChemBasis.c */ +/********************************************************************************************************** +Copyright (c) 2002-2011 Abdul-Rahman Allouche. All rights reserved + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the Gabedit), to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions + of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +************************************************************************************************************/ + +#include +#include + +#include "../../Config.h" +#include "../Common/Global.h" +#include "../NWChem/NWChemTypes.h" +#include "../NWChem/NWChemGlobal.h" +#include "../Geometry/GeomGlobal.h" +#include "../Geometry/GeomConversion.h" +#include "../Geometry/GeomXYZ.h" +#include "../Geometry/Fragments.h" +#include "../Geometry/DrawGeom.h" +#include "../Utils/Utils.h" +#include "../Utils/UtilsInterface.h" +#include "../Utils/Constants.h" +#include "../Geometry/InterfaceGeom.h" +#include "../Common/Windows.h" +#include "../Utils/Constants.h" +#include "../Utils/AtomsProp.h" +#include "../Utils/GabeditTextEdit.h" +#include "../Symmetry/MoleculeSymmetry.h" +#include "../Symmetry/MoleculeSymmetryInterface.h" + +static gchar selectedTypeBasis[BSIZE]=""; +static gchar** listBasisReal = NULL; +static gchar** listBasisView = NULL; +static gint numberOfBasis = 0; +/*************************************************************************************************************/ +static gchar* listTypeBasisView[] = +{ + "Pople Style basis sets", + "Pople with one diffuse function on non-hydrogen atoms", + "Pople with one diffuse function on all atoms", + "Dunning basis sets", + "Jensen Basis Sets", + "Miscellenous and Specialized Basis Sets", +}; +static gchar* listTypeBasisReal[] = +{ + "Pople", + "PopleDiffuseNonHydrogen", + "PopleDiffuseAllAtoms", + "Dunning", + "Jensen", + "Miscellenous", +}; +static guint numberOfTypeBasis = G_N_ELEMENTS (listTypeBasisView); +/*************************************************************************************************************/ +static gchar* listPopleBasisView[] = +{ + "6-31G Pople 6-31G and its modifications", + "6-311G Pople 6-311G and its modifications", + + "3-21G* 3-21G plus one polarisation function all non-hydrogens atoms", + "6-31G* 6-31G plus one polarisation function all non-hydrogens atoms", + "6-311G* 6-311G plus one polarisation function all non-hydrogens atoms", + + "3-21G** 3-21G plus one polarisation function all atoms", + "6-31G** 6-31G plus one polarisation function all atoms", + "6-311G** 6-311G plus one polarisation function all atoms", + + "3-21G(2d) 3-21G plus two polarisation functions all non-hydrogens atoms", + "6-31G(2d) 6-31G plus two polarisation functions all non-hydrogens atoms", + "6-311G(2d) 6-311G plus two polarisation functions all non-hydrogens atoms", + + "3-21G(2d,2p) 3-21G plus two polarisation functions all atoms", + "6-31G(2d,2p) 6-31G plus two polarisation functions all atoms", + "6-311G(2d,2p) 6-311G plus two polarisation functions all atoms", + + "3-21G(2df) 3-21G plus three polarisation functions all non-hydrogens atoms", + "6-31G(2df) 6-31G plus three polarisation functions all non-hydrogens atoms", + "6-311G(2df) 6-311G plus three polarisation functions all non-hydrogens atoms", + + "3-21G(2df,2pd) 3-21G plus three polarisation functions all atoms", + "6-31G(2df,2pd) 6-31G plus three polarisation functions all atoms", + "6-311G(2df,2pd) 6-311G plus three polarisation functions all atoms", + + "3-21G(3df) 3-21G plus four polarisation functions all non-hydrogens atoms", + "6-31G(3df) 6-31G plus four polarisation functions all non-hydrogens atoms", + "6-311G(3df) 6-311G plus four polarisation functions all non-hydrogens atoms", + + "3-21G(3df,3pd) 3-21G plus four polarisation functions all atoms", + "6-31G(3df,3pd) 6-31G plus four polarisation functions all atoms", + "6-311G(3df,3pd) 6-311G plus four polarisation functions all atoms", +}; +static gchar* listPopleBasisReal[] = +{ + "6-31G", + "6-311G", + + "3-21G*", + "6-31G*", + "6-311G*", + + "3-21G**", + "6-31G**", + "6-311G**", + + "3-21G(2d)", + "6-31G(2d)", + "6-311G(2d)", + + "3-21G(2d,2p)", + "6-31G(2d,2p)", + "6-311G(2d,2p)", + + "3-21G(2df)", + "6-31G(2df)", + "6-311G(2df)", + + "3-21G(2df,2pd)", + "6-31G(2df,2pd)", + "6-311G(2df,2pd)", + + "3-21G(3df)", + "6-31G(3df)", + "6-311G(3df)", + + "3-21G(3df,3pd)", + "6-31G(3df,3pd)", + "6-311G(3df,3pd)", +}; +static guint numberOfPopleBasis = G_N_ELEMENTS (listPopleBasisView); +/*************************************************************************************************************/ +static gchar* listPopleDiffuseNonHydrogenBasisView[] = +{ + "3-21+G 3-21G plus diffuse functions on all non-hydrogens atoms", + "6-31+G 6-31G plus diffuse functions on all non-hydrogens atoms", + "6-311+G 6-311G plus diffuse functions on all non-hydrogens atoms", + + "3-21+G* 3-21G + diff. non-hydrogens + 1 pol. non-hydrogens", + "6-31+G* 6-31G + diff. non-hydrogens + 1 pol. non-hydrogens", + "6-311+G* 6-311G + diff. non-hydrogens + 1 pol. non-hydrogens", + + "3-21+G** 3-21G + diff. non-hydrogens + 1 pol. ", + "6-31+G** 6-31G + diff. non-hydrogens + 1 pol. ", + "6-311+G** 6-311G + diff. non-hydrogens + 1 pol. ", + + "3-21+G(2d) 3-21G + diff. non-hydrogens + 2 pol. non-hydrogens", + "6-31+G(2d) 6-31G + diff. non-hydrogens + 2 pol. non-hydrogens", + "6-311+G(2d) 6-311G + diff. non-hydrogens + 2 pol. non-hydrogens", + + "3-21+G(2d,2p) 3-21G + diff. non-hydrogens + 2 pol.", + "6-31+G(2d,2p) 6-31G + diff. non-hydrogens + 2 pol.", + "6-311+G(2d,2p) 6-311G + diff. non-hydrogens + 2 pol.", + + "3-21+G(2df) 3-21G + diff. non-hydrogens + 3 pol. non-hydrogens", + "6-31+G(2df) 6-31G + diff. non-hydrogens + 3 pol. non-hydrogens", + "6-311+G(2df) 6-311G + diff. non-hydrogens + 3 pol. non-hydrogens", + + "3-21+G(2df,2pd) 3-21G + diff. non-hydrogens + 3 pol.", + "6-31+G(2df,2pd) 6-31G + diff. non-hydrogens + 3 pol.", + "6-311+G(2df,2pd) 6-311G + diff. non-hydrogens + 3 pol.", + + "3-21+G(3df) 3-21G + diff. non-hydrogens + 4 pol. non-hydrogens", + "6-31+G(3df) 6-31G + diff. non-hydrogens + 4 pol. non-hydrogens", + "6-311+G(3df) 6-311G + diff. non-hydrogens + 4 pol. non-hydrogens", + + "3-21+G(3df,3pd) 3-21G + diff. non-hydrogens + 4 pol.", + "6-31+G(3df,3pd) 6-31G + diff. non-hydrogens + 4 pol.", + "6-311+G(3df,3pd) 6-311G + diff. non-hydrogens + 4 pol.", +}; +static gchar* listPopleDiffuseNonHydrogenBasisReal[] = +{ + "3-21+G", + "6-31+G", + "6-311+G", + + "3-21+G*", + "6-31+G*", + "6-311+G*", + + "3-21+G**", + "6-31+G**", + "6-311+G**", + + "3-21+G(2d)", + "6-31+G(2d)", + "6-311+G(2d)", + + "3-21+G(2d,2p)", + "6-31+G(2d,2p)", + "6-311+G(2d,2p)", + + "3-21+G(2df)", + "6-31+G(2df)", + "6-311+G(2df)", + + "3-21+G(2df,2pd)", + "6-31+G(2df,2pd)", + "6-311+G(2df,2pd)", + + "3-21+G(3df)", + "6-31+G(3df)", + "6-311+G(3df)", + + "3-21+G(3df,3pd)", + "6-31+G(3df,3pd)", + "6-311+G(3df,3pd)", +}; +static guint numberOfPopleDiffuseNonHydrogenBasis = G_N_ELEMENTS (listPopleDiffuseNonHydrogenBasisView); +/*************************************************************************************************************/ +static gchar* listPopleDiffuseAllAtomsBasisView[] = +{ + "3-21++G 3-21G plus diffuse functions on all atoms", + "6-31++G 6-31G plus diffuse functions on all atoms", + "6-311++G 6-311G plus diffuse functions on all atoms", + + "3-21++G* 3-21G + diff. + 1 pol. non-hydrogens", + "6-31++G* 6-31G + diff. + 1 pol. non-hydrogens", + "6-311++G* 6-311G + diff. + 1 pol. non-hydrogens", + + "3-21++G** 3-21G + diff. + 1 pol. ", + "6-31++G** 6-31G + diff. + 1 pol. ", + "6-311++G** 6-311G + diff. + 1 pol. ", + + "3-21++G(2d) 3-21G + diff. + 2 pol. non-hydrogens", + "6-31++G(2d) 6-31G + diff. + 2 pol. non-hydrogens", + "6-311++G(2d) 6-311G + diff. + 2 pol. non-hydrogens", + + "3-21++G(2d,2p) 3-21G + diff. + 2 pol.", + "6-31++G(2d,2p) 6-31G + diff. + 2 pol.", + "6-311++G(2d,2p) 6-311G + diff. + 2 pol.", + + "3-21++G(2df) 3-21G + diff. + 3 pol. non-hydrogens", + "6-31++G(2df) 6-31G + diff. + 3 pol. non-hydrogens", + "6-311++G(2df) 6-311G + diff. + 3 pol. non-hydrogens", + + "3-21++G(2df,2pd) 3-21G + diff. + 3 pol.", + "6-31++G(2df,2pd) 6-31G + diff. + 3 pol.", + "6-311++G(2df,2pd) 6-311G + diff. + 3 pol.", + + "3-21++G(3df) 3-21G + diff. + 4 pol. non-hydrogens", + "6-31++G(3df) 6-31G + diff. + 4 pol. non-hydrogens", + "6-311++G(3df) 6-311G + diff. + 4 pol. non-hydrogens", + + "3-21++G(3df,3pd) 3-21G + diff. + 4 pol.", + "6-31++G(3df,3pd) 6-31G + diff. + 4 pol.", + "6-311++G(3df,3pd) 6-311G + diff. + 4 pol.", + +}; +static gchar* listPopleDiffuseAllAtomsBasisReal[] = +{ + "3-21++G", + "6-31++G", + "6-311++G", + + "3-21++G*", + "6-31++G*", + "6-311++G*", + + "3-21++G**", + "6-31++G**", + "6-311++G**", + + "3-21++G(2d)", + "6-31++G(2d)", + "6-311++G(2d)", + + "3-21++G(2d,2p)", + "6-31++G(2d,2p)", + "6-311++G(2d,2p)", + + "3-21++G(2df)", + "6-31++G(2df)", + "6-311++G(2df)", + + "3-21++G(2df,2pd)", + "6-31++G(2df,2pd)", + "6-311++G(2df,2pd)", + + "3-21++G(3df)", + "6-31++G(3df)", + "6-311++G(3df)", + + "3-21++G(3df,3pd)", + "6-31++G(3df,3pd)", + "6-311++G(3df,3pd)", +}; +static guint numberOfPopleDiffuseAllAtomsBasis = G_N_ELEMENTS (listPopleDiffuseAllAtomsBasisView); +/*************************************************************************************************************/ +static gchar* listDunningBasisView[] = +{ + "cc-pVDZ Dunning correlation concisistent polarized double zeta", + "Aug-cc-pVDZ Same but including diffuse functions", + "cc-pVTZ Dunning correlation concisistent polarized triple zeta", + "Aug-cc-pVTZ Same but including diffuse functions(g-functions deleted!)", + "cc-pVQZ Dunning correlation concisistent polarized quadruple zeta", + "Aug-cc-pVQZ with diffuse functions", + "cc-pV5Z Dunning correlation concisistent polarized quintuple zeta", + "Aug-cc-pV5Z with diffuse functions", + "cc-pV6Z Dunning correlation concisistent polarized sextuple zeta", + "Aug-cc-pV6Z ... with diffuse functions", +}; +static gchar* listDunningBasisReal[] = +{ + "cc-pVDZ", + "Aug-cc-pVDZ", + "cc-pVTZ", + "Aug-cc-pVTZ", + "cc-pVQZ", + "Aug-cc-pVQZ", + "cc-pV5Z", + "Aug-cc-pV5Z", + "cc-pV6Z", + "Aug-cc-pV6Z", +}; +static guint numberOfDunningBasis = G_N_ELEMENTS (listDunningBasisView); +/*************************************************************************************************************/ +static gchar* listJensenBasisView[] = +{ + "PC-1 Polarization consistent basis sets (H-Ar) optimized for DFT", + "PC-2 double zeta polarization consistent basis sets (H-Ar) optimized for DFT", + "PC-3 triple zeta polarization consistent basis sets (H-Ar) optimized for DFT", + "PC-4 quadruple zeta polarization consistent basis sets (H-Ar) optimized for DFT", + "Aug-PC-1 PC-1 with augmentations by diffuse functions", + "Aug-PC-2 PC-2 with augmentations by diffuse functions", + "Aug-PC-3 PC-3 with augmentations by diffuse functions", + "Aug-PC-4 PC-4 with augmentations by diffuse functions", +}; +static gchar* listJensenBasisReal[] = +{ + "PC-1", + "PC-2", + "PC-3", + "PC-4", + "Aug-PC-1", + "Aug-PC-2", + "Aug-PC-3", + "Aug-PC-4", +}; +static guint numberOfJensenBasis = G_N_ELEMENTS (listJensenBasisView); +/*************************************************************************************************************/ +static gchar* listMiscellenousBasisView[] = +{ + "IGLO-II Kutzelniggs basis set for NMR and EPR calculations", + "IGLO-III Kutzelniggs basis set for NMR and EPR calculations (accurate)", + +}; +static gchar* listMiscellenousBasisReal[] = +{ + "IGLO-II", + "IGLO-III", +}; +static guint numberOfMiscellenousBasis = G_N_ELEMENTS (listMiscellenousBasisView); +/*************************************************************************************************************/ +static gchar* listAuxBasisView[] = +{ + "cc-pVDZ-RI", + "cc-pVTZ-RI", + "cc-pVQZ-RI", + "cc-pV5Z-RI", + "cc-pV6Z-RI", + "pCVDZ-RI", +}; +static gchar* listAuxBasisReal[] = +{ + "cc-pVDZ-RI", + "cc-pVTZ-RI", + "cc-pVQZ-RI", + "cc-pV5Z-RI", + "cc-pV6Z-RI", + "pCVDZ-RI", +}; +static guint numberOfAuxBasis = G_N_ELEMENTS (listAuxBasisView); +/*************************************************************************************************************/ +static void setNWChemBasis(GtkWidget* comboBasis) +{ + gint i; + + if(strcmp(selectedTypeBasis, "Pople")==0) + { + listBasisView = listPopleBasisView; + listBasisReal = listPopleBasisReal; + numberOfBasis = numberOfPopleBasis; + } + else if(strcmp(selectedTypeBasis, "PopleDiffuseNonHydrogen")==0) + { + listBasisView = listPopleDiffuseNonHydrogenBasisView; + listBasisReal = listPopleDiffuseNonHydrogenBasisReal; + numberOfBasis = numberOfPopleDiffuseNonHydrogenBasis; + } + else if(strcmp(selectedTypeBasis, "PopleDiffuseAllAtoms")==0) + { + listBasisView = listPopleDiffuseAllAtomsBasisView; + listBasisReal = listPopleDiffuseAllAtomsBasisReal; + numberOfBasis = numberOfPopleDiffuseAllAtomsBasis; + } + else if(strcmp(selectedTypeBasis, "Dunning")==0) + { + listBasisView = listDunningBasisView; + listBasisReal = listDunningBasisReal; + numberOfBasis = numberOfDunningBasis; + } + else if(strcmp(selectedTypeBasis, "Jensen")==0) + { + listBasisView = listJensenBasisView; + listBasisReal = listJensenBasisReal; + numberOfBasis = numberOfJensenBasis; + } + else + { + listBasisView = listMiscellenousBasisView; + listBasisReal = listMiscellenousBasisReal; + numberOfBasis = numberOfMiscellenousBasis; + } + + if (comboBasis && GTK_IS_COMBO_BOX(comboBasis)) + { + GtkTreeModel * model = NULL; + model = gtk_combo_box_get_model(GTK_COMBO_BOX(comboBasis)); + gtk_list_store_clear(GTK_LIST_STORE(model)); + + for(i=0;ichild; + g_object_set_data(G_OBJECT (entry), "Combo",combo); + + return entry; +} +/***********************************************************************************************/ +void addNWChemTypeBasisToTable(GtkWidget *table, gint i, GtkWidget* comboBasis) +{ + GtkWidget* combo = NULL; + + add_label_table(table,_("Type"),(gushort)i,0); + add_label_table(table,":",(gushort)i,1); + combo = create_list_type_basis(comboBasis); + gtk_table_attach(GTK_TABLE(table),combo,2,2+1,i,i+1, + (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), + (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), + 3,3); +} +/***********************************************************************************************/ +GtkWidget* addNWChemBasisToTable(GtkWidget *table, gint i) +{ + GtkWidget* entryBasis = NULL; + GtkWidget* comboBasis = NULL; + gint nlistBasis = 1; + gchar* listBasis[] = {" "}; + + + add_label_table(table,_("Basis"),(gushort)i,0); + add_label_table(table,":",(gushort)i,1); + entryBasis = addComboListToATable(table, listBasis, nlistBasis, i, 2, 1); + comboBasis = g_object_get_data(G_OBJECT (entryBasis), "Combo"); + gtk_widget_set_sensitive(entryBasis, FALSE); + + g_signal_connect(G_OBJECT(entryBasis),"changed", G_CALLBACK(changedEntryBasis),NULL); + return comboBasis; +} +/***********************************************************************************************/ +void addNWChemAuxBasisToTable(GtkWidget *table, gint i, GtkWidget* comboMethod, GtkWidget* comboExcited) +{ + GtkWidget* entryAuxBasis = NULL; + GtkWidget* comboAuxBasis = NULL; + GtkWidget* label = NULL; + + label = add_label_table(table,_("Auxiliary basis"),(gushort)i,0); + if(comboMethod) g_object_set_data(G_OBJECT (comboMethod), "LabelAuxBasis1", label); + if(comboExcited) g_object_set_data(G_OBJECT (comboExcited), "LabelAuxBasis1", label); + label = add_label_table(table,":",(gushort)i,1); + if(comboMethod) g_object_set_data(G_OBJECT (comboMethod), "LabelAuxBasis2", label); + if(comboExcited) g_object_set_data(G_OBJECT (comboExcited), "LabelAuxBasis2", label); + entryAuxBasis = addComboListToATable(table, listAuxBasisView, numberOfAuxBasis, i, 2, 1); + comboAuxBasis = g_object_get_data(G_OBJECT (entryAuxBasis), "Combo"); + gtk_widget_set_sensitive(entryAuxBasis, FALSE); + if(comboMethod) g_object_set_data(G_OBJECT (comboMethod), "ComboAuxBasis", comboAuxBasis); + if(comboExcited) g_object_set_data(G_OBJECT (comboExcited), "ComboAuxBasis", comboAuxBasis); + + g_signal_connect(G_OBJECT(entryAuxBasis),"changed", G_CALLBACK(changedEntryAuxBasis),NULL); + nwchemMolecule.auxBasisName=g_strdup(listAuxBasisReal[0]); +} +/***********************************************************************************************/ +static void putNWChemBasisInTextEditor() +{ + gchar buffer[BSIZE]; + + gabedit_text_insert (GABEDIT_TEXT(text), NULL, &nwchemColorFore.keyWord, &nwchemColorBack.keyWord, "\nbasis \"ao basis\" spherical\n", -1); + sprintf(buffer," * library %s ",nwchemBasis.name); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer, -1); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, &nwchemColorFore.keyWord, &nwchemColorBack.keyWord, "\nend\n", -1); + +} +/***********************************************************************************************/ +void putNWChemAuxBasisInTextEditor() +{ + gchar buffer[BSIZE]; + + if(!nwchemMolecule.auxBasisName) return; + gabedit_text_insert (GABEDIT_TEXT(text), NULL, &nwchemColorFore.keyWord, &nwchemColorBack.keyWord, "\nbasis \"ri-mp2 basis\" spherical\n", -1); + sprintf(buffer," * library %s",nwchemMolecule.auxBasisName); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer, -1); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, &nwchemColorFore.keyWord, &nwchemColorBack.keyWord, "\nend\n", -1); +} +/***********************************************************************************************/ +void putNWChemBasisInfoInTextEditor() +{ + putNWChemBasisInTextEditor(); +} diff -Nru gabedit-2.3.7/src/NWChem/NWChemBasis.h gabedit-2.4.0/src/NWChem/NWChemBasis.h --- gabedit-2.3.7/src/NWChem/NWChemBasis.h 1970-01-01 00:00:00.000000000 +0000 +++ gabedit-2.4.0/src/NWChem/NWChemBasis.h 2011-09-22 14:25:07.000000000 +0000 @@ -0,0 +1,14 @@ + +#ifndef __GABEDIT_NWCHEMBASIS_H__ +#define __GABEDIT_NWCHEMBASIS_H__ + +void initNWChemBasis(); +void freeNWChemBasis(); +void addNWChemTypeBasisToTable(GtkWidget *table, gint i, GtkWidget* comboBasis); +GtkWidget* addNWChemBasisToTable(GtkWidget *table, gint i); +void addNWChemAuxBasisToTable(GtkWidget *table, gint i, GtkWidget* comboMethod, GtkWidget* comboExcited); +void putNWChemBasisInfoInTextEditor(); +void putNWChemAuxBasisInTextEditor(); + +#endif /* __GABEDIT_NWCHEMBASIS_H__ */ + diff -Nru gabedit-2.3.7/src/NWChem/NWChem.c gabedit-2.4.0/src/NWChem/NWChem.c --- gabedit-2.3.7/src/NWChem/NWChem.c 1970-01-01 00:00:00.000000000 +0000 +++ gabedit-2.4.0/src/NWChem/NWChem.c 2011-09-22 14:25:07.000000000 +0000 @@ -0,0 +1,217 @@ +/* NWChem.c */ +/********************************************************************************************************** +Copyright (c) 2002-2011 Abdul-Rahman Allouche. All rights reserved + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the Gabedit), to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions + of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +************************************************************************************************************/ + + +#include "../../Config.h" +#include "../Common/Global.h" +#include "../NWChem/NWChemTypes.h" +#include "../NWChem/NWChemGlobal.h" +#include "../NWChem/NWChemMolecule.h" +#include "../NWChem/NWChemKeywords.h" +#include "../NWChem/NWChemBasis.h" +#include "../NWChem/NWChemGuess.h" +#include "../Utils/UtilsInterface.h" +#include "../Geometry/GeomGlobal.h" +#include "../Geometry/InterfaceGeom.h" +#include "../Utils/Utils.h" +#include "../Utils/AtomsProp.h" +#include "../Utils/Constants.h" +#include "../Utils/GabeditTextEdit.h" + +static GtkWidget *Wins=NULL; +static gboolean newFile = FALSE; +/************************************************************************************************************/ +static void setColors() +{ + static gboolean first = TRUE; + + if(!first) return; + first = FALSE; + + nwchemColorFore.keyWord.red = 65535; + nwchemColorFore.keyWord.green = 0; + nwchemColorFore.keyWord.blue = 0; + + nwchemColorBack.keyWord.red = (gushort)(65535/1.2); + nwchemColorBack.keyWord.green = (gushort)(65535/1.2); + nwchemColorBack.keyWord.blue = (gushort)(65535/1.2); + + nwchemColorFore.description.red = 0; + nwchemColorFore.description.green = 65535; + nwchemColorFore.description.blue = 65535; + + nwchemColorBack.description.red = (gushort)(65535/2.0); + nwchemColorBack.description.green = (gushort)(65535/2.0); + nwchemColorBack.description.blue = (gushort)(65535/2.0); + +} +/************************************************************************************************************/ +void destroyWinsNWChem(GtkWidget *win) +{ + destroy(Wins,NULL); + Wins = NULL; + initNWChemMoleculeButtons(); + initNWChemGuessFrame(); + /* + freeNWChemMolecule(); + freeNWChemMpqc(); + freeNWChemBasis(); + */ +} +/************************************************************************************************************/ +static void toCancelWin(GtkWidget* win,gpointer data) +{ + Cancel_YesNo(win, data, destroy_children); +} +/************************************************************************************************************/ +static void putTitleInTextEditor() +{ + gchar buffer[BSIZE]; + + sprintf(buffer,"%c ================================================================\n",'#'); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1); + + sprintf(buffer,"%c NWChem input file made in Gabedit\n",'#'); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1); + + sprintf(buffer,"%c ================================================================\n",'#'); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1); +} +/************************************************************************************************************/ +static void putInfoInTextEditor(GtkWidget *button, gpointer data) +{ + setColors(); + if(newFile) + { + reset_name_files(); + ClearText(text); + } + else + { + gint nchar; + nchar=gabedit_text_get_length(GABEDIT_TEXT(text)); + gabedit_text_set_point(GABEDIT_TEXT(text),nchar); + } + data_modify(TRUE); + + putTitleInTextEditor(); + + putNWChemMoleculeInfoInTextEditor(); + + putNWChemKeywordsInfoInTextEditor(); + + + iprogram = PROG_IS_NWCHEM; + fileopen.command=g_strdup(NameCommandNWChem); + gtk_notebook_set_current_page((GtkNotebook*)NoteBookText,0); +} +/*********************************************************************************************/ +static GtkWidget* addHboxToTable(GtkWidget* table, gint i, gint j, gint ki, gint kj) +{ + GtkWidget *hbox = gtk_hbox_new(TRUE, 5); + + gtk_table_attach(GTK_TABLE(table),hbox,j,j+kj,i,i+ki, + (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), + (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), + 3,3); + + return hbox; +} +/************************************************************************************************************/ +static void nwchemInputFileWindow(gboolean newInputFile) +{ + GtkWidget *button; + GtkWidget *hbox = NULL; + GtkWidget *hboxChargeMultiplicity = NULL; + + GtkWidget *table = gtk_table_new(6,2,FALSE); + + newFile = newInputFile; + + initNWChemMolecule(); + setNWChemMolecule(); + + + if(nwchemMolecule.numberOfAtoms <1) + { + Message( + _( + "You must initially define your geometry.\n\n" + "From the principal Menu select : Geometry/Draw\n" + "and draw (or read) your molecule."), + _("Error"),TRUE); + return; + } + + if(Wins) destroy_children(Wins); + + Wins= gtk_dialog_new (); + gtk_window_set_position(GTK_WINDOW(Wins),GTK_WIN_POS_CENTER); + gtk_window_set_transient_for(GTK_WINDOW(Wins),GTK_WINDOW(Fenetre)); + gtk_window_set_title(>K_DIALOG(Wins)->window,_("NWChem input")); + gtk_window_set_modal (GTK_WINDOW (Wins), TRUE); + + init_child(Wins, destroyWinsNWChem,_(" NWChem input ")); + g_signal_connect(G_OBJECT(Wins),"delete_event",(GCallback)destroy_children,NULL); + + gtk_widget_realize(Wins); + + button = create_button(Wins,_("Cancel")); + gtk_box_pack_start (GTK_BOX( GTK_DIALOG(Wins)->action_area), button, FALSE, TRUE, 5); + g_signal_connect_swapped(G_OBJECT(button), "clicked", G_CALLBACK( toCancelWin),GTK_OBJECT(Wins)); + GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); + gtk_widget_show (button); + + button = create_button(Wins,_("OK")); + + gtk_box_pack_start (GTK_BOX( GTK_DIALOG(Wins)->vbox), table, FALSE, TRUE, 5); + + hbox =addHboxToTable(table, 0, 0, 1, 1); + hboxChargeMultiplicity = hbox; + + hbox =addHboxToTable(table, 1, 0, 1, 2); + initNWChemGuessFrame(); + createNWChemKeywordsFrame(Wins, hbox); + createNWChemChargeMultiplicityFrame(hboxChargeMultiplicity); + + hbox =addHboxToTable(table, 2, 0, 1, 2); + createNWChemGuessFrame(Wins, hbox); + + + gtk_box_pack_start (GTK_BOX( GTK_DIALOG(Wins)->action_area), button, FALSE, TRUE, 5); + GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); + gtk_widget_grab_default(button); + gtk_widget_show (button); + g_signal_connect_swapped(G_OBJECT(button), "clicked",G_CALLBACK(putInfoInTextEditor),GTK_OBJECT(Wins)); + g_signal_connect_swapped(G_OBJECT(button), "clicked",G_CALLBACK(destroy_children),GTK_OBJECT(Wins)); + + + gtk_widget_show_all(Wins); + nwchemWin = Wins; +} +/************************************************************************************************************/ +void newNWChem() +{ + nwchemInputFileWindow(TRUE); +} +/************************************************************************************************************/ +void insertNWChem() +{ + nwchemInputFileWindow(FALSE); +} diff -Nru gabedit-2.3.7/src/NWChem/NWChemGlobal.h gabedit-2.4.0/src/NWChem/NWChemGlobal.h --- gabedit-2.3.7/src/NWChem/NWChemGlobal.h 1970-01-01 00:00:00.000000000 +0000 +++ gabedit-2.4.0/src/NWChem/NWChemGlobal.h 2011-09-22 14:25:07.000000000 +0000 @@ -0,0 +1,17 @@ + +#ifndef __GABEDIT_NWCHEMGLOBAL_H__ +#define __GABEDIT_NWCHEMGLOBAL_H__ + +GtkWidget* nwchemWin; +NWChemMolecule nwchemMolecule; +NWChemColorFore nwchemColorFore; +NWChemColorBack nwchemColorBack; +NWChemBasis nwchemBasis; +NWChemGuessWaveFunction nwchemGuessWaveFunction; + +NWChemFunctional* functionals; +NWChemStdFunctional* stdFunctionals; +gdouble* sumFunctionals; + +#endif /* __GABEDIT_NWCHEMGLOBAL_H__ */ + diff -Nru gabedit-2.3.7/src/NWChem/NWChemGuess.c gabedit-2.4.0/src/NWChem/NWChemGuess.c --- gabedit-2.3.7/src/NWChem/NWChemGuess.c 1970-01-01 00:00:00.000000000 +0000 +++ gabedit-2.4.0/src/NWChem/NWChemGuess.c 2011-09-22 14:25:07.000000000 +0000 @@ -0,0 +1,183 @@ +/* NWChemGuess.c */ +/********************************************************************************************************** +Copyright (c) 2002-2011 Abdul-Rahman Allouche. All rights reserved + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the Gabedit), to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions + of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +************************************************************************************************************/ + +#include +#include +#include +#include + +#include "../../Config.h" +#include "../Common/Global.h" +#include "../NWChem/NWChemTypes.h" +#include "../NWChem/NWChemGlobal.h" +#include "../NWChem/NWChemBasis.h" +#include "../Utils/Utils.h" +#include "../Utils/UtilsInterface.h" +#include "../Utils/GabeditTextEdit.h" +#include "../Common/Windows.h" +#include "../Utils/Constants.h" + +static GtkWidget *guessFrame = NULL; +/*************************************************************************************************************/ +static gchar* listGuessMethodView[] = { + "Default", + "PATOM : polarized atoms guess", + "PMODEL : model potential guess", + "HUECKEL : extended Huckel guess", + "HCORE : one-electron matrix guess", +}; +static gchar* listGuessMethodReal[] = { + "NONE", + "PATOM", + "PMODEL", + "HUECKEL", + "HCORE", + +}; +static guint numberOfGuessMethods = G_N_ELEMENTS (listGuessMethodView); +static gchar selectedGuessMethod[BSIZE]="NONE"; +/*************************************************************************************************************/ +void initNWChemGuessFrame() +{ + guessFrame = NULL; +} +/*************************************************************************************************************/ +static void putNWChemGuessOptionsInfoInTextEditor() +{ +} +/************************************************************************************************************/ +static void putNWChemGuessMethodInfoInTextEditor() +{ + if( strcmp(selectedGuessMethod,"NONE")==0 ) return; + { + gchar buffer[BSIZE]; + sprintf(buffer," %s ",selectedGuessMethod); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1); + } +} +/*************************************************************************************************************/ +void putNWChemGuessInfoInTextEditor() +{ + putNWChemGuessMethodInfoInTextEditor(); + putNWChemGuessOptionsInfoInTextEditor(); + +} +/************************************************************************************************************/ +static void traitementGuessMethod (GtkComboBox *combobox, gpointer d) +{ + GtkTreeIter iter; + gchar* data = NULL; + gchar* res = NULL; + gint i; + + + /* gchar* s;*/ + if (gtk_combo_box_get_active_iter (combobox, &iter)) + { + GtkTreeModel* model = gtk_combo_box_get_model(combobox); + gtk_tree_model_get (model, &iter, 0, &data, -1); + } + for(i=0;i +#include +#include +#include + +#include "../../Config.h" +#include "../Common/Global.h" +#include "../NWChem/NWChemTypes.h" +#include "../NWChem/NWChemGlobal.h" +#include "../NWChem/NWChemMolecule.h" +#include "../NWChem/NWChemBasis.h" +#include "../NWChem/NWChemGuess.h" +#include "../Utils/Utils.h" +#include "../Utils/UtilsInterface.h" +#include "../Utils/GabeditTextEdit.h" +#include "../Common/Windows.h" +#include "../Utils/Constants.h" + +static GtkWidget* comboSCF = NULL; +static GtkWidget* comboMethod = NULL; +static GtkWidget* comboTypeMethod = NULL; +static GtkWidget* comboExcited = NULL; +static void setNWChemMethods(); +/*************************************************************************************************************/ +static gchar* listJobView[] = { + "Single Point Energy", + "Equilibrium structure search", + "Frequencies", + "Transition state", + "Equilibrium structure search + Frequencies", + "Transition state + Frequencies", +}; +static gchar* listJobReal[] = { + "SP", + "optimize", + "freq", + "saddle", + "opt&freq", + "saddle&freq", +}; +static guint numberOfJobs = G_N_ELEMENTS (listJobView); +static gchar selectedJob[BSIZE]="SP"; +/*************************************************************************************************************/ +static gchar* listSCFView[] = { "default","unrestricted", "restricted"}; +static gchar* listSCFReal[] = { "DEF", "TRUE", "FALSE"}; +static guint numberOfSCF = G_N_ELEMENTS (listSCFView); +static gchar selectedSCF[BSIZE]="DEF"; +/*************************************************************************************************************/ +static gchar* listTypeMethodsView[] = +{ + "Hatree-Fock", + "Hatree-Fock using DFT module", + "Local and gradient corrected functionals", + "Hybrid functionals", + "Meta-GGA and hybrid meta-GGA's", + "Second Order Many Body Perturbation Theory", + "High-level Single Reference Methods", + "Semiempirical Methods", +}; +static gchar* listTypeMethodsReal[] = +{ + "SCF", + "HFexch", + "DFT", + "Hybrid", + "Meta-GGA", + "MP2", + "HL-SR", + "SemiEmp", +}; +static guint numberOfTypeMethods = G_N_ELEMENTS (listTypeMethodsView); +static gchar selectedTypeMethod[BSIZE]="SCF"; +/*************************************************************************************************************/ +static gchar* listHFMethodsView[] = +{ + "HF", +}; +static gchar* listHFMethodsReal[] = +{ + "SCF", +}; +static guint numberOfHFMethods = G_N_ELEMENTS (listHFMethodsView); +/*************************************************************************************************************/ +static gchar* listHFDFTMethodsView[] = +{ + "HFexch", +}; +static gchar* listHFDFTMethodsReal[] = +{ + "XC HFexch", +}; +static guint numberOfHFDFTMethods = G_N_ELEMENTS (listHFDFTMethodsView); +/*************************************************************************************************************/ +static gchar* listDFTMethodsView[] = +{ + "Slater Slater Exchange only functional", + "LDA Local density approximation", + "VWN5 Vosko-Wilk-Nusair local density approx", + "VWN3 Vosko-Wilk-Nusair local density approx.", + "PWLDA Perdew-Wang parameterization of LDA", + "BP86 Becke '88 exchange and Perdew '86 correlation", + "BLYP Becke '88 exchange and Lee-Yang-Parr correlation", + "OLYP Handy's 'optimal' exchange and Lee-Yang-Parr correlation", + "GLYP Gill's '96 exchange and Lee-Yang-Parr correlation", + "XLYP The Xu and Goddard exchange and Lee-Yang-Parr correlation", + "PW91 Perdew-Wang '91 GGA functional", + "mPWPW Modified PW exchange and PW correlation", + "mPWLYP Modified PW exchange and LYP correlation", + "PBE Perdew-Burke-Erzerhoff GGA functional", +}; +static gchar* listDFTMethodsReal[] = +{ + "XC slater", + "XC slater vwn_5", + "XC vwn_5", + "XC vwn_3", + "XC pw91lda", + "XC becke88 perdew86", + "XC becke88 lyp", + "XC op lyp", + "XC gill96 lyp", + "XC xperdew91 lyp", + "XC perdew91", + "XC mpw91 perdew91", + "XC mpw91 lyp", + "XC xpbe96 cpbe96", +}; +static guint numberOfDFTMethods = G_N_ELEMENTS (listDFTMethodsView); +/*************************************************************************************************************/ +static gchar* listHybridMethodsView[] = +{ + "B3LYP The popular B3LYP functional (20% HF exchange)", + "PBE0 One parameter hybrid version of PBE", + "beckehandh", + "acm", + "becke97", + "becke97-1", + "becke97-2", + "becke97-3", + "becke98", + "mpw1k", +}; +static gchar* listHybridMethodsReal[] = +{ + "XC B3LYP", + "XC PBE0", + "XC beckehandh", + "XC acm", + "XC becke97", + "XC becke97-1", + "XC becke97-2", + "XC becke97-3", + "XC becke98", + "XC mpw1k", +}; +static guint numberOfHybridMethods = G_N_ELEMENTS (listHybridMethodsView); +/*************************************************************************************************************/ +static gchar* listMetaGGAMethodsView[] = +{ + "xpkzb99 cpkzb99", + "xtpss03 ctpss03", + "cpw6b95 cpwb6k", + "xm05 cm05", + "xm05-2x cm05-2x", + "xvsxc cvsxc", + "xm06-L cm06-L", + "xm06-hf cm06-hf", + "xm06 cm06", + "xm06-2x cm06-2x", + "xctpssh", + "bb1k", + "mpw1b95", + "mpwb1k", + "pw6b95", + "pwb6k", + "m05", + "vsxc", + "m06-hf", + "m06", + "m06-2x", +}; +static gchar* listMetaGGAMethodsReal[] = +{ + "XC xpkzb99 cpkzb99", + "XC xtpss03 ctpss03", + "XC cpw6b95 cpwb6k", + "XC xm05 cm05", + "XC xm05-2x cm05-2x", + "XC xvsxc cvsxc", + "XC xm06-L cm06-L", + "XC xm06-hf cm06-hf", + "XC xm06 cm06", + "XC xm06-2x cm06-2x", + "XC xctpssh", + "XC bb1k", + "XC mpw1b95", + "XC mpwb1k", + "XC pw6b95", + "XC pwb6k", + "XC m05", + "XC vsxc", + "XC m06-hf", + "XC m06", + "XC m06-2x", +}; +static guint numberOfMetaGGAMethods = G_N_ELEMENTS (listMetaGGAMethodsView); +/*************************************************************************************************************/ +static gchar* listMP2MethodsView[] = +{ + "MP2", + "RIMP2", +}; +static gchar* listMP2MethodsReal[] = +{ + "MP2", + "RIMP2", +}; +static guint numberOfMP2Methods = G_N_ELEMENTS (listMP2MethodsView); +/*************************************************************************************************************/ +static gchar* listHighLevelSingleRefMethodsView[] = +{ + "LCCD", + "CCD", + "CCSD", + "LCCSD", + "CCSDT", + "CCSDTQ", + "CCSD(T) ", + "CCSD[T]", + "CISD", + "QCISD", + "CISDT", + "CISDTQ", + "MBPT2", + "MBPT3", + "MBPT4", +}; +static gchar* listHighLevelSingleRefMethodsReal[] = +{ + "LCCD", + "CCD", + "CCSD", + "LCCSD", + "CCSDT", + "CCSDTQ", + "CCSD(T) ", + "CCSD[T]", + "CISD", + "QCISD", + "CISDT", + "CISDTQ", + "MBPT2", + "MBPT3", + "MBPT4", +}; +static guint numberOfHighLevelSingleRefMethods = G_N_ELEMENTS (listHighLevelSingleRefMethodsView); +/*************************************************************************************************************/ +static gchar* listSemiEmpMethodsView[] = +{ + "ZINDO/S", + "ZINDO/1", + "ZINDO/2", + "NDDO/1", + "NDDO/2", + "MNDO", + "AM1", + "PM3", +}; +static gchar* listSemiEmpMethodsReal[] = +{ + "ZINDO/S", + "ZINDO/1", + "ZINDO/2", + "NDDO/1", + "NDDO/2", + "MNDO", + "AM1", + "PM3", +}; +static guint numberOfSemiEmpMethods = G_N_ELEMENTS (listSemiEmpMethodsView); +/*************************************************************************************************************/ +static gchar selectedMethod[BSIZE]="HF"; +static gchar** listMethodsView = listHybridMethodsView; +static gchar** listMethodsReal = listHybridMethodsReal; +static guint numberOfMethods = G_N_ELEMENTS (listHybridMethodsView); +/*************************************************************************************************************/ +static gchar* listScfConvergenceView[] = { + "Default", + "Energy convergence = 10-6 au", + "Energy convergence = 10-7 au", + "Energy convergence = 10-8 au", + "Energy convergence = 10-9 au", + "Energy convergence = 10-10 au" +}; +static gchar* listScfConvergenceReal[] = { + "NONE", + "1e-6", + "1e-7", + "1e-8", + "1e-9", + "1e-10" + +}; +static guint numberOfScfConvergence = G_N_ELEMENTS (listScfConvergenceView); +static gchar selectedScfConvergence[BSIZE]="NONE"; +/*************************************************************************************************************/ +static gchar* listNothingExcitedView[] = +{ + "Nothing", +}; +static gchar* listNothingExcitedReal[] = +{ + "NONE", +}; +static guint numberOfNothingExcited = G_N_ELEMENTS (listNothingExcitedView); +/*************************************************************************************************************/ +static gchar* listSemiEmpExcitedView[] = +{ + "Nothing", + "CIS", +}; +static gchar* listSemiEmpExcitedReal[] = +{ + "NONE", + "CIS", +}; +static guint numberOfSemiEmpExcited = G_N_ELEMENTS (listSemiEmpExcitedView); +/*************************************************************************************************************/ +static gchar* listHFExcitedView[] = +{ + "Nothing", + "CIS", + "CIS(D)", +}; +static gchar* listHFExcitedReal[] = +{ + "NONE", + "CIS", + "CIS(D)", +}; +static guint numberOfHFExcited = G_N_ELEMENTS (listHFExcitedView); +/*************************************************************************************************************/ +static gchar* listDFTExcitedView[] = +{ + "Nothing", + "CIS", + "TDDFT", +}; +static gchar* listDFTExcitedReal[] = +{ + "NONE", + "CIS", + "TDDFT", +}; +static guint numberOfDFTExcited = G_N_ELEMENTS (listDFTExcitedView); +/*************************************************************************************************************/ +static gchar* listHLExcitedView[] = +{ + "Nothing", + "EOM", +}; +static gchar* listHLExcitedReal[] = +{ + "NONE", + "EOM", +}; +static guint numberOfHLExcited = G_N_ELEMENTS (listHLExcitedView); +/*************************************************************************************************************/ +static gchar selectedExcited[BSIZE]="NONE"; +static gchar** listExcitedView = listNothingExcitedView; +static gchar** listExcitedReal = listNothingExcitedReal; +static guint numberOfExcited = G_N_ELEMENTS (listNothingExcitedView); +/*************************************************************************************************************/ +gchar* getNWChemExcitedMethod() +{ + return selectedExcited; +} +/*************************************************************************************************************/ +gchar* getNWChemTypeMethod() +{ + return selectedTypeMethod; +} +/*************************************************************************************************************/ +static void putNWChemExcitedInfoInTextEditor() +{ + gchar buffer[BSIZE]; + if(!strcmp(selectedExcited,"NONE"))return; + if(!strcmp(selectedExcited,"EOM"))return; + gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, "\n",-1); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, &nwchemColorFore.keyWord, &nwchemColorBack.keyWord, "tddft\n", -1); + + if(strstr(selectedExcited,"CIS")) sprintf(buffer," cis\n"); + else sprintf(buffer," rpa\n"); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1); + + sprintf(buffer," nroots %d # the number of excited states to be calculated.\n",8); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1); + sprintf(buffer, + "# nosinglet\n" + "# notriplet\n" + "# maxvecs 1000 # it is the maximum number of trial vectors that the calculation is allowed to hold\n" + "# thresh 1e-4\n" + "# maxiter 100\n" + "# freeze atomic # To exclude the atom-like core regions\n" + "# freeze 10 # the number of lowest-lying occupied orbitals be excluded\n" + "# freeze virtual 5 # to freeze the top 5 virtual orbitals\n" + ); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1); + + sprintf(buffer,"end #tddft\n"); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL, buffer,-1); +} +/*************************************************************************************************************/ +static void setNWChemExcited() +{ + GtkTreeIter iter; + GtkTreeIter iter0; + gint i; + + if(strcmp(selectedTypeMethod,"HF")==0) + { + listExcitedView = listHFExcitedView; + listExcitedReal = listHFExcitedReal; + numberOfExcited = numberOfHFExcited; + } + else + if(strcmp(selectedTypeMethod,"HFexch")==0) + { + listExcitedView = listDFTExcitedView; + listExcitedReal = listDFTExcitedReal; + numberOfExcited = numberOfDFTExcited; + } + else + if(strcmp(selectedTypeMethod,"DFT")==0) + { + listExcitedView = listDFTExcitedView; + listExcitedReal = listDFTExcitedReal; + numberOfExcited = numberOfDFTExcited; + } + else + if(strcmp(selectedTypeMethod,"Hybrid")==0) + { + listExcitedView = listDFTExcitedView; + listExcitedReal = listDFTExcitedReal; + numberOfExcited = numberOfDFTExcited; + } + else + if(strcmp(selectedTypeMethod,"Meta-GGA")==0) + { + listExcitedView = listDFTExcitedView; + listExcitedReal = listDFTExcitedReal; + numberOfExcited = numberOfDFTExcited; + } + else + if(strcmp(selectedTypeMethod,"HL-SR")==0&& (!strcmp(selectedMethod,"CCSD")||!strcmp(selectedMethod,"CCSDT")||!strcmp(selectedMethod,"CCSDTQ"))) + { + listExcitedView = listHLExcitedView; + listExcitedReal = listHLExcitedReal; + numberOfExcited = numberOfHLExcited; + } + else + if(strcmp(selectedTypeMethod,"SemiEmp")==0 && strstr(selectedMethod,"/S")) + { + listExcitedView = listSemiEmpExcitedView; + listExcitedReal = listSemiEmpExcitedReal; + numberOfExcited = numberOfSemiEmpExcited; + } + else + { + listExcitedView = listNothingExcitedView; + listExcitedReal = listNothingExcitedReal; + numberOfExcited = numberOfNothingExcited; + } + + if (comboExcited && gtk_combo_box_get_active_iter (GTK_COMBO_BOX(comboExcited), &iter)) + { + GtkTreeModel* model = gtk_combo_box_get_model(GTK_COMBO_BOX(comboExcited)); + GtkTreeStore *store = GTK_TREE_STORE(model); + gtk_tree_store_clear(store); + + for(i=0;i +#include +#include + +#include "../../Config.h" +#include "../Common/Global.h" +#include "../NWChem/NWChemTypes.h" +#include "../NWChem/NWChemGlobal.h" +#include "../NWChem/NWChemKeywords.h" +#include "../Geometry/GeomGlobal.h" +#include "../Geometry/GeomConversion.h" +#include "../Geometry/GeomXYZ.h" +#include "../Geometry/Fragments.h" +#include "../Geometry/DrawGeom.h" +#include "../Utils/Utils.h" +#include "../Utils/UtilsInterface.h" +#include "../Utils/Constants.h" +#include "../Utils/GabeditTextEdit.h" +#include "../Geometry/InterfaceGeom.h" +#include "../Common/Windows.h" +#include "../Utils/Constants.h" +#include "../Utils/AtomsProp.h" +#include "../Symmetry/MoleculeSymmetry.h" +#include "../Symmetry/MoleculeSymmetryInterface.h" + +/************************************************************************************************************/ +static gint totalCharge = 0; +static gint spinMultiplicity=1; +/************************************************************************************************************/ +gint getNWChemMultiplicity() +{ + return spinMultiplicity; +} +/************************************************************************************************************/ +void initNWChemMoleculeButtons() +{ +} +/************************************************************************************************************/ +void initNWChemMolecule() +{ + nwchemMolecule.listOfAtoms = NULL; + nwchemMolecule.totalNumberOfElectrons = 0; + nwchemMolecule.numberOfValenceElectrons = 0; + nwchemMolecule.numberOfAtoms = 0; +} +/************************************************************************************************************/ +void freeNWChemMolecule() +{ + static gboolean first = TRUE; + + if(first) + { + initNWChemMolecule(); + first = FALSE; + return; + } + + if(nwchemMolecule.listOfAtoms) g_free(nwchemMolecule.listOfAtoms); + initNWChemMolecule(); +} +/************************************************************************************************************/ +static gint setNWChemMoleculeFromSXYZ(gint nAtoms, gchar** symbols, gdouble* X, gdouble* Y, gdouble* Z) +{ + gint n; + NWChemAtom* atomList = NULL; + + nwchemMolecule.listOfAtoms = NULL; + nwchemMolecule.numberOfAtoms = 0; + if(nAtoms<1) return 1; + + nwchemMolecule.listOfAtoms = (NWChemAtom*)g_malloc(sizeof(NWChemAtom)*(nAtoms)); + if(nwchemMolecule.listOfAtoms==NULL) return -1; + + nwchemMolecule.numberOfAtoms = nAtoms; + + atomList = nwchemMolecule.listOfAtoms; + for(n=0; nposition[0] = X[n]; + atomList->position[1] = Y[n]; + atomList->position[2] = Z[n]; + atomList->symbol = g_strdup(symbols[n]); + atomList++; + } + + return 0; +} +/************************************************************************************************************/ +static void setXYZFromGeomXYZ(gint i, gdouble* x, gdouble* y, gdouble *z) +{ + if(!test(GeomXYZ[i].X)) + *x = get_value_variableXYZ(GeomXYZ[i].X); + else + *x = atof(GeomXYZ[i].X); + if(!test(GeomXYZ[i].Y)) + *y = get_value_variableXYZ(GeomXYZ[i].Y); + else + *y = atof(GeomXYZ[i].Y); + if(!test(GeomXYZ[i].Z)) + *z = get_value_variableXYZ(GeomXYZ[i].Z); + else + *z = atof(GeomXYZ[i].Z); + + if(Units==0) + { + *x *= BOHR_TO_ANG; + *y *= BOHR_TO_ANG; + *z *= BOHR_TO_ANG; + } +} +/************************************************************************************************************/ +static gboolean setNWChemMoleculeFromGeomXYZ() +{ + gint i; + gchar** symbols = NULL; + gdouble* X = NULL; + gdouble* Y = NULL; + gdouble* Z = NULL; + gint numberOfAtoms = NcentersXYZ; + + if(numberOfAtoms<1) return FALSE; + + symbols = (gchar**)g_malloc(sizeof(gchar*)*(numberOfAtoms)); + + if(symbols == NULL) return FALSE; + + X = (gdouble*)g_malloc(sizeof(gdouble)*(numberOfAtoms)); + if(X == NULL) return FALSE; + Y = (gdouble*)g_malloc(sizeof(gdouble)*(numberOfAtoms)); + if(Y == NULL) return FALSE; + Z = (gdouble*)g_malloc(sizeof(gdouble)*(numberOfAtoms)); + if(Z == NULL) return FALSE; + + nwchemMolecule.totalNumberOfElectrons = 0; + for(i=0; iposition[k]-atomList->position[k+1]; + dd += xx*xx; + } + if(i==0) d = dd; + else if(d>dd) d= dd; + atomList++; + } + d = sqrt(d); + + return d; +} +*/ +/*************************************************************************************************************/ +/* +static void setFirstAtomToXAxis(gint numberOfAtoms, gdouble* X, gdouble* Y, gdouble*Z) +{ + gdouble d; + gdouble s; + gdouble c; + gint i; + gdouble positionTolerance = -1; + + if(numberOfAtoms<1) return; + d = X[0]*X[0]+Y[0]*Y[0]; + if(d<1e-10) return; + d = sqrt(d); + if(positionTolerance<0) positionTolerance= getMinDistance()/50; + + s = -Y[0]/d; + c = +X[0]/d; + + for (i=0;i0) + for(i=0;i0 && nV!= 3*nwchemMolecule.numberOfAtoms) + { + sprintf(buffer,"\nconstraints\n"); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, &nwchemColorFore.keyWord, &nwchemColorBack.keyWord, buffer, -1); + for (i=0;iNUMBER_ENTRY_0) line=g_strdup_printf("%s\t%s\t%s",line,Geom[i].NR,Geom[i].R); + if(Geom[i].Nentry>NUMBER_ENTRY_R) line=g_strdup_printf("%s\t%s\t%s",line,Geom[i].NAngle,Geom[i].Angle); + if(Geom[i].Nentry>NUMBER_ENTRY_ANGLE) line=g_strdup_printf("%s\t%s\t%s",line,Geom[i].NDihedral,Geom[i].Dihedral); + line=g_strdup_printf("%s\n",line); + prop = prop_atom_get(Geom[i].Symb); + gabedit_text_insert (GABEDIT_TEXT(text), NULL,NULL, &prop.color,line,-1); + g_free(line); + } + if(NVariables>0) + { + gint nV = 0; + for(i=0;i0) + { + gabedit_text_insert (GABEDIT_TEXT(text), NULL, NULL, NULL,"\t",-1); + gabedit_text_insert (GABEDIT_TEXT(text), NULL, &nwchemColorFore.keyWord, &nwchemColorBack.keyWord,"end\n",-1); + } + + } + gabedit_text_insert (GABEDIT_TEXT(text), NULL, &nwchemColorFore.keyWord, &nwchemColorBack.keyWord,"end\n",-1); + } + +} +/************************************************************************************************************/ +void putNWChemMoleculeInfoInTextEditor() +{ + putNWChemMoleculeInTextEditor(); +} +/************************************************************************************************************/ +/* +static GtkWidget* addRadioButtonToATable(GtkWidget* table, GtkWidget* friendButton, gchar* label, gint i, gint j, gint k) +{ + GtkWidget *newButton; + + if(friendButton) + newButton = gtk_radio_button_new_with_label( gtk_radio_button_get_group (GTK_RADIO_BUTTON (friendButton)), label); + else + newButton = gtk_radio_button_new_with_label( NULL, label); + + gtk_table_attach(GTK_TABLE(table),newButton,j,j+k,i,i+1, + (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), + (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), + 2,2); + + g_object_set_data(G_OBJECT (newButton), "Label",NULL); + g_object_set_data(G_OBJECT (newButton), "Type",NULL); + return newButton; +} +*/ +/********************************************************************************/ +static void setSpinMultiplicityComboSpinMultiplicity(GtkWidget *comboSpinMultiplicity, gint spin) +{ + GtkWidget *entry = NULL; + gchar* t = NULL; + if(!comboSpinMultiplicity) return; + entry = GTK_BIN (comboSpinMultiplicity)->child; + t = g_strdup_printf("%d",spin); + gtk_entry_set_text(GTK_ENTRY(entry),t); + g_free(t); +} +/************************************************************************************************************/ +static void setComboSpinMultiplicity(GtkWidget *comboSpinMultiplicity) +{ + GList *glist = NULL; + gint i; + gint nlist = 0; + gchar** list = NULL; + gint k; + gint kinc; + gint ne = nwchemMolecule.numberOfValenceElectrons - totalCharge; + + if(ne%2==0) nlist = ne/2+1; + else nlist = (ne+1)/2; + + if(nlist<1) return; + list = g_malloc(nlist*sizeof(gchar*)); + if(!list) return; + for(i=0;ichild; + t = g_strdup_printf("%d",charge); + gtk_entry_set_text(GTK_ENTRY(entry),t); + g_free(t); +} +/********************************************************************************/ +static void setComboCharge(GtkWidget *comboCharge) +{ + GList *glist = NULL; + gint i; + gint nlist; + gchar** list = NULL; + gint k; + + nlist = nwchemMolecule.numberOfValenceElectrons*2-2+1; + + if(nlist<1) return; + list = g_malloc(nlist*sizeof(gchar*)); + if(!list) return; + for(i=0;ichild; + g_object_set_data(G_OBJECT (entry), "Combo",combo); + gtk_widget_set_size_request(GTK_WIDGET(entry),(gint)(ScreenHeight*0.2),-1); + + return entry; +} +/***********************************************************************************************/ +static GtkWidget *addNWChemChargeToTable(GtkWidget *table, gint i) +{ + GtkWidget* entryCharge = NULL; + GtkWidget* comboCharge = NULL; + gint nlistCharge = 1; + gchar* listCharge[] = {"0"}; + + add_label_table(table,_("Charge"),(gushort)i,0); + add_label_table(table,":",(gushort)i,1); + entryCharge = addComboListToATable(table, listCharge, nlistCharge, i, 2, 1); + comboCharge = g_object_get_data(G_OBJECT (entryCharge), "Combo"); + gtk_widget_set_sensitive(entryCharge, FALSE); + + return comboCharge; +} +/***********************************************************************************************/ +static GtkWidget *addNWChemSpinToTable(GtkWidget *table, gint i) +{ + GtkWidget* entrySpinMultiplicity = NULL; + GtkWidget* comboSpinMultiplicity = NULL; + gint nlistspinMultiplicity = 1; + gchar* listspinMultiplicity[] = {"0"}; + + add_label_table(table,_("Spin multiplicity"),(gushort)i,0); + add_label_table(table,":",(gushort)i,1); + entrySpinMultiplicity = addComboListToATable(table, listspinMultiplicity, nlistspinMultiplicity, i, 2, 1); + comboSpinMultiplicity = g_object_get_data(G_OBJECT (entrySpinMultiplicity), "Combo"); + gtk_widget_set_sensitive(entrySpinMultiplicity, FALSE); + + g_signal_connect(G_OBJECT(entrySpinMultiplicity),"changed", G_CALLBACK(changedEntrySpinMultiplicity),NULL); + return comboSpinMultiplicity; +} +/***********************************************************************************************/ +static GtkWidget *addLabelNumberOfElectronsToTable(GtkWidget *table, gint i, GtkWidget *comboCharge) +{ + GtkWidget* labelNumberOfElectrons = NULL; + GtkWidget* hbox = NULL; + GtkWidget* entryCharge = GTK_BIN(comboCharge)->child; + + labelNumberOfElectrons = gtk_label_new(" "); + hbox = gtk_hbox_new(0,FALSE); + gtk_box_pack_start (GTK_BOX (hbox), labelNumberOfElectrons, FALSE, FALSE, 0); + gtk_table_attach(GTK_TABLE(table),hbox,0,0+3,i,i+1, + (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), + (GtkAttachOptions) (GTK_FILL | GTK_SHRINK), + 2,2); + + g_object_set_data(G_OBJECT (entryCharge), "LabelNumberOfElectrons", labelNumberOfElectrons); + g_signal_connect(G_OBJECT(entryCharge),"changed", G_CALLBACK(changedEntryCharge),NULL); + return labelNumberOfElectrons; +} +/***********************************************************************************************/ +void createNWChemChargeMultiplicityFrame(GtkWidget *box) +{ + GtkWidget* frame; + GtkWidget* sep; + GtkWidget* labelNumberOfElectrons; + GtkWidget* vboxFrame; + GtkWidget* comboSpinMultiplicity = NULL; + GtkWidget* comboCharge = NULL; + GtkWidget *table = NULL; + gint i; + + totalCharge = TotalCharges[0]; + spinMultiplicity=SpinMultiplicities[0]; + + table = gtk_table_new(3,5,FALSE); + + frame = gtk_frame_new (_("Charge & Multiplicty")); + gtk_widget_show (frame); + gtk_box_pack_start (GTK_BOX (box), frame, TRUE, TRUE, 3); + gtk_frame_set_label_align (GTK_FRAME (frame), 0.5, 0.5); + + vboxFrame = gtk_vbox_new (FALSE, 3); + gtk_widget_show (vboxFrame); + gtk_container_add (GTK_CONTAINER (frame), vboxFrame); + + gtk_box_pack_start (GTK_BOX (vboxFrame), table, TRUE, TRUE, 0); + + i = 0; + comboCharge = addNWChemChargeToTable(table, i); + i = 1; + comboSpinMultiplicity = addNWChemSpinToTable(table, i); + i = 2; + sep = gtk_hseparator_new ();; + gtk_table_attach(GTK_TABLE(table),sep,0,0+3,i,i+1, + (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), + (GtkAttachOptions) (GTK_FILL | GTK_EXPAND), + 2,2); + + i = 3; + labelNumberOfElectrons=addLabelNumberOfElectronsToTable(table, i, comboCharge); + + if(GTK_IS_COMBO_BOX(comboCharge)) + g_object_set_data(G_OBJECT (GTK_BIN(comboCharge)->child), "ComboSpinMultiplicity", comboSpinMultiplicity); + setComboCharge(comboCharge); + setComboSpinMultiplicity(comboSpinMultiplicity); + if(GTK_IS_WIDGET(labelNumberOfElectrons)) + { + gint ne = nwchemMolecule.numberOfValenceElectrons - totalCharge; + gchar buffer[BSIZE]; + sprintf(buffer, "Number of electrons = %d",ne); + gtk_label_set_text(GTK_LABEL(labelNumberOfElectrons),buffer); + } + + /* activate sensitivity */ + /* + if(GTK_IS_WIDGET(comboMethod)) setComboMethod(comboMethod); + g_object_set_data(G_OBJECT (box), "EntryMethod", GTK_BIN(comboMethod)->child); + */ +} +/************************************************************************************************************/ diff -Nru gabedit-2.3.7/src/NWChem/NWChemMolecule.h gabedit-2.4.0/src/NWChem/NWChemMolecule.h --- gabedit-2.3.7/src/NWChem/NWChemMolecule.h 1970-01-01 00:00:00.000000000 +0000 +++ gabedit-2.4.0/src/NWChem/NWChemMolecule.h 2011-09-22 14:25:07.000000000 +0000 @@ -0,0 +1,14 @@ + +#ifndef __GABEDIT_NWCHEMMOLECULE_H__ +#define __GABEDIT_NWCHEMMOLECULE_H__ + +gint getNWChemMultiplicity(); +void initNWChemMoleculeButtons(); +void initNWChemMolecule(); +void freeNWChemMolecule(); +void putNWChemMoleculeInfoInTextEditor(); +gboolean setNWChemMolecule(); +void createNWChemChargeMultiplicityFrame(GtkWidget *box); + +#endif /* __GABEDIT_NWCHEMMOLECULE_H__ */ + diff -Nru gabedit-2.3.7/src/NWChem/NWChemTypes.h gabedit-2.4.0/src/NWChem/NWChemTypes.h --- gabedit-2.3.7/src/NWChem/NWChemTypes.h 1970-01-01 00:00:00.000000000 +0000 +++ gabedit-2.4.0/src/NWChem/NWChemTypes.h 2011-09-22 14:25:07.000000000 +0000 @@ -0,0 +1,80 @@ + +#ifndef __GABEDIT_NWCHEMTYPES_H__ +#define __GABEDIT_NWCHEMTYPES_H__ + +typedef struct _NWChemColorBack +{ + GdkColor keyWord; + GdkColor description; +}NWChemColorBack; + +typedef struct _NWChemColorFore +{ + GdkColor keyWord; + GdkColor description; +}NWChemColorFore; + +typedef struct _NWChemAtom +{ + gdouble position[3]; + gchar* symbol; +}NWChemAtom; + +typedef struct _NWChemMolecule +{ + gint numberOfAtoms; + gint totalNumberOfElectrons; + gint numberOfValenceElectrons; + NWChemAtom* listOfAtoms; + gchar* auxBasisName; +}NWChemMolecule; + +typedef struct _NWChemBasis +{ + gchar* name; + gchar* molecule; + int numberOfBasisTypes; + gchar** basisNames; +}NWChemBasis; + +typedef struct _NWChemGuessWaveFunction +{ + gboolean fromHCore; + gchar* method; + gchar* functional; + gchar* molecule; + gchar* basis; + gchar* memory; + gint totalCharge; + gint spinMultiplicity; +}NWChemGuessWaveFunction; + +typedef enum +{ + LSDAC = 0, PBEC, PW91C, P86C, NewP86C, VWN1LC, VWN1LCRPA, VWN2LC, VWN3LC, VWN4LC, VWN5LC, PW92LC, PZ81LC, LYPC, + HFX, Xalpha, SlaterX, Becke88X, PBEX, PW86X, PW91X, mPW91_B88X, mPW91_PW91X,mPW91_mPW91X, G96X +} NWChemFunctionalType; + +typedef enum +{ + XALPHA = 0, HFS, HFB, HFG96, G96LYP, BLYP, SVWN1, SVWN1RPA, SVWN2, SVWN3, + SVWN4, SVWN5, SPZ81, SPW92, BPW91, BP86, B3LYP, B3PW91, B3P86, PBE, PW91, + mPW_PW91_PW91, mPWPW91, mPW1PW91 +} NWChemStdFunctionalType; + +typedef struct _NWChemFunctional +{ + NWChemFunctionalType type; + gchar* name; + gchar* comment; +}NWChemFunctional; +typedef struct _NWChemStdFunctional +{ + NWChemStdFunctionalType type; + gchar* name; + gint n; + NWChemFunctionalType* listOfTypes; + gdouble* coefficients; +}NWChemStdFunctional; + +#endif /* __GABEDIT_NWCHEMTYPES_H__ */ diff -Nru gabedit-2.3.7/src/NWChem/xChange gabedit-2.4.0/src/NWChem/xChange --- gabedit-2.3.7/src/NWChem/xChange 1970-01-01 00:00:00.000000000 +0000 +++ gabedit-2.4.0/src/NWChem/xChange 2011-09-22 14:25:07.000000000 +0000 @@ -0,0 +1,2 @@ +sed -i \ + -e 's/ORCA/NWCHEM/g' `find -name "*.c" -o -name "*.h"` diff -Nru gabedit-2.3.7/src/Orca/OrcaKeywords.c gabedit-2.4.0/src/Orca/OrcaKeywords.c --- gabedit-2.3.7/src/Orca/OrcaKeywords.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Orca/OrcaKeywords.c 2011-09-22 14:25:07.000000000 +0000 @@ -67,7 +67,7 @@ /*************************************************************************************************************/ static gchar* listTypeMethodsView[] = { - "Hatree-Fock", + "Hartree-Fock", "Local and gradient corrected functionals", "Hybrid functionals", "Meta-GGA and hybrid meta-GGA's", diff -Nru gabedit-2.3.7/src/Spectrum/IRSpectrum.c gabedit-2.4.0/src/Spectrum/IRSpectrum.c --- gabedit-2.3.7/src/Spectrum/IRSpectrum.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Spectrum/IRSpectrum.c 2011-09-22 14:25:07.000000000 +0000 @@ -828,6 +828,81 @@ gtk_window_set_modal (GTK_WINDOW (filesel), TRUE); } /********************************************************************************/ +static gboolean read_nwchem_file(GabeditFileChooser *SelecFile, gint response_id) +{ + gchar *FileName; + gchar t[BSIZE]; + gchar sdum1[BSIZE]; + gboolean OK; + FILE *fd; + guint taille=BSIZE; + gint numberOfFrequencies = 0; + gdouble *frequencies = NULL; + gdouble *intensities = NULL; + + if(response_id != GTK_RESPONSE_OK) return FALSE; + FileName = gabedit_file_chooser_get_current_file(SelecFile); + + fd = FOpen(FileName, "r"); + if(!fd) return FALSE; + + do + { + OK=FALSE; + while(!feof(fd) ) + { + if(!fgets(t,taille,fd)) break; + if(strstr(t,"Projected Infra Red Intensities")) + { + numberOfFrequencies = 0; + if(frequencies) g_free(frequencies); + if(intensities) g_free(intensities); + frequencies = NULL; + intensities = NULL; + if(!fgets(t,taille,fd)) break; + if(!fgets(t,taille,fd)) break; + while(!feof(fd) ) + { + if(!fgets(t,taille,fd)) break; + if(strstr(t,"---------"))break; + numberOfFrequencies++; + frequencies = g_realloc(frequencies, numberOfFrequencies*sizeof(gdouble)); + intensities = g_realloc(intensities, numberOfFrequencies*sizeof(gdouble)); + sscanf(t,"%s %lf %s %s %s %lf", sdum1,&frequencies[numberOfFrequencies-1],sdum1,sdum1,sdum1, &intensities[numberOfFrequencies-1]); + } + OK = TRUE; + } + } + if(!OK) break; + }while(!feof(fd)); + + if(numberOfFrequencies>0) + { + createIRSpectrumWin(numberOfFrequencies, frequencies, intensities); + } + else + { + messageErrorFreq(FileName); + } + + + if(frequencies) g_free(frequencies); + if(intensities) g_free(intensities); + fclose(fd); + + return TRUE; +} +/********************************************************************************/ +static void read_nwchem_file_dlg() +{ + GtkWidget* filesel = + file_chooser_open(read_nwchem_file, + _("Read last frequencies and intensities from a NWChem output file"), + GABEDIT_TYPEFILE_NWCHEM,GABEDIT_TYPEWIN_OTHER); + + gtk_window_set_modal (GTK_WINDOW (filesel), TRUE); +} +/********************************************************************************/ static gboolean read_adf_file(GabeditFileChooser *SelecFile, gint response_id) { gchar t[BSIZE]; @@ -1053,7 +1128,7 @@ GtkWidget* filesel = file_chooser_open(read_orca_file, _("Read last frequencies and intensities from a Orca output file"), - GABEDIT_TYPEFILE_QCHEM,GABEDIT_TYPEWIN_OTHER); + GABEDIT_TYPEFILE_ORCA,GABEDIT_TYPEWIN_OTHER); gtk_window_set_modal (GTK_WINDOW (filesel), TRUE); } @@ -1128,6 +1203,7 @@ if(typeOfFile==GABEDIT_TYPEFILE_ORCA) read_orca_file_dlg(); if(typeOfFile==GABEDIT_TYPEFILE_FIREFLY) read_gamess_file_dlg(); if(typeOfFile==GABEDIT_TYPEFILE_GAUSSIAN) read_gaussian_file_dlg(); + if(typeOfFile==GABEDIT_TYPEFILE_NWCHEM) read_nwchem_file_dlg(); if(typeOfFile==GABEDIT_TYPEFILE_QCHEM) read_qchem_file_dlg(); if(typeOfFile==GABEDIT_TYPEFILE_ADF) read_adf_file_dlg(); if(typeOfFile==GABEDIT_TYPEFILE_MPQC) read_mpqc_file_dlg(); diff -Nru gabedit-2.3.7/src/Spectrum/UVSpectrum.c gabedit-2.4.0/src/Spectrum/UVSpectrum.c --- gabedit-2.3.7/src/Spectrum/UVSpectrum.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Spectrum/UVSpectrum.c 2011-09-22 14:25:07.000000000 +0000 @@ -866,6 +866,205 @@ gtk_window_set_modal (GTK_WINDOW (filesel), TRUE); } /********************************************************************************/ +static gboolean read_nwchem_tddft_file(GabeditFileChooser *SelecFile, gint response_id) +{ + + gchar *FileName; + gchar t[BSIZE]; + gboolean OK; + FILE *fd; + guint taille=BSIZE; + gint n; + gdouble ener = 0; + gdouble intensity = 0; + gint numberOfStates = 0; + gdouble *energies = NULL; + gdouble *intensities = NULL; + + if(response_id != GTK_RESPONSE_OK) return FALSE; + FileName = gabedit_file_chooser_get_current_file(SelecFile); + + fd = FOpen(FileName, "r"); + if(!fd) return FALSE; + + do + { + OK=FALSE; + while(!feof(fd)) + { + fgets(t,taille,fd); + if (strstr( t,"NWChem TDDFT Module") ) {OK = TRUE; break;} + } + if(!OK) break; + numberOfStates = 0; + if(energies) g_free(energies); + if(intensities) g_free(intensities); + energies = NULL; + intensities = NULL; + while(!feof(fd) ) + { + if(!fgets(t,taille,fd)) break; + if (!(strstr( t,"Root") && strstr( t,"eV") && strstr( t,"(") && strstr( t,")")) ) continue; + n = sscanf( strstr( t,"(")+1,"%lf",&ener); + if(n==1) + { + while(!feof(fd) ) + { + if(!fgets(t,taille,fd)) break; + if(strstr(t,"Dipole Oscillator Strength")) + { + intensity=0.0; + if(strstr(t,"Spin forbidden") || 1==sscanf( strstr(t,"Dipole Oscillator Strength")+strlen("Dipole Oscillator Strength"),"%lf",&intensity)) + { + numberOfStates++; + energies = g_realloc(energies, numberOfStates*sizeof(gdouble)); + intensities = g_realloc(intensities, numberOfStates*sizeof(gdouble)); + energies[numberOfStates-1] = ener; + intensities[numberOfStates-1] = intensity; + } + break; + + } + } + } + } + }while(!feof(fd)); + + if(numberOfStates>0) + { + OK = TRUE; + createUVSpectrumWin(numberOfStates, energies, intensities); + } + else + { + OK = FALSE; + } + + + if(energies) g_free(energies); + if(intensities) g_free(intensities); + fclose(fd); + + return OK; +} +/********************************************************************************/ +static gboolean read_nwchem_eom_file(GabeditFileChooser *SelecFile, gint response_id) +{ + + gchar *FileName; + gchar t[BSIZE]; + gboolean OK; + FILE *fd; + guint taille=BSIZE; + gint n; + gdouble ener = 0; + gdouble intensity = 0; + gint numberOfStates = 0; + gdouble *energies = NULL; + gdouble *intensities = NULL; + + if(response_id != GTK_RESPONSE_OK) return FALSE; + FileName = gabedit_file_chooser_get_current_file(SelecFile); + + fd = FOpen(FileName, "r"); + if(!fd) return FALSE; + + do + { + OK=FALSE; + while(!feof(fd)) + { + fgets(t,taille,fd); + if (strstr( t,"Dim. of EOMCC iter. space") ) {OK = TRUE; break;} + } + if(!OK) break; + numberOfStates = 0; + if(energies) g_free(energies); + if(intensities) g_free(intensities); + energies = NULL; + intensities = NULL; + while(!feof(fd) ) + { + if(!fgets(t,taille,fd)) break; + if (!(strstr( t,"/ eV ="))) continue; + n = sscanf( strstr( t,"=")+1,"%lf",&ener); + if(n==1) + { + while(!feof(fd) ) + { + if(!fgets(t,taille,fd)) break; + if(strstr(t,"Oscillator Strength ")) + { + intensity=0.0; + if(strstr(t,"Spin forbidden") || 1==sscanf( strstr(t,"Oscillator Strength ")+strlen("Oscillator Strength "),"%lf",&intensity)) + { + numberOfStates++; + energies = g_realloc(energies, numberOfStates*sizeof(gdouble)); + intensities = g_realloc(intensities, numberOfStates*sizeof(gdouble)); + energies[numberOfStates-1] = ener; + intensities[numberOfStates-1] = intensity; + } + break; + + } + } + } + } + }while(!feof(fd)); + + if(numberOfStates>0) + { + OK = TRUE; + createUVSpectrumWin(numberOfStates, energies, intensities); + } + else + { + OK = FALSE; + } + + + if(energies) g_free(energies); + if(intensities) g_free(intensities); + fclose(fd); + + return OK; +} +/********************************************************************************/ +static gboolean read_nwchem_file(GabeditFileChooser *SelecFile, gint response_id) +{ + + if(response_id != GTK_RESPONSE_OK) return FALSE; + if(!read_nwchem_tddft_file(SelecFile, response_id)&& !read_nwchem_eom_file(SelecFile, response_id)) + { + gchar* FileName = gabedit_file_chooser_get_current_file(SelecFile); + FILE* fd = FOpen(FileName, "r"); + if(!fd) + { + gchar buffer[BSIZE]; + sprintf(buffer,_("Sorry, I cannot open '%s' file\n"),FileName); + Message(buffer,_("Error"),TRUE); + } + else + { + messageErrorFreq(FileName); + fclose(fd); + } + return FALSE; + } + + return TRUE; +} +/********************************************************************************/ +static void read_nwchem_file_dlg() +{ + GtkWidget* filesel = + file_chooser_open(read_nwchem_file, + _("Read energies and intensities from a NWChem output file"), + GABEDIT_TYPEFILE_ORCA,GABEDIT_TYPEWIN_OTHER); + + gtk_window_set_modal (GTK_WINDOW (filesel), TRUE); +} +/********************************************************************************/ static gboolean read_adf_file(GabeditFileChooser *SelecFile, gint response_id) { return FALSE; @@ -954,6 +1153,7 @@ if(typeOfFile==GABEDIT_TYPEFILE_ORCA) read_orca_file_dlg(); if(typeOfFile==GABEDIT_TYPEFILE_FIREFLY) read_firefly_file_dlg(); if(typeOfFile==GABEDIT_TYPEFILE_QCHEM) read_qchem_file_dlg(); + if(typeOfFile==GABEDIT_TYPEFILE_NWCHEM) read_nwchem_file_dlg(); if(typeOfFile==GABEDIT_TYPEFILE_TXT) read_sample_2columns_file_dlg(); } /********************************************************************************/ diff -Nru gabedit-2.3.7/src/Utils/AtomsProp.c gabedit-2.4.0/src/Utils/AtomsProp.c --- gabedit-2.3.7/src/Utils/AtomsProp.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Utils/AtomsProp.c 2011-09-22 14:25:07.000000000 +0000 @@ -371,7 +371,7 @@ setPropForOneAtom("Aluminium", "Al", 13, 1.350000, 1.180000, 2.050000, 6, 26.981539, 1.610000, 0.750000, 0.650000, 0.650000); setPropForOneAtom("Silicon", "Si", 14, 1.200000, 0.937000, 2.100000, 6, 28.085501, 1.900000, 0.500000, 0.600000, 0.600000); setPropForOneAtom("Phosphorus", "P", 15, 1.100000, 0.890000, 2.080000, 5, 30.973761, 2.190000, 1.000000, 0.500000, 0.000000); - setPropForOneAtom("Sulphur", "S", 16, 1.020000, 1.040000, 2.000000, 6, 32.064999, 2.580000, 1.000000, 1.000000, 0.190000); + setPropForOneAtom("Sulphur", "S", 16, 1.020000, 1.040000, 2.000000, 4, 32.064999, 2.580000, 1.000000, 1.000000, 0.190000); setPropForOneAtom("Chlorine", "Cl", 17, 0.990000, 0.997000, 1.970000, 1, 35.452999, 3.160000, 0.120000, 0.940000, 0.120000); setPropForOneAtom("Argon", "Ar", 18, 1.570000, 1.740000, 1.880000, 0, 39.948002, 0.000000, 0.500000, 0.820000, 0.890000); setPropForOneAtom("Potassium", "K", 19, 1.330000, 2.030000, 2.750000, 1, 39.098301, 0.820000, 0.560000, 0.250000, 0.830000); diff -Nru gabedit-2.3.7/src/Utils/Dep.mk gabedit-2.4.0/src/Utils/Dep.mk --- gabedit-2.3.7/src/Utils/Dep.mk 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Utils/Dep.mk 2011-09-22 15:59:35.000000000 +0000 @@ -31,8 +31,8 @@ ../Common/../Common/GabeditType.h ../Utils/Constants.h \ ../Gaussian/GaussGlobal.h ../Files/FileChooser.h ../Gamess/Gamess.h \ ../FireFly/FireFly.h ../Molcas/Molcas.h ../Molpro/Molpro.h \ - ../MPQC/MPQC.h ../Orca/Orca.h ../QChem/QChem.h ../Mopac/Mopac.h \ - ../Gaussian/Gaussian.h ../Geometry/GeomGlobal.h \ + ../MPQC/MPQC.h ../Orca/Orca.h ../NWChem/NWChem.h ../QChem/QChem.h \ + ../Mopac/Mopac.h ../Gaussian/Gaussian.h ../Geometry/GeomGlobal.h \ ../Utils/UtilsInterface.h ../Geometry/InterfaceGeom.h ../Utils/Utils.h \ ../Utils/GabeditTextEdit.h ../Geometry/ResultsAnalise.h \ ../Geometry/EnergiesCurves.h ../Common/Windows.h ../Files/ListeFiles.h \ diff -Nru gabedit-2.3.7/src/Utils/Utils.c gabedit-2.4.0/src/Utils/Utils.c --- gabedit-2.3.7/src/Utils/Utils.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Utils/Utils.c 2011-09-22 14:25:07.000000000 +0000 @@ -72,6 +72,7 @@ void initPrincipalAxisGL(); +#define BBSIZE 10240 /********************************************************************************/ #ifndef G_OS_WIN32 #define TIMER_TICK 60 @@ -184,6 +185,11 @@ free_commands_list(&mpqcCommands); } /********************************************************************************/ +void free_nwchem_commands() +{ + free_commands_list(&nwchemCommands); +} +/********************************************************************************/ void free_orca_commands() { free_commands_list(&orcaCommands); @@ -275,8 +281,8 @@ /********************************************************************************/ void filegets(gchar *temp,FILE* fd) { - gchar t[BSIZE]; - gint taille = BSIZE; + gchar t[BBSIZE]; + gint taille = BBSIZE; gint k = 0; gint i; @@ -498,14 +504,14 @@ gchar *dump = NULL; - t=g_malloc(BSIZE*sizeof(gchar)); + t=g_malloc(BBSIZE*sizeof(gchar)); fd = FOpen(namefile, "r"); if(fd) { while(!feof(fd)) { - if(!fgets(t,BSIZE, fd)) break; + if(!fgets(t,BBSIZE, fd)) break; dump = tsrt; if(!tsrt) { @@ -552,7 +558,7 @@ gchar *outfile= g_strdup_printf("%s%stmp%soutfile",gabedit_directory(), G_DIR_SEPARATOR_S, G_DIR_SEPARATOR_S); gchar *errfile= g_strdup_printf("%s%stmp%serrfile",gabedit_directory(), G_DIR_SEPARATOR_S, G_DIR_SEPARATOR_S); gchar *dump; - gint taille = BSIZE; + gint taille = BBSIZE; temp = g_strdup_printf("sh -c '%s >%s 2>%s'",command,outfile,errfile); system(temp); @@ -620,7 +626,7 @@ &pi ) /* Pointer to PROCESS_INFORMATION structure.*/ ) { - gchar buffer[BSIZE]; + gchar buffer[BBSIZE]; sprintf(buffer,_("CreateProcess failed (%d)"),(int)GetLastError()); Message(buffer, _("Error"), TRUE); return; @@ -740,6 +746,31 @@ return name; } /*************************************************************************************/ +gchar *get_filename_without_ext(const gchar* allname) +{ + gchar *filename= NULL; + gchar *temp= NULL; + gint len=0; + gint i; + gchar* name = NULL; + + if(!allname || strlen(allname)<1) return g_strdup("error"); + temp = g_strdup(allname); + filename= g_strdup(allname); + len=strlen(filename); + + for(i=len;i>0;i--) + if(temp[i]=='.') + { + temp[i] = '\0'; + break; + } + name = g_strdup_printf("%s",temp); + if(temp) g_free(temp); + if(filename) g_free(filename); + return name; +} +/*************************************************************************************/ gchar *get_suffix_name_file(const gchar* allname) { gchar *filename= g_path_get_basename(allname); @@ -1076,6 +1107,21 @@ } fprintf(fd,"End\n"); /*-----------------------------------------------------------------------------*/ + fprintf(fd,"Begin NWChem\n"); + str_delete_n(NameCommandNWChem); + delete_last_spaces(NameCommandNWChem); + delete_first_spaces(NameCommandNWChem); + fprintf(fd,"%s\n",NameCommandNWChem); + fprintf(fd,"%d\n",nwchemCommands.numberOfCommands); + for(i=0;i0) + { + free_nwchem_commands(); + nwchemCommands.numberOfCommands = atoi(t); + nwchemCommands.commands = g_malloc(nwchemCommands.numberOfCommands*sizeof(gchar*)); + for(i=0;i1) g_setenv("PATH",t,TRUE); + } +#endif + } + else + { + fclose(fd); + return; + } + if(!fgets(t,taille,fd)) /* End of NWChemDir */ + { + fclose(fd); + return; + } +/*-----------------------------------------------------------------------------*/ + if(fgets(t,taille,fd)) if(!strstr(t,"Begin OrcaDir")) { fclose(fd); @@ -2293,8 +2435,8 @@ delete_first_spaces(orcaDirectory); #ifdef G_OS_WIN32 { - gchar t[BSIZE]; - sprintf(t,"%s;%cPATH%c",orcaDirectory,'%','%'); + gchar t[BBSIZE]; + sprintf(t,"%s;%s",orcaDirectory,g_getenv("PATH")); if(strlen(t)>1) g_setenv("PATH",t,TRUE); } #endif @@ -2324,8 +2466,8 @@ delete_first_spaces(fireflyDirectory); #ifdef G_OS_WIN32 { - gchar t[BSIZE]; - sprintf(t,"%s;%cPATH%c",fireflyDirectory,'%','%'); + gchar t[BBSIZE]; + sprintf(t,"%s;%s",fireflyDirectory,g_getenv("PATH")); if(strlen(t)>1) g_setenv("PATH",t,TRUE); } #endif @@ -2355,8 +2497,8 @@ delete_first_spaces(mopacDirectory); #ifdef G_OS_WIN32 { - gchar t[BSIZE]; - sprintf(t,"%s;%cPATH%c",mopacDirectory,'%','%'); + gchar t[BBSIZE]; + sprintf(t,"%s;%s",mopacDirectory,g_getenv("PATH")); if(strlen(t)>1) g_setenv("PATH",t,TRUE); } #endif @@ -2386,8 +2528,8 @@ delete_first_spaces(gaussDirectory); #ifdef G_OS_WIN32 { - gchar t[BSIZE]; - sprintf(t,"%s;%cPATH%c",gaussDirectory,'%','%'); + gchar t[BBSIZE]; + sprintf(t,"%s;%s",gaussDirectory,g_getenv("PATH")); if(strlen(t)>1) g_setenv("PATH",t,TRUE); } #endif @@ -2417,8 +2559,8 @@ delete_first_spaces(povrayDirectory); #ifdef G_OS_WIN32 { - gchar t[BSIZE]; - sprintf(t,"%s;%cPATH%c",povrayDirectory,'%','%'); + gchar t[BBSIZE]; + sprintf(t,"%s;%s",povrayDirectory,g_getenv("PATH")); if(strlen(t)>1) g_setenv("PATH",t,TRUE); } #endif @@ -2447,8 +2589,8 @@ fd = FOpen(networkfile, "r"); if(fd !=NULL) { - guint taille = BSIZE; - gchar t[BSIZE]; + guint taille = BBSIZE; + gchar t[BBSIZE]; gint i; if(fgets(t,taille,fd)) { @@ -2474,7 +2616,7 @@ str_delete_n(pscpplinkDirectory); delete_last_spaces(pscpplinkDirectory); delete_first_spaces(pscpplinkDirectory); - sprintf(t,"%s;%cPATH%c",pscpplinkDirectory,'%','%'); + sprintf(t,"%s;%s",pscpplinkDirectory,g_getenv("PATH")); #ifdef G_OS_WIN32 g_setenv("PATH",t,TRUE); #endif @@ -2487,15 +2629,15 @@ { #ifdef G_OS_WIN32 { - gchar t[BSIZE]; - sprintf(t,"%s;%s;%s;%s;%s;%s;%cPATH%c", + gchar t[BBSIZE]; + sprintf(t,"%s;%s;%s;%s;%s;%s;%s", orcaDirectory, fireflyDirectory, mopacDirectory, gaussDirectory, pscpplinkDirectory, povrayDirectory, - '%','%'); + g_getenv("PATH")); if(strlen(t)>1) g_setenv("PATH",t,TRUE); } #endif @@ -2837,7 +2979,7 @@ void initialise_name_commands() { #ifdef G_OS_WIN32 - gchar t[BSIZE]; + gchar t[BBSIZE]; NameCommandGamess=g_strdup("submitGMS"); NameCommandGaussian=g_strdup("g03.exe"); NameCommandMolcas=g_strdup("molcas"); @@ -2846,6 +2988,7 @@ NameCommandFireFly=g_strdup("firefly"); NameCommandQChem=g_strdup("qc"); NameCommandOrca=g_strdup("orca"); + NameCommandNWChem=g_strdup("nwchem"); NameCommandMopac=g_strdup("MOPAC2009"); NameCommandPovray=g_strdup("start /w pvengine /nr /exit /render +A0.3 -UV"); #else @@ -2857,6 +3000,7 @@ NameCommandFireFly=g_strdup("firefly"); NameCommandQChem=g_strdup("qchem"); NameCommandOrca=g_strdup("orca"); + NameCommandNWChem=g_strdup("nwchem"); NameCommandMopac=g_strdup("/opt/mopac/MOPAC2009.exe"); NameCommandPovray=g_strdup("povray +A0.3 -UV"); #endif @@ -2866,16 +3010,18 @@ babelCommand = g_strdup_printf("%s%sobabel.exe",g_get_current_dir(),G_DIR_SEPARATOR_S); gamessDirectory= g_strdup_printf("C:%sWinGAMESS",G_DIR_SEPARATOR_S); orcaDirectory= g_strdup_printf("C:%sORCA_DevCenter%sorca%sx86_exe%srelease%sOrca",G_DIR_SEPARATOR_S,G_DIR_SEPARATOR_S,G_DIR_SEPARATOR_S,G_DIR_SEPARATOR_S,G_DIR_SEPARATOR_S); + nwchemDirectory= g_strdup_printf("C:%sNWChem",G_DIR_SEPARATOR_S); fireflyDirectory= g_strdup_printf("C:%sFIREFLY",G_DIR_SEPARATOR_S); mopacDirectory= g_strdup_printf("\"C:%sProgram Files%sMOPAC\"",G_DIR_SEPARATOR_S,G_DIR_SEPARATOR_S); povrayDirectory= g_strdup_printf("\"C:%sProgram Files%sPovRay%sbin\"",G_DIR_SEPARATOR_S,G_DIR_SEPARATOR_S,G_DIR_SEPARATOR_S); gaussDirectory= g_strdup_printf("\"C:%sG03W\"",G_DIR_SEPARATOR_S); - sprintf(t,"%s;%s;%s;%s;%s;%cPATH%c",orcaDirectory,fireflyDirectory,mopacDirectory,gaussDirectory,povrayDirectory,'%','%'); + sprintf(t,"%s;%s;%s;%s;%s;%s",orcaDirectory,fireflyDirectory,mopacDirectory,gaussDirectory,povrayDirectory,g_getenv("PATH")); g_setenv("PATH",t,TRUE); #else babelCommand=g_strdup("babel"); gamessDirectory= g_strdup_printf("%s%sGamess",g_get_home_dir(),G_DIR_SEPARATOR_S); orcaDirectory= g_strdup_printf("%s%sOrca",g_get_home_dir(),G_DIR_SEPARATOR_S); + nwchemDirectory= g_strdup_printf("%s%sNWChem",g_get_home_dir(),G_DIR_SEPARATOR_S); fireflyDirectory= g_strdup_printf("%s%sFireFly",g_get_home_dir(),G_DIR_SEPARATOR_S); mopacDirectory= g_strdup_printf("/opt/mopac"); povrayDirectory= g_strdup_printf("/usr/local/bin"); @@ -2971,7 +3117,7 @@ #ifdef G_OS_WIN32 { - gchar* t = g_strdup_printf("%s;%cPATH%c",pscpplinkDirectory,'%','%'); + gchar* t = g_strdup_printf("%s;%s",pscpplinkDirectory,g_getenv("PATH")); g_setenv("PATH",t,TRUE); g_free(t); } @@ -3046,7 +3192,18 @@ #ifdef G_OS_WIN32 orcaCommands.commands[2] = g_strdup("orca"); #endif + nwchemCommands.numberOfCommands = 2; +#ifdef G_OS_WIN32 + nwchemCommands.numberOfCommands = 3; +#endif + nwchemCommands.numberOfDefaultCommand = 0; + nwchemCommands.commands = g_malloc(nwchemCommands.numberOfCommands*sizeof(gchar*)); + nwchemCommands.commands[0] = g_strdup("nohup nwchem"); + nwchemCommands.commands[1] = g_strdup("submitNWChem 1:0:0"); +#ifdef G_OS_WIN32 + nwchemCommands.commands[2] = g_strdup("nwchem"); +#endif fireflyCommands.numberOfCommands = 2; #ifdef G_OS_WIN32 @@ -3368,7 +3525,7 @@ { gint n=0; gchar* t=str; - gchar p[BSIZE]; + gchar p[BBSIZE]; while(*t!='\n' && *t !='\0') { if(*t =='\t') *t =' '; @@ -3403,7 +3560,7 @@ gchar** strsplit= g_malloc(sizeof(gchar*)); gint n=0; gchar* t=str; - gchar p[BSIZE]; + gchar p[BBSIZE]; while(*t!='\n' && *t !='\0') { if(*t!=' ') @@ -3436,8 +3593,8 @@ /********************************************************************************/ void get_dipole_from_gamess_output_file(FILE* fd) { - guint taille=BSIZE; - gchar *t = g_malloc(BSIZE*sizeof(gchar)); + guint taille=BBSIZE; + gchar *t = g_malloc(BBSIZE*sizeof(gchar)); gchar* t1; Dipole.def = FALSE; @@ -3476,8 +3633,8 @@ /********************************************************************************/ void get_dipole_from_turbomole_output_file(FILE* fd) { - guint taille=BSIZE; - gchar *t = g_malloc(BSIZE*sizeof(gchar)); + guint taille=BBSIZE; + gchar *t = g_malloc(BBSIZE*sizeof(gchar)); gchar dum[100]; @@ -3513,8 +3670,8 @@ /********************************************************************************/ void get_dipole_from_gaussian_output_file(FILE* fd) { - guint taille=BSIZE; - gchar *t = g_malloc(BSIZE*sizeof(gchar)); + guint taille=BBSIZE; + gchar *t = g_malloc(BBSIZE*sizeof(gchar)); gchar* pdest; gint ngrad = 0; gint i; @@ -3567,8 +3724,8 @@ /********************************************************************************/ void get_dipole_from_molpro_output_file(FILE* fd) { - guint taille=BSIZE; - gchar *t = g_malloc(BSIZE*sizeof(gchar)); + guint taille=BBSIZE; + gchar *t = g_malloc(BBSIZE*sizeof(gchar)); gchar* t1; gchar* t2; @@ -3607,8 +3764,8 @@ /********************************************************************************/ void get_dipole_from_dalton_output_file(FILE* fd) { - guint taille=BSIZE; - gchar *t = g_malloc(BSIZE*sizeof(gchar)); + guint taille=BBSIZE; + gchar *t = g_malloc(BBSIZE*sizeof(gchar)); gchar* t1; gchar* t2; gchar dum[100]; @@ -3651,8 +3808,8 @@ /********************************************************************************/ void get_dipole_from_orca_output_file(FILE* fd) { - guint taille=BSIZE; - gchar *t = g_malloc(BSIZE*sizeof(gchar)); + guint taille=BBSIZE; + gchar *t = g_malloc(BBSIZE*sizeof(gchar)); gchar* pdest; Dipole.def = FALSE; @@ -3675,10 +3832,46 @@ g_free(t); } /********************************************************************************/ +void get_dipole_from_nwchem_output_file(FILE* fd) +{ + guint taille=BBSIZE; + gchar *t = g_malloc(BBSIZE*sizeof(gchar)); + gchar* pdest; + + Dipole.def = FALSE; + + while(!feof(fd) ) + { + pdest = NULL; + Dipole.def = FALSE; + fgets(t,taille,fd); + pdest = strstr( t, "Nuclear Dipole moment"); + if(pdest) + { + gboolean OK = FALSE; + while(!feof(fd) ) + { + if(!fgets(t,taille,fd)) break; + if(strstr(t,"---------------- ---------------- ----------------")) + { + OK = TRUE; + break; + } + } + if(!OK) break; + if(!fgets(t,taille,fd)) break; + Dipole.def = TRUE; + sscanf(pdest,"%lf %lf %lf",&Dipole.Value[0],&Dipole.Value[1],&Dipole.Value[2]); + break; + } + } + g_free(t); +} +/********************************************************************************/ void get_dipole_from_qchem_output_file(FILE* fd) { - guint taille=BSIZE; - gchar *t = g_malloc(BSIZE*sizeof(gchar)); + guint taille=BBSIZE; + gchar *t = g_malloc(BBSIZE*sizeof(gchar)); gchar* pdest; gint ngrad = 0; gint i; @@ -3722,8 +3915,8 @@ /********************************************************************************/ void get_dipole_from_mopac_output_file(FILE* fd) { - guint taille=BSIZE; - gchar *t = g_malloc(BSIZE*sizeof(gchar)); + guint taille=BBSIZE; + gchar *t = g_malloc(BBSIZE*sizeof(gchar)); gchar* pdest; gint i; gchar dum[100]; @@ -3754,7 +3947,7 @@ /********************************************************************************/ void get_dipole_from_mopac_aux_file(FILE* fd) { - gchar t[BSIZE]; + gchar t[BBSIZE]; gchar* pdest; gint i; @@ -3764,7 +3957,7 @@ { pdest = NULL; Dipole.def = FALSE; - fgets(t,BSIZE,fd); + fgets(t,BBSIZE,fd); pdest = strstr( t, "DIPOLE:DEBYE="); if(pdest) @@ -4017,8 +4210,8 @@ /*************************************************************************************/ gboolean test_type_program_gaussian(FILE* file) { - gchar t[BSIZE]; - guint taille=BSIZE; + gchar t[BBSIZE]; + guint taille=BBSIZE; fseek(file, 0L, SEEK_SET); if(!fgets(t, taille, file)) return FALSE; if((int)t[0]==(int)'#' || (int)t[0]==(int)'%' ) return TRUE; @@ -4027,8 +4220,8 @@ /**********************************************************************************/ gboolean test_type_program_molcas(FILE* file) { - gchar t[BSIZE]; - guint taille=BSIZE; + gchar t[BBSIZE]; + guint taille=BBSIZE; fseek(file, 0L, SEEK_SET); while(!feof(file)) { @@ -4042,8 +4235,8 @@ /**********************************************************************************/ gboolean test_type_program_molpro(FILE* file) { - gchar t[BSIZE]; - guint taille=BSIZE; + gchar t[BBSIZE]; + guint taille=BBSIZE; fseek(file, 0L, SEEK_SET); while(!feof(file)) { @@ -4057,8 +4250,8 @@ /**********************************************************************************/ gboolean test_type_program_mpqc(FILE* file) { - gchar t[BSIZE]; - guint taille=BSIZE; + gchar t[BBSIZE]; + guint taille=BBSIZE; fseek(file, 0L, SEEK_SET); while(!feof(file)) { @@ -4074,8 +4267,8 @@ /**********************************************************************************/ gboolean test_type_program_gamess(FILE* file) { - gchar t[BSIZE]; - guint taille=BSIZE; + gchar t[BBSIZE]; + guint taille=BBSIZE; fseek(file, 0L, SEEK_SET); while(!feof(file)) { @@ -4092,8 +4285,8 @@ /**********************************************************************************/ gboolean test_type_program_firefly(FILE* file) { - gchar t[BSIZE]; - guint taille=BSIZE; + gchar t[BBSIZE]; + guint taille=BBSIZE; fseek(file, 0L, SEEK_SET); while(!feof(file)) { @@ -4103,10 +4296,26 @@ return FALSE; } /**********************************************************************************/ +gboolean test_type_program_nwchem(FILE* file) +{ + gchar t[BBSIZE]; + guint taille=BBSIZE; + fseek(file, 0L, SEEK_SET); + while(!feof(file)) + { + if(!fgets(t, taille, file)) return FALSE; + if(strstr(t,"NWChem input") && strstr(t,"#")) return TRUE; + g_strup(t); + if(strstr(t,"GEOMETRY")) return TRUE; + if(strstr(t,"ZMATRIX")) return TRUE; + } + return FALSE; +} +/**********************************************************************************/ gboolean test_type_program_orca(FILE* file) { - gchar t[BSIZE]; - guint taille=BSIZE; + gchar t[BBSIZE]; + guint taille=BBSIZE; fseek(file, 0L, SEEK_SET); while(!feof(file)) { @@ -4121,8 +4330,8 @@ /**********************************************************************************/ gboolean test_type_program_mopac(FILE* file) { - gchar t[BSIZE]; - guint taille=BSIZE; + gchar t[BBSIZE]; + guint taille=BBSIZE; fseek(file, 0L, SEEK_SET); while(!feof(file)) { @@ -4138,8 +4347,8 @@ /**********************************************************************************/ gboolean test_type_program_qchem(FILE* file) { - gchar t[BSIZE]; - guint taille=BSIZE; + gchar t[BBSIZE]; + guint taille=BBSIZE; fseek(file, 0L, SEEK_SET); while(!feof(file)) { @@ -4184,6 +4393,11 @@ fseek(file, 0L, SEEK_SET); return PROG_IS_MPQC; } + if(test_type_program_nwchem(file)) + { + fseek(file, 0L, SEEK_SET); + return PROG_IS_NWCHEM; + } if(test_type_program_gaussian(file)) { fseek(file, 0L, SEEK_SET); @@ -4272,12 +4486,12 @@ /**********************************************************************************************************************************/ gint get_num_orbitals_from_aux_mopac_file(FILE* file, gchar* blockName, gint* begin, gint* end) { - gchar t[BSIZE]; + gchar t[BBSIZE]; *begin = 0; *end = 0; while(!feof(file)) { - if(!fgets(t,BSIZE,file))break; + if(!fgets(t,BBSIZE,file))break; if(strstr( t, blockName)) { gchar* pdest = strstr( t, "=")+1; @@ -4292,10 +4506,10 @@ { gint nElements = 0; gchar** elements = NULL; - gchar t[BSIZE]; + gchar t[BBSIZE]; while(!feof(file)) { - if(!fgets(t,BSIZE,file))break; + if(!fgets(t,BBSIZE,file))break; if(strstr( t, blockName)) { gchar* pdest = strstr( t, "[")+1; @@ -4305,7 +4519,7 @@ else { long int geomposok = ftell(file); - if(!fgets(t,BSIZE,file))break; + if(!fgets(t,BBSIZE,file))break; if(!strstr(t,"# ")) fseek(file, geomposok, SEEK_SET); } @@ -4357,8 +4571,8 @@ /********************************************************************************/ gboolean zmat_mopac_irc_output_file(gchar *FileName) { - guint taille=BSIZE; - gchar t[BSIZE]; + guint taille=BBSIZE; + gchar t[BBSIZE]; FILE* fd = FOpen(FileName, "r"); if(!fd) return FALSE; @@ -4375,8 +4589,8 @@ /********************************************************************************/ gboolean zmat_mopac_scan_output_file(gchar *FileName) { - guint taille=BSIZE; - gchar t[BSIZE]; + guint taille=BBSIZE; + gchar t[BBSIZE]; FILE* fd = FOpen(FileName, "r"); if(!fd) return FALSE; @@ -4426,7 +4640,7 @@ GabEditTypeFile get_type_output_file(gchar* fileName) { gchar *t; - guint taille=BSIZE; + guint taille=BBSIZE; GabEditTypeFile ktype = GABEDIT_TYPEFILE_UNKNOWN; FILE* file = FOpen(fileName, "rb"); @@ -4462,6 +4676,11 @@ ktype = GABEDIT_TYPEFILE_QCHEM; break; } + if(strstr(t,"Northwest Computational Chemistry Package")) + { + ktype = GABEDIT_TYPEFILE_NWCHEM; + break; + } if(strstr(t,"TURBOMOLE GmbH")) { ktype = GABEDIT_TYPEFILE_TURBOMOLE; @@ -4672,10 +4891,10 @@ gint get_one_int_from_fchk_gaussian_file(FILE* file, gchar* blockName) { gint ipos = 47; - gchar t[BSIZE]; + gchar t[BBSIZE]; while(!feof(file)) { - if(!fgets(t,BSIZE,file))break; + if(!fgets(t,BBSIZE,file))break; if(strstr( t, blockName)) { if(strlen(t)>ipos+1) return atoi(t+ipos); @@ -4688,10 +4907,10 @@ gdouble get_one_real_from_fchk_gaussian_file(FILE* file, gchar* blockName) { gint ipos = 47; - gchar t[BSIZE]; + gchar t[BBSIZE]; while(!feof(file)) { - if(!fgets(t,BSIZE,file))break; + if(!fgets(t,BBSIZE,file))break; if(strstr( t, blockName)) { if(strlen(t)>ipos+1) return atof(t+ipos); @@ -4705,12 +4924,12 @@ { gint ipos = 43; gint i; - gchar t[BSIZE]; + gchar t[BBSIZE]; gint* elements = NULL; *nElements = 0; while(!feof(file)) { - if(!fgets(t,BSIZE,file))break; + if(!fgets(t,BBSIZE,file))break; if(strstr( t, blockName)) { if(!(strstr( t, blockName) && strstr(t,"N=") && strlen(strstr(t,"N="))>2)) return elements; @@ -4738,13 +4957,13 @@ { gint ipos = 43; gint i; - gchar t[BSIZE]; + gchar t[BBSIZE]; gdouble* elements = NULL; *nElements = 0; while(!feof(file)) { - if(!fgets(t,BSIZE,file))break; + if(!fgets(t,BBSIZE,file))break; if(strstr( t, blockName)) { if(!(strstr( t, blockName) && strstr(t,"N=") && strlen(strstr(t,"N="))>2)) return elements; @@ -4770,14 +4989,14 @@ { gint ipos = 43; gint i; - gchar t[BSIZE]; + gchar t[BBSIZE]; gchar** elements = NULL; gchar type = ' '; *nElements = 0; while(!feof(file)) { - if(!fgets(t,BSIZE,file))break; + if(!fgets(t,BBSIZE,file))break; if(strstr( t, blockName)) { if(!(strstr( t, blockName) && strstr(t,"N=") && strlen(strstr(t,"N="))>2)) return elements; diff -Nru gabedit-2.3.7/src/Utils/Utils.h gabedit-2.4.0/src/Utils/Utils.h --- gabedit-2.3.7/src/Utils/Utils.h 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Utils/Utils.h 2011-09-22 14:25:07.000000000 +0000 @@ -70,6 +70,7 @@ void run_local_command(gchar *outfile,gchar *errfile,gchar* command,gboolean under); const gchar *gabedit_directory(void); void DeleteLastChar(gchar *); +gchar *get_filename_without_ext(const gchar* allname); gchar *get_suffix_name_file(const gchar*); gchar *get_dir_file_name(G_CONST_RETURN gchar* dirname, G_CONST_RETURN gchar* filename); gchar *get_name_dir(const gchar* ); @@ -122,6 +123,7 @@ void get_dipole_from_molpro_output_file(FILE* fd); void get_dipole_from_dalton_output_file(FILE* fd); void get_dipole_from_orca_output_file(FILE* fd); +void get_dipole_from_nwchem_output_file(FILE* fd); void get_dipole_from_qchem_output_file(FILE* fd); void get_dipole_from_mopac_output_file(FILE* fd); void get_dipole_from_mopac_aux_file(FILE* fd); diff -Nru gabedit-2.3.7/src/Utils/UtilsInterface.c gabedit-2.4.0/src/Utils/UtilsInterface.c --- gabedit-2.3.7/src/Utils/UtilsInterface.c 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Utils/UtilsInterface.c 2011-09-22 14:25:07.000000000 +0000 @@ -33,6 +33,7 @@ #include "../Molpro/Molpro.h" #include "../MPQC/MPQC.h" #include "../Orca/Orca.h" +#include "../NWChem/NWChem.h" #include "../QChem/QChem.h" #include "../Mopac/Mopac.h" #include "../Gaussian/Gaussian.h" @@ -968,6 +969,39 @@ return j; } /**********************************************************************************/ +FilePosTypeGeom get_geometry_type_from_nwchem_input_file(gchar *NomFichier) +{ + gchar *t; + FILE *fd; + guint taille=BSIZE; + FilePosTypeGeom j; + + + j.geomtyp=GEOM_IS_OTHER; + j.numline=0; + j.units=1; + t=g_malloc(taille); + fd = FOpen(NomFichier, "r"); + if(fd==NULL) return j; + while(!feof(fd) ) + { + if(!fgets(t, taille, fd)) break; + g_strup(t); + if(strstr(t,"GEOMETRY")) + { + j.geomtyp = GEOM_IS_XYZ; + if(!fgets(t, taille, fd)) break; + g_strup(t); + if(strstr(t,"ZMATRIX")) j.geomtyp = GEOM_IS_ZMAT; + break; + } + j.numline++; + } + fclose(fd); + g_free(t); + return j; +} +/**********************************************************************************/ FilePosTypeGeom get_geometry_type_from_orca_input_file(gchar *NomFichier) { gchar *t; @@ -1191,6 +1225,19 @@ Message(_("Sorry\nI can not read gemetry in molpro input file\n"),_("Warning"),TRUE); } /**********************************************************************************/ +void read_geom_in_nwchem_input(gchar *NameFile) +{ + FilePosTypeGeom j; + j= get_geometry_type_from_nwchem_input_file(NameFile); + if( j.geomtyp == GEOM_IS_XYZ) + read_XYZ_from_nwchem_input_file(NameFile); + else + if( j.geomtyp == GEOM_IS_ZMAT) + read_Zmat_from_nwchem_input_file(NameFile); + else + Message(_("Sorry\nI can not read gemetry in NWChem input file\n"),_("Warning"),TRUE); +} +/**********************************************************************************/ void read_geom_in_orca_input(gchar *NameFile) { FilePosTypeGeom j; @@ -1201,7 +1248,7 @@ if( j.geomtyp == GEOM_IS_ZMAT) read_Zmat_from_orca_input_file(NameFile); else - Message(_("Sorry\nI can not read gemetry in Q-Chem input file\n"),_("Warning"),TRUE); + Message(_("Sorry\nI can not read gemetry in Orca input file\n"),_("Warning"),TRUE); } /**********************************************************************************/ void read_geom_in_qchem_input(gchar *NameFile) @@ -1359,6 +1406,13 @@ fileopen.logfile=g_strdup_printf("%s.out",fileopen.projectname); fileopen.moldenfile=g_strdup_printf("%s.out",fileopen.projectname); } + else if(iprogram == PROG_IS_NWCHEM) + { + fileopen.datafile = g_strdup_printf("%s.nw",fileopen.projectname); + fileopen.outputfile=g_strdup_printf("%s.out",fileopen.projectname); + fileopen.logfile=g_strdup_printf("%s.out",fileopen.projectname); + fileopen.moldenfile=g_strdup_printf("%s.out",fileopen.projectname); + } else if(iprogram == PROG_IS_QCHEM) { fileopen.datafile = g_strdup_printf("%s.inp",fileopen.projectname); @@ -1386,6 +1440,7 @@ else if( iprogram == PROG_IS_MOLPRO) read_geom_in_molpro_input(NomFichier); else if( iprogram == PROG_IS_MPQC) read_geom_in_mpqc_input(NomFichier); else if( iprogram == PROG_IS_ORCA) read_geom_in_orca_input(NomFichier); + else if( iprogram == PROG_IS_NWCHEM) read_geom_in_nwchem_input(NomFichier); else if( iprogram == PROG_IS_QCHEM) read_geom_in_qchem_input(NomFichier); else if( iprogram == PROG_IS_MOPAC) read_geom_in_mopac_input(NomFichier); else if(iprogram == PROG_IS_MOLCAS) @@ -1673,6 +1728,13 @@ fileopen.command=g_strdup(NameCommandOrca); } /********************************************************************************/ + void new_doc_nwchem(GtkWidget* wid, gpointer data) +{ + newNWChem(); + iprogram = PROG_IS_NWCHEM; + fileopen.command=g_strdup(NameCommandNWChem); +} +/********************************************************************************/ void new_doc_qchem(GtkWidget* wid, gpointer data) { newQChem(); @@ -1744,7 +1806,7 @@ static const gchar *comments = "Graphical User Interface to FireFly, GAMESS-US, Gaussian, Molcas, Molpro, " - "OpenMopac, Orca, MPQC and Q-Chem computational chemistry packages.\n\n" + "OpenMopac, Orca, MPQC, NWChem and Q-Chem computational chemistry packages.\n\n" "Please use the following citations in any report or publication :\n" "A.R. ALLOUCHE, Gabedit - A graphical user interface for computational chemistry softwares,\n" "Journal of Computational Chemistry, 32, 174-182(2011)\n"; @@ -2436,6 +2498,25 @@ } } /**********************************************************************************/ +void new_nwchem(GtkWidget *widget, gchar *data) +{ + gchar *t; + if(imodif == DATA_MOD_YES) + { + t = g_strdup_printf(_("\nThe \"%s\" file has been modified.\n\n"),get_name_file(fileopen.datafile)); + t = g_strdup_printf(_(" %sIf you continue, you lose what you have changed.\n\n"),t); + t = g_strdup_printf(_(" %sYou want to continue?\n"),t); + Continue_YesNo(new_doc_nwchem, NULL,t); + g_free(t); + } + else + { + new_doc_nwchem(NULL, NULL); + iprogram = PROG_IS_NWCHEM; + fileopen.command=g_strdup(NameCommandNWChem); + } +} +/**********************************************************************************/ void new_orca(GtkWidget *widget, gchar *data) { gchar *t; @@ -2551,6 +2632,50 @@ return hbox; } /********************************************************************************/ +GtkWidget* create_table_browser(GtkWidget *Wins,GtkWidget *vbox) +{ + GtkWidget *table = gtk_table_new(2,4,FALSE); + GtkWidget* buttonDirSelector = NULL; + GtkWidget* entryFileName = NULL; + GtkWidget* label = NULL; + gint i; + gint j; + + gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); +/*----------------------------------------------------------------------------------*/ + i = 0; + j = 0; + add_label_table(table,_("Folder"),(gushort)i,(gushort)j); + j = 1; + label = gtk_label_new(":"); + gtk_table_attach(GTK_TABLE(table),label, j,j+1,i,i+1, (GtkAttachOptions)(GTK_FILL|GTK_SHRINK) , (GtkAttachOptions)(GTK_FILL|GTK_SHRINK), 1,1); + + j = 2; + buttonDirSelector = gtk_file_chooser_button_new(_("Select your folder"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); + gtk_widget_set_size_request(GTK_WIDGET(buttonDirSelector),(gint)(ScreenHeight*0.2),-1); + gtk_table_attach(GTK_TABLE(table),buttonDirSelector, j,j+4,i,i+1, (GtkAttachOptions)(GTK_FILL|GTK_EXPAND), (GtkAttachOptions)(GTK_FILL|GTK_SHRINK), 1,1); + g_object_set_data(G_OBJECT(Wins), "ButtonDirSelector", buttonDirSelector); +/*----------------------------------------------------------------------------------*/ + i++; + j = 0; + add_label_table(table,_("File name"),(gushort)i,(gushort)j); + j = 1; + label = gtk_label_new(":"); + gtk_table_attach(GTK_TABLE(table),label, j,j+1,i,i+1, (GtkAttachOptions)(GTK_FILL|GTK_SHRINK) , (GtkAttachOptions)(GTK_FILL|GTK_SHRINK), 1,1); + j = 2; + entryFileName = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(entryFileName),"data.xyz"); + gtk_widget_set_size_request(GTK_WIDGET(entryFileName),(gint)(ScreenHeight*0.2),-1); + gtk_table_attach(GTK_TABLE(table),entryFileName, j,j+4,i,i+1, + (GtkAttachOptions)(GTK_FILL|GTK_EXPAND), + (GtkAttachOptions)(GTK_FILL|GTK_SHRINK), + 1,1); + g_object_set_data(G_OBJECT(Wins), "EntryFileName", entryFileName); +/*----------------------------------------------------------------------------------*/ + gtk_widget_show_all(table); + return table; +} +/********************************************************************************/ void set_default_styles() { /* diff -Nru gabedit-2.3.7/src/Utils/UtilsInterface.h gabedit-2.4.0/src/Utils/UtilsInterface.h --- gabedit-2.3.7/src/Utils/UtilsInterface.h 2011-05-09 08:38:32.000000000 +0000 +++ gabedit-2.4.0/src/Utils/UtilsInterface.h 2011-09-22 14:25:07.000000000 +0000 @@ -94,6 +94,7 @@ void read_geom_in_molcas_input(gchar *); void read_geom_in_molpro_input(gchar *); void read_geom_in_mpqc_input(gchar *); +void read_geom_in_nwchem_input(gchar *); void read_geom_in_orca_input(gchar *); void read_geom_in_qchem_input(gchar *); void read_geom_in_mopac_input(gchar *); @@ -106,11 +107,13 @@ void new_gamess(GtkWidget *widget, gchar *data); void new_firefly(GtkWidget *widget, gchar *data); void new_gauss(GtkWidget *widget, gchar *data); +void new_nwchem(GtkWidget *widget, gchar *data); void new_orca(GtkWidget *widget, gchar *data); void new_qchem(GtkWidget *widget, gchar *data); void new_other(GtkWidget *widget, gchar *data); GtkWidget *create_button_pixmap(GtkWidget *widget, gchar **data,gchar *string); GtkWidget *create_hbox_browser(GtkWidget* Wins,GtkWidget* vbox,gchar *tlabel,gchar *deffile,gchar** patterns); +GtkWidget* create_table_browser(GtkWidget *Wins,GtkWidget *vbox); void add_widget_table(GtkWidget *Table,GtkWidget *wid,gushort line,gushort colonne); GtkWidget *add_label_at_table(GtkWidget *Table,gchar *label,gushort line,gushort colonne,GtkJustification just); GtkWidget *add_label_table(GtkWidget *Table, G_CONST_RETURN gchar *label,gushort line,gushort colonne); diff -Nru gabedit-2.3.7/src/Utils/UtilsOld.c gabedit-2.4.0/src/Utils/UtilsOld.c --- gabedit-2.3.7/src/Utils/UtilsOld.c 1970-01-01 00:00:00.000000000 +0000 +++ gabedit-2.4.0/src/Utils/UtilsOld.c 2011-09-22 14:25:07.000000000 +0000 @@ -0,0 +1,5119 @@ +/* Utils.c */ +/********************************************************************************************************** +Copyright (c) 2002-2011 Abdul-Rahman Allouche. All rights reserved + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the Gabedit), to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions + of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. +************************************************************************************************************/ + + +#include "../../Config.h" +#include +#include +#include +#include +#include +#include + +#include "../Common/Global.h" +#include "../Utils/Constants.h" +#include "../Utils/Vector3d.h" +#include "../Geometry/GeomGlobal.h" +#include "../Utils/AtomsProp.h" +#include "../Utils/UtilsInterface.h" +#include "../Utils/Utils.h" +#include "../Utils/GabeditTextEdit.h" +#include "../Geometry/ResultsAnalise.h" +#include "../Geometry/EnergiesCurves.h" +#include "../Common/TextEdit.h" +#include "../Common/Preferences.h" +#include "../Common/Run.h" +#include "../Display/GLArea.h" +#include "../Geometry/Fragments.h" +#include "../Geometry/DrawGeom.h" +#include "../Geometry/AxesGeomGL.h" +#include "../Utils/HydrogenBond.h" +#ifdef G_OS_WIN32 +#include +#include +#include +#include +#include +#include +#include +#else /* G_OS_WIN32 */ +#include +#include +#include +#include +#endif /* G_OS_WIN32 */ + +#define DebugFlag 0 +#define Debug1Flag 0 + +void create_color_surfaces_file(); +void read_color_surfaces_file(); +void initAxis(); +void save_axis_properties(); +void read_axis_properties(); +void save_principal_axis_properties(); +void read_principal_axis_properties(); +void initPrincipalAxisGL(); + + +/********************************************************************************/ +#ifndef G_OS_WIN32 +#define TIMER_TICK 60 +static clock_t it; +static struct tms itt; +void timing(double* cpu,double *sys) +{ + it=times(&itt); + *cpu=(double) itt.tms_utime / (double) TIMER_TICK; + *sys=(double) itt.tms_stime / (double) TIMER_TICK; +} +#endif +#ifdef G_OS_WIN32 +void addUnitDisk(FILE* file, G_CONST_RETURN gchar* name) +{ + if(name && strlen(name)>1 && name[1]==':') + fprintf(file,"%c%c\n", name[0],name[1]); +} +#endif +#ifdef G_OS_WIN32 +/************************************************************************ +* error : display an error message and possibly the last Winsock error * +*************************************************************************/ +gboolean winsockCheck(FILE* FileErr) +{ + WORD wVersionRequested; + WSADATA wsaData; + int err; + wVersionRequested = MAKEWORD( 1, 1 ); + err = WSAStartup( wVersionRequested, &wsaData ); + if ( err != 0 ) + { + fprintf(FileErr,"Unsupported version of winsock.dll!\n"); + return FALSE; + } + + if ( LOBYTE( wsaData.wVersion ) != 1 || HIBYTE( wsaData.wVersion ) != 1 ) + { + fprintf(FileErr,"Unsupported version of winsock.dll!\n"); + return FALSE; + } + + return TRUE; +} +#endif /* G_OS_WIN32 */ +/********************************************************************************/ +FILE* FOpen(const gchar *fileutf8, const gchar* type) +{ + FILE* file; +#ifdef G_OS_WIN32 + /* gchar* filename = g_filename_to_utf8(fileutf8);*/ + gchar* filename = g_strdup(fileutf8); + file = fopen(filename,type); + if(file) set_last_directory(fileutf8); + return file; +#else + file = fopen(fileutf8,type); + if(file) set_last_directory(fileutf8); + return file; +#endif +} +/********************************************************************************/ +static void free_commands_list(CommandsList* list) +{ + gint i; + if(!list) + return; + + if(list->numberOfCommands<1) + { + list->numberOfCommands = 0; + list->numberOfDefaultCommand = 0; + list->commands = NULL; + return; + } + if(list->commands) + { + for(i=0;inumberOfCommands;i++) + if(list->commands[i]) + g_free(list->commands[i]); + g_free(list->commands); + } + list->numberOfCommands = 0; + list->numberOfDefaultCommand = 0; + list->commands = NULL; +} +/********************************************************************************/ +void free_gamess_commands() +{ + free_commands_list(&gaussianCommands); +} +/********************************************************************************/ +void free_gaussian_commands() +{ + free_commands_list(&gaussianCommands); +} +/********************************************************************************/ +void free_molcas_commands() +{ + free_commands_list(&molcasCommands); +} +/********************************************************************************/ +void free_molpro_commands() +{ + free_commands_list(&molproCommands); +} +/********************************************************************************/ +void free_mpqc_commands() +{ + free_commands_list(&mpqcCommands); +} +/********************************************************************************/ +void free_nwchem_commands() +{ + free_commands_list(&nwchemCommands); +} +/********************************************************************************/ +void free_orca_commands() +{ + free_commands_list(&orcaCommands); +} +/********************************************************************************/ +void free_firefly_commands() +{ + free_commands_list(&fireflyCommands); +} +/********************************************************************************/ +void free_qchem_commands() +{ + free_commands_list(&qchemCommands); +} +/********************************************************************************/ +void free_mopac_commands() +{ + free_commands_list(&mopacCommands); +} +/********************************************************************************/ +void free_povray_commands() +{ + free_commands_list(&povrayCommands); +} +/********************************************************************************/ +gchar* get_time_str() +{ + gchar* str=NULL; + time_t t; + struct tm* ts; + + t = time(NULL); + ts = localtime(&t); + str = asctime (ts); + return str; +} +/********************************************************************************/ +gdouble get_multipole_rank() +{ + return multipole_rank; +} +/********************************************************************************/ +gboolean this_is_a_backspace(gchar *st) +{ + gint i; + for(i=0;i<(gint)strlen(st);i++) + if(st[i] != ' ' && st[i] !='\n' && st[i] !='\r') + return FALSE; + return TRUE; +} +/********************************************************************************/ +void changeDInE(gchar *st) +{ + gint i; + gint l = 0; + if(!st) return; + l = strlen(st); + for(i=0;indirs == 0) + { + user->ndirs = 1; + user->dirs = g_malloc(sizeof(gchar*)); + user->dirs[0] = g_strdup(dir); + } + else + { + for(i=0;indirs;i++) + if(strcmp(dir,user->dirs[i]) == 0) + return FALSE; + + user->dirs = g_realloc(user->dirs,(user->ndirs+1)*sizeof(gchar*)); + for(i=user->ndirs;i>0;i--) + user->dirs[i] = user->dirs[i-1]; + user->dirs[0] = g_strdup(dir); + if(user->ndirs>=NHOSTMAX) + { +/* g_free(user->dirs[user->ndirs]);*/ + user->dirs = g_realloc(user->dirs,(user->ndirs)*sizeof(gchar*)); + } + else + (user->ndirs)++; + } + return TRUE; +} +/********************************************************************************/ +gboolean add_user_to_host(Host* host,const gchar *username, const gchar* password, const gchar *dir) +{ + gint i; + if(host->nusers == 0) + { + host->nusers = 1; + host->users = g_malloc(sizeof(User)); + host->users[0].username = g_strdup(username); + if(password) + host->users[0].password = g_strdup(password); + else + host->users[0].password = NULL; + host->users[0].ndirs = 0; + add_dir_to_user(&host->users[0] ,dir); + } + else + { + for(i=0;inusers;i++) + if(strcmp(username,host->users[i].username) == 0) + { + return add_dir_to_user(&host->users[i],dir); + } + + host->users = g_realloc(host->users,(host->nusers+1)*sizeof(User)); + for(i=host->nusers;i>0;i--) + host->users[i] = host->users[i-1]; + + host->users[0].ndirs = 0; + host->users[0].username = g_strdup(username); + if(password) + host->users[0].password = g_strdup(password); + else + host->users[0].password = NULL; + add_dir_to_user(&host->users[0] ,dir); + if(host->nusers>=NHOSTMAX) + { + for(i=0;iusers[host->nusers].ndirs;i++) + { + g_free(host->users[host->nusers].dirs[i]); + } + g_free(host->users[host->nusers].dirs); +/* g_free(host->users[host->nusers]);*/ + host->users = g_realloc(host->users,(host->nusers)*sizeof(User)); + } + else + (host->nusers)++; + } + return TRUE; +} +/********************************************************************************/ +void add_host(const gchar *hostname, const gchar* username, const gchar* password, const gchar* dir) +{ + gint i; + gint j; + + if(recenthosts.nhosts == 0) + { + recenthosts.hosts = g_malloc(sizeof(Host)); + recenthosts.hosts[0].hostname = g_strdup(hostname); + recenthosts.hosts[0].nusers = 0; + add_user_to_host(&recenthosts.hosts[0],username,password,dir); + recenthosts.nhosts = 1; + } + else + { + for(i=0;i0;i--) + recenthosts.hosts[i] = recenthosts.hosts[i-1]; + recenthosts.hosts[0].hostname = g_strdup(hostname); + recenthosts.hosts[0].nusers = 0; + add_user_to_host(&recenthosts.hosts[0],username,password,dir); + if(recenthosts.nhosts>=NHOSTMAX) + { + for(i=0;ipw_uid != getuid())) ) + { + if ( (pw = getpwuid(getuid()))) + localuser = g_strdup(pw->pw_name); + else + localuser = NULL; + } + return localuser; +#endif +} +/*************************************************************************************/ +void Waiting(gdouble tsecond) +{ + GTimer *timer; + gdouble elaps; + gulong m ; + + timer =g_timer_new( ); + g_timer_start( timer ); + g_timer_reset( timer ); + do{ + elaps = g_timer_elapsed( timer,&m); + }while(elaps%s 2>%s'",command,outfile,errfile); + system(temp); + + t=g_malloc(taille); + + fd = FOpen(errfile, "r"); + if(fd) + { + while(!feof(fd)) + { + if(!fgets(t,taille, fd)) + break; + dump = terr; + if(!terr) + terr = g_strdup_printf("%s",t); + else + { + terr = g_strdup_printf("%s%s",terr,t); + g_free(dump); + } + } + fclose(fd); + unlink (errfile); + } + else + terr = NULL; + + fd = FOpen(outfile, "r"); + if(fd) + { + unlink (outfile); + } + + g_free(t); + g_free(temp); + g_free(outfile); + g_free(errfile); + + return terr; +} +/********************************************************************************/ +#ifdef G_OS_WIN32 + +void createProcessWin32(char* myChildProcess) +{ + STARTUPINFO si; + PROCESS_INFORMATION pi; + + ZeroMemory( &si, sizeof(si) ); + si.cb = sizeof(si); + ZeroMemory( &pi, sizeof(pi) ); + + printf(_("Command = %s\n"),myChildProcess); + /* Start the child process. */ + if( !CreateProcess( NULL, /* No module name (use command line). */ + TEXT(myChildProcess), /* Command line. */ + NULL, /* Process handle not inheritable. */ + NULL, /* Thread handle not inheritable. */ + FALSE, /* Set handle inheritance to FALSE. */ + 0, /* No creation flags. */ + NULL, /* Use parent's environment block. */ + NULL, /* Use parent's starting directory. */ + &si, /* Pointer to STARTUPINFO structure.*/ + &pi ) /* Pointer to PROCESS_INFORMATION structure.*/ + ) + { + gchar buffer[BSIZE]; + sprintf(buffer,_("CreateProcess failed (%d)"),(int)GetLastError()); + Message(buffer, _("Error"), TRUE); + return; + } + + /* Wait until child process exits.*/ + /* WaitForSingleObject( pi.hProcess, INFINITE );*/ + + /* Close process and thread handles. */ + CloseHandle( pi.hProcess ); + CloseHandle( pi.hThread ); +} + +#endif +/********************************************************************************/ +void run_local_command(gchar *outfile,gchar *errfile,gchar* command,gboolean under) +{ + gchar *temp; + gint ierr = 0; + + unlink (outfile); + unlink (errfile); + + if(under) + { +#ifdef G_OS_WIN32 + temp = g_strdup_printf("%s >%s 2>%s ",command, outfile, errfile); + createProcessWin32(temp); + +#else + if(strstr(command,">")) + temp = g_strdup_printf("sh -c '%s 2>%s&'",command, errfile); + else + temp = g_strdup_printf("sh -c '%s >%s 2>%s&'",command, outfile, errfile); + ierr = system(temp); +#endif + + Waiting(0.5); + } + else + { +#ifdef G_OS_WIN32 + temp = g_strdup_printf("%s >%s 2>%s",command,outfile,errfile); +#else + temp = g_strdup_printf("sh -c '%s >%s 2>%s'",command,outfile,errfile); +#endif + ierr = system(temp); + } + + g_free(temp); +} +/*************************************************************************************/ +const gchar *gabedit_directory(void) +{ + static gchar *gabedit_dir = NULL; + gchar *home_dir; + gchar *home_dir_sep; +#ifdef G_OS_WIN32 + gchar* Version_S = g_strdup_printf("%d%d%d",MAJOR_VERSION,MINOR_VERSION,MICRO_VERSION); +#else + gchar* Version_S = g_strdup_printf("%d.%d.%d",MAJOR_VERSION,MINOR_VERSION,MICRO_VERSION); +#endif + + if (gabedit_dir != NULL) + return gabedit_dir; + + home_dir = g_strdup(g_get_home_dir()); + + if (home_dir != NULL && home_dir[strlen(home_dir)-1] != G_DIR_SEPARATOR) + home_dir_sep = G_DIR_SEPARATOR_S; + else + home_dir_sep = ""; + + if (!home_dir) + { +#ifdef G_OS_WIN32 + home_dir = g_strdup("C:"); +#else /* G_OS_WIN32 */ + home_dir = g_strdup("/tmp"); +#endif /* G_OS_WIN32 */ + home_dir_sep = G_DIR_SEPARATOR_S; + } +#ifdef G_OS_WIN32 + gabedit_dir = g_strconcat(home_dir,home_dir_sep,"gabedit",Version_S,NULL); +#else + gabedit_dir = g_strconcat(home_dir,home_dir_sep,".gabedit-",Version_S,NULL); +#endif + + g_free(Version_S); + return gabedit_dir; +} +/*************************************************************************************/ +void DeleteLastChar(gchar *str) +{ + str[strlen(str)-1]='\0'; +} +/*************************************************************************************/ +gchar *get_dir_file_name(G_CONST_RETURN gchar* dirname, G_CONST_RETURN gchar* filename) +{ + gchar *name = NULL; + + name = g_strdup_printf("%s%s%s",dirname,G_DIR_SEPARATOR_S,filename); + + return name; +} +/*************************************************************************************/ +gchar *get_name_dir(const gchar* allname) +{ + gchar *name; + name = g_path_get_dirname(allname); + if(strcmp(name,".")==0) + { + g_free(name); + name = g_strdup(g_get_current_dir()); + } + + return name; +} +/*************************************************************************************/ +gchar *get_filename_without_ext(const gchar* allname) +{ + gchar *filename= NULL; + gchar *temp= NULL; + gint len=0; + gint i; + gchar* name = NULL; + + if(!allname || strlen(allname)<1) return g_strdup("error"); + temp = g_strdup(allname); + filename= g_strdup(allname); + len=strlen(filename); + + for(i=len;i>0;i--) + if(temp[i]=='.') + { + temp[i] = '\0'; + break; + } + name = g_strdup_printf("%s",temp); + if(temp) g_free(temp); + if(filename) g_free(filename); + return name; +} +/*************************************************************************************/ +gchar *get_suffix_name_file(const gchar* allname) +{ + gchar *filename= g_path_get_basename(allname); + gchar *dirname= g_path_get_dirname(allname); + gchar *temp= g_strdup(filename); + gint len=strlen(filename); + gint i; + gchar* name = NULL; + + if(!allname || strlen(allname)<1) return g_strdup("error"); + filename= g_path_get_basename(allname); + dirname= g_path_get_dirname(allname); + temp= g_strdup(filename); + len=strlen(filename); + + for(i=len;i>0;i--) + if(temp[i]=='.') + { + temp[i] = '\0'; + break; + } + name = g_strdup_printf("%s%s%s",dirname,G_DIR_SEPARATOR_S,temp); + if(temp) g_free(temp); + if(dirname) g_free(dirname); + if(filename) g_free(filename); + + if(strcmp(name,".")==0) name = g_strdup(g_get_current_dir()); + + return name; +} +/*************************************************************************************/ +gchar *get_name_file(const gchar* allname) +{ + gchar *name= g_path_get_basename(allname); + /* + gchar *name=g_strdup(allname); + gint i; + gint len=strlen(allname); + gint islash=0; + + for(i=len;i>0;i--) + if(allname[i]==G_DIR_SEPARATOR) + { + islash=i+1; + break; + } + if(islash>0) + { + if(name) + g_free(name); + name=g_malloc(len-islash+2); + for(i=islash;i<=len;i++) + name[i-islash]=allname[i]; + name[len-islash+1]='\0'; + } + */ + + return name; +} +/*************************************************************************************/ +Point get_produit_vectoriel(Point V1,Point V2) +{ + Point PV; + + PV.C[0]= V1.C[1]*V2.C[2]-V1.C[2]*V2.C[1]; + PV.C[1]= V1.C[2]*V2.C[0]-V1.C[0]*V2.C[2]; + PV.C[2]= V1.C[0]*V2.C[1]-V1.C[1]*V2.C[0]; + + return PV; +} +/*************************************************************************************/ +gchar *get_distance_points(Point P1,Point P2,gboolean f3) +{ + gchar *distance; + gdouble Distance; + guint i; + + Distance = 0.0; + for(i=0;i<3;i++) + Distance += (P1.C[i]- P2.C[i])*(P1.C[i]- P2.C[i]); + + Distance = sqrt(Distance)*BOHR_TO_ANG; + if(f3) + distance = g_strdup_printf("%7.3lf",Distance); + else + distance = g_strdup_printf("%0.20lf",Distance); + return distance; +} +/*************************************************************************************/ +gdouble get_module(Point V) +{ + gdouble Module; + guint i; + + Module = 0.0; + for(i=0;i<3;i++) + Module += V.C[i]*V.C[i]; + + return sqrt(Module); + +} +/*************************************************************************************/ +gdouble get_scalaire(Point V1,Point V2) +{ + gdouble Scalaire; + guint i; + + Scalaire = 0.0; + for(i=0;i<3;i++) + Scalaire += V1.C[i]*V2.C[i]; + + return Scalaire; + +} +/*************************************************************************************/ +gchar *get_angle_vectors(Point V1,Point V2) +{ + gchar *angle; + gdouble Angle; + gdouble modv1v2 = get_module(V1)*get_module(V2); + + + if(fabs(modv1v2)>1e-14 ) + { + Angle = get_scalaire(V1,V2)/modv1v2; +/* Debug("Pscal = %f\n",Angle);*/ + if(Angle<=-1) + return g_strdup("180.0"); + if(Angle>=1) + return g_strdup_printf("0.0"); + + Angle = acos(Angle)/DEG_TO_RAD; +/* Debug("Angle = %f\n",Angle);*/ + angle = g_strdup_printf("%0.20lf",Angle); + } + else + angle = g_strdup_printf("ERROR"); + + return angle; +} +/*************************************************************************************/ +void add_fonts_in_file(FILE *fd,FontsStyle fontsstyle) +{ + + if(fontsstyle.fontname[strlen(fontsstyle.fontname)-1] !='\n') + fprintf(fd,"%s\n",fontsstyle.fontname); + else + fprintf(fd,"%s",fontsstyle.fontname); + + fprintf(fd,"%d\n",fontsstyle.BaseColor.red); + fprintf(fd,"%d\n",fontsstyle.BaseColor.green); + fprintf(fd,"%d\n",fontsstyle.BaseColor.blue); + + fprintf(fd,"%d\n",fontsstyle.TextColor.red); + fprintf(fd,"%d\n",fontsstyle.TextColor.green); + fprintf(fd,"%d\n",fontsstyle.TextColor.blue); +} +/*************************************************************************************/ +void create_hosts_file() +{ + gchar *hostsfile; + FILE *fd; + gint i; + gint j; + gint k; + + hostsfile = g_strdup_printf("%s%shosts",gabedit_directory(),G_DIR_SEPARATOR_S); + + fd = FOpen(hostsfile, "w"); + if(fd) + { + fprintf(fd,"%d\n",recenthosts.nhosts); + for(i=0;i1) alpha_opacity = 1; + if(alpha_opacity<0) alpha_opacity = 0; +} +/*************************************************************************************/ +void create_opengl_file() +{ + gchar *openglfile; + FILE *fd; + + openglfile = g_strdup_printf("%s%sopengl",gabedit_directory(),G_DIR_SEPARATOR_S); + + fd = FOpen(openglfile, "w"); + if(fd !=NULL) + { + fprintf(fd,"%d\n",openGLOptions.rgba); + fprintf(fd,"%d\n",openGLOptions.doubleBuffer); + fprintf(fd,"%d\n",openGLOptions.alphaSize); + fprintf(fd,"%d\n",openGLOptions.depthSize); + fprintf(fd,"%d\n",openGLOptions.numberOfSubdivisionsCylindre); + fprintf(fd,"%d\n",openGLOptions.numberOfSubdivisionsSphere); + fprintf(fd,"%d\n",getOptCol()); + fprintf(fd,"%lf %lf\n",getScaleBall(),getScaleStick()); + fprintf(fd,"%d\n",colorMapType); + fprintf(fd,"%lf %lf %lf\n",colorMapColors[0][0], colorMapColors[0][1],colorMapColors[0][2]); + fprintf(fd,"%lf %lf %lf\n",colorMapColors[1][0], colorMapColors[1][1],colorMapColors[1][2]); + fprintf(fd,"%lf %lf %lf\n",colorMapColors[2][0], colorMapColors[2][1],colorMapColors[2][2]); + fprintf(fd,"%d\n",getShowOneSurface()); + fprintf(fd,"%lf\n",get_alpha_opacity()); + fclose(fd); + } + g_free(openglfile); +} +/*************************************************************************************/ +void read_opengl_file() +{ + gchar *openglfile; + FILE *fd; + gint optcol = 0; + gboolean showOneSurface = TRUE; + + openglfile = g_strdup_printf("%s%sopengl",gabedit_directory(),G_DIR_SEPARATOR_S); + + fd = fopen(openglfile, "r"); + openGLOptions.rgba = 1; + openGLOptions.doubleBuffer = 1; + openGLOptions.alphaSize = 0; + openGLOptions.depthSize = 1; + openGLOptions.numberOfSubdivisionsCylindre = 20; + openGLOptions.numberOfSubdivisionsSphere = 30; + colorMapType =1; + colorMapColors[0][0] = 1; + colorMapColors[0][1] = 1; + colorMapColors[0][2] = 1; + colorMapColors[1][0] = 1; + colorMapColors[1][1] = 1; + colorMapColors[1][2] = 1; + colorMapColors[2][0] = 1; + colorMapColors[2][1] = 1; + colorMapColors[2][2] = 1; + if(fd !=NULL) + { + guint taille = BSIZE; + gchar t[BSIZE]; + if(fgets(t,taille,fd)) + if(sscanf(t,"%d",&openGLOptions.rgba)!=1) + openGLOptions.rgba = 1; + if(fgets(t,taille,fd)) + if(sscanf(t,"%d",&openGLOptions.doubleBuffer)!=1) + openGLOptions.doubleBuffer = 1; + if(fgets(t,taille,fd)) + if(sscanf(t,"%d",&openGLOptions.alphaSize)!=1) + openGLOptions.alphaSize = 1; + if(fgets(t,taille,fd)) + if(sscanf(t,"%d",&openGLOptions.depthSize)!=1) + openGLOptions.depthSize = 1; + if(fgets(t,taille,fd)) + if(sscanf(t,"%d",&openGLOptions.numberOfSubdivisionsCylindre)!=1) + openGLOptions.numberOfSubdivisionsCylindre = 10; + if(fgets(t,taille,fd)) + if(sscanf(t,"%d",&openGLOptions.numberOfSubdivisionsSphere)!=1) + openGLOptions.numberOfSubdivisionsSphere = 10; + if(fgets(t,taille,fd)) + if(sscanf(t,"%d",&optcol)!=1) optcol = 0; + setOptCol(optcol); + if(fgets(t,taille,fd)) + { + gdouble b,s; + if(sscanf(t,"%lf %lf",&b,&s)==2) + { + setScaleBall(b); + setScaleStick(b); + } + } + if(fgets(t,taille,fd)) + if(sscanf(t,"%d",&colorMapType)!=1) colorMapType =1; + if(fgets(t,taille,fd)) + { + if(sscanf(t,"%lf %lf %lf",&colorMapColors[0][0], &colorMapColors[0][1],&colorMapColors[0][2])!=3) + { + colorMapColors[0][0] = 1.0; + colorMapColors[0][1] = 1.0; + colorMapColors[0][2] = 1.0; + } + } + if(fgets(t,taille,fd)) + { + if(sscanf(t,"%lf %lf %lf",&colorMapColors[1][0], &colorMapColors[1][1],&colorMapColors[1][2])!=3) + { + colorMapColors[1][0] = 1.0; + colorMapColors[1][1] = 1.0; + colorMapColors[1][2] = 1.0; + } + } + if(fgets(t,taille,fd)) + { + if(sscanf(t,"%lf %lf %lf",&colorMapColors[2][0], &colorMapColors[2][1],&colorMapColors[2][2])!=3) + { + colorMapColors[2][0] = 1.0; + colorMapColors[2][1] = 1.0; + colorMapColors[2][2] = 1.0; + } + } + if(fgets(t,taille,fd)) + if(sscanf(t,"%d",&showOneSurface)!=1) showOneSurface = 0; + setShowOneSurface(showOneSurface); + if(fgets(t,taille,fd)) + { + gdouble alpha; + if(sscanf(t,"%lf",&alpha)==1) set_alpha_opacity(alpha); + } + + fclose(fd); + } + g_free(openglfile); +} +/*************************************************************************************/ +void create_ressource_file() +{ + save_atoms_prop(); + create_commands_file(); + create_network_file(); + create_fonts_file(); + create_color_surfaces_file(); + create_opengl_file(); + save_axis_properties(); +#ifdef DRAWGEOMGL + save_axes_geom_properties(); +#endif + save_principal_axis_properties(); + save_HBonds_properties(); + create_drawmolecule_file(); +} +/*************************************************************************************/ +void read_hosts_file() +{ + gchar *hostsfile; + FILE *fd; + gint i; + gint j; + gint k; + gchar t[BSIZE]; + gint len = BSIZE; + + hostsfile = g_strdup_printf("%s%shosts",gabedit_directory(),G_DIR_SEPARATOR_S); + + fd = FOpen(hostsfile, "r"); + if(fd) + { + fgets(t,len,fd);recenthosts.nhosts = atoi(t); + recenthosts.hosts = g_malloc(recenthosts.nhosts*sizeof(Host)); + for(i=0;ifontname= g_strdup(temp); + + fgets(t,taille,fd);fontsstyle->BaseColor.red =(gushort) atoi(t); + fgets(t,taille,fd);fontsstyle->BaseColor.green =(gushort) atoi(t); + fgets(t,taille,fd);fontsstyle->BaseColor.blue = (gushort) atoi(t); + + fgets(t,taille,fd);fontsstyle->TextColor.red = (gushort) atoi(t); + fgets(t,taille,fd);fontsstyle->TextColor.green = (gushort) atoi(t); + fgets(t,taille,fd);fontsstyle->TextColor.blue = (gushort) atoi(t); + g_free(t); + g_free(temp); +} +/*************************************************************************************/ +void read_fonts_file() +{ + gchar *fontsfile; + FILE *fd; + + fontsfile = g_strdup_printf("%s%sfonts",gabedit_directory(),G_DIR_SEPARATOR_S); + + fd = FOpen(fontsfile, "r"); + if(fd !=NULL) + { + read_fonts_in_file(fd,&FontsStyleData); + read_fonts_in_file(fd,&FontsStyleResult); + read_fonts_in_file(fd,&FontsStyleLabel); + read_fonts_in_file(fd,&FontsStyleOther); + fclose(fd); + + set_font (text,FontsStyleData.fontname); + set_base_style(text,FontsStyleData.BaseColor.red ,FontsStyleData.BaseColor.green ,FontsStyleData.BaseColor.blue); + set_text_style(text,FontsStyleData.TextColor.red ,FontsStyleData.TextColor.green ,FontsStyleData.TextColor.blue); + + set_font (textresult,FontsStyleResult.fontname); + set_base_style(textresult,FontsStyleResult.BaseColor.red ,FontsStyleResult.BaseColor.green ,FontsStyleResult.BaseColor.blue); + set_text_style(textresult,FontsStyleResult.TextColor.red ,FontsStyleResult.TextColor.green ,FontsStyleResult.TextColor.blue); + + set_font (TextOutput,FontsStyleResult.fontname); + set_base_style(TextOutput,FontsStyleResult.BaseColor.red ,FontsStyleResult.BaseColor.green ,FontsStyleResult.BaseColor.blue); + set_text_style(TextOutput,FontsStyleResult.TextColor.red ,FontsStyleResult.TextColor.green ,FontsStyleResult.TextColor.blue); + + set_font (TextError,FontsStyleResult.fontname); + set_base_style(TextError,FontsStyleResult.BaseColor.red ,FontsStyleResult.BaseColor.green ,FontsStyleResult.BaseColor.blue); + set_text_style(TextError,FontsStyleResult.TextColor.red ,FontsStyleResult.TextColor.green ,FontsStyleResult.TextColor.blue); + + } + set_font_other (FontsStyleOther.fontname); + +} +/********************************************************************************/ +void free_batch_commands() +{ + gint i; + for(i=0;i0) + { + batchCommands.numberOfTypes = atoi(t); + batchCommands.types = g_malloc(batchCommands.numberOfTypes*sizeof(gchar*)); + batchCommands.commandListAll = g_malloc(batchCommands.numberOfTypes*sizeof(gchar*)); + batchCommands.commandListUser = g_malloc(batchCommands.numberOfTypes*sizeof(gchar*)); + batchCommands.jobIdTitle = g_malloc(batchCommands.numberOfTypes*sizeof(gchar*)); + + for(i=0;i0) + { + free_gamess_commands(); + gamessCommands.numberOfCommands = atoi(t); + gamessCommands.commands = g_malloc(gamessCommands.numberOfCommands*sizeof(gchar*)); + for(i=0;i0) + { + free_gaussian_commands(); + gaussianCommands.numberOfCommands = atoi(t); + gaussianCommands.commands = g_malloc(gaussianCommands.numberOfCommands*sizeof(gchar*)); + for(i=0;i0) + { + free_molcas_commands(); + molcasCommands.numberOfCommands = atoi(t); + molcasCommands.commands = g_malloc(molcasCommands.numberOfCommands*sizeof(gchar*)); + for(i=0;i0) + { + free_molpro_commands(); + molproCommands.numberOfCommands = atoi(t); + molproCommands.commands = g_malloc(molproCommands.numberOfCommands*sizeof(gchar*)); + for(i=0;i0) + { + free_mpqc_commands(); + mpqcCommands.numberOfCommands = atoi(t); + mpqcCommands.commands = g_malloc(mpqcCommands.numberOfCommands*sizeof(gchar*)); + for(i=0;i0) + { + free_nwchem_commands(); + nwchemCommands.numberOfCommands = atoi(t); + nwchemCommands.commands = g_malloc(nwchemCommands.numberOfCommands*sizeof(gchar*)); + for(i=0;i0) + { + free_orca_commands(); + orcaCommands.numberOfCommands = atoi(t); + orcaCommands.commands = g_malloc(orcaCommands.numberOfCommands*sizeof(gchar*)); + for(i=0;i0) + { + free_firefly_commands(); + fireflyCommands.numberOfCommands = atoi(t); + fireflyCommands.commands = g_malloc(fireflyCommands.numberOfCommands*sizeof(gchar*)); + for(i=0;i0) + { + free_qchem_commands(); + qchemCommands.numberOfCommands = atoi(t); + qchemCommands.commands = g_malloc(qchemCommands.numberOfCommands*sizeof(gchar*)); + for(i=0;i0) + { + free_mopac_commands(); + mopacCommands.numberOfCommands = atoi(t); + mopacCommands.commands = g_malloc(mopacCommands.numberOfCommands*sizeof(gchar*)); + for(i=0;i0) + { + free_povray_commands(); + povrayCommands.numberOfCommands = atoi(t); + povrayCommands.commands = g_malloc(povrayCommands.numberOfCommands*sizeof(gchar*)); + for(i=0;i1) g_setenv("PATH",t,TRUE); + } +#endif + } + else + { + fclose(fd); + return; + } + if(!fgets(t,taille,fd)) /* End of NWChemDir */ + { + fclose(fd); + return; + } +/*-----------------------------------------------------------------------------*/ + if(fgets(t,taille,fd)) + if(!strstr(t,"Begin OrcaDir")) + { + fclose(fd); + return; + } + if(fgets(t,taille,fd)) + { + orcaDirectory= g_strdup(t); + str_delete_n(orcaDirectory); + delete_last_spaces(orcaDirectory); + delete_first_spaces(orcaDirectory); +#ifdef G_OS_WIN32 + { + gchar t[BSIZE]; + sprintf(t,"%s;%cPATH%c",orcaDirectory,'%','%'); + if(strlen(t)>1) g_setenv("PATH",t,TRUE); + } +#endif + } + else + { + fclose(fd); + return; + } + if(!fgets(t,taille,fd)) /* End of OrcaDir */ + { + fclose(fd); + return; + } +/*-----------------------------------------------------------------------------*/ + if(fgets(t,taille,fd)) + if(!strstr(t,"Begin FireFlyDir")) + { + fclose(fd); + return; + } + if(fgets(t,taille,fd)) + { + fireflyDirectory= g_strdup(t); + str_delete_n(fireflyDirectory); + delete_last_spaces(fireflyDirectory); + delete_first_spaces(fireflyDirectory); +#ifdef G_OS_WIN32 + { + gchar t[BSIZE]; + sprintf(t,"%s;%cPATH%c",fireflyDirectory,'%','%'); + if(strlen(t)>1) g_setenv("PATH",t,TRUE); + } +#endif + } + else + { + fclose(fd); + return; + } + if(!fgets(t,taille,fd)) /* End of FireFlyDir */ + { + fclose(fd); + return; + } +/*-----------------------------------------------------------------------------*/ + if(fgets(t,taille,fd)) + if(!strstr(t,"Begin MopacDir")) + { + fclose(fd); + return; + } + if(fgets(t,taille,fd)) + { + mopacDirectory= g_strdup(t); + str_delete_n(mopacDirectory); + delete_last_spaces(mopacDirectory); + delete_first_spaces(mopacDirectory); +#ifdef G_OS_WIN32 + { + gchar t[BSIZE]; + sprintf(t,"%s;%cPATH%c",mopacDirectory,'%','%'); + if(strlen(t)>1) g_setenv("PATH",t,TRUE); + } +#endif + } + else + { + fclose(fd); + return; + } + if(!fgets(t,taille,fd)) /* End of MopacDir */ + { + fclose(fd); + return; + } +/*-----------------------------------------------------------------------------*/ + if(fgets(t,taille,fd)) + if(!strstr(t,"Begin GaussDir")) + { + fclose(fd); + return; + } + if(fgets(t,taille,fd)) + { + gaussDirectory= g_strdup(t); + str_delete_n(gaussDirectory); + delete_last_spaces(gaussDirectory); + delete_first_spaces(gaussDirectory); +#ifdef G_OS_WIN32 + { + gchar t[BSIZE]; + sprintf(t,"%s;%cPATH%c",gaussDirectory,'%','%'); + if(strlen(t)>1) g_setenv("PATH",t,TRUE); + } +#endif + } + else + { + fclose(fd); + return; + } + if(!fgets(t,taille,fd)) /* End of GaussDir */ + { + fclose(fd); + return; + } +/*-----------------------------------------------------------------------------*/ + if(fgets(t,taille,fd)) + if(!strstr(t,"Begin PovRayDir")) + { + fclose(fd); + return; + } + if(fgets(t,taille,fd)) + { + povrayDirectory= g_strdup(t); + str_delete_n(povrayDirectory); + delete_last_spaces(povrayDirectory); + delete_first_spaces(povrayDirectory); +#ifdef G_OS_WIN32 + { + gchar t[BSIZE]; + sprintf(t,"%s;%cPATH%c",povrayDirectory,'%','%'); + if(strlen(t)>1) g_setenv("PATH",t,TRUE); + } +#endif + } + else + { + fclose(fd); + return; + } + if(!fgets(t,taille,fd)) /* End of PovRayDir */ + { + fclose(fd); + return; + } + fclose(fd); + } +} +/*************************************************************************************/ +void read_network_file() +{ + gchar *networkfile; + FILE *fd; + + networkfile = g_strdup_printf("%s%snetwork",gabedit_directory(),G_DIR_SEPARATOR_S); + + fd = FOpen(networkfile, "r"); + if(fd !=NULL) + { + guint taille = BSIZE; + gchar t[BSIZE]; + gint i; + if(fgets(t,taille,fd)) + { + if(sscanf(t,"%d",&i)!=1) + defaultNetWorkProtocol = GABEDIT_NETWORK_SSH; + else + { + if(i==0) + defaultNetWorkProtocol = GABEDIT_NETWORK_FTP_RSH; + else + defaultNetWorkProtocol = GABEDIT_NETWORK_SSH; + } + } + else + defaultNetWorkProtocol = GABEDIT_NETWORK_SSH; + + if(fgets(t,taille,fd)) + { + if(pscpplinkDirectory) + g_free(pscpplinkDirectory); + pscpplinkDirectory = g_strdup(t); + + str_delete_n(pscpplinkDirectory); + delete_last_spaces(pscpplinkDirectory); + delete_first_spaces(pscpplinkDirectory); + sprintf(t,"%s;%cPATH%c",pscpplinkDirectory,'%','%'); +#ifdef G_OS_WIN32 + g_setenv("PATH",t,TRUE); +#endif + } + fclose(fd); + } +} +/***********************************************************************/ +void set_path() +{ +#ifdef G_OS_WIN32 + { + gchar t[BSIZE]; + sprintf(t,"%s;%s;%s;%s;%s;%s;%cPATH%c", + orcaDirectory, + fireflyDirectory, + mopacDirectory, + gaussDirectory, + pscpplinkDirectory, + povrayDirectory, + '%','%'); + if(strlen(t)>1) g_setenv("PATH",t,TRUE); + } +#endif +} +/*************************************************************************************/ +void read_ressource_file() +{ + gboolean rOK = FALSE; + + define_default_atoms_prop(); + rOK = read_atoms_prop(); + if(!rOK) + define_default_atoms_prop(); + read_commands_file(); + read_network_file(); + read_fonts_file(); + read_hosts_file(); + read_color_surfaces_file(); + read_opengl_file(); + fileopen.netWorkProtocol= defaultNetWorkProtocol; + read_axis_properties(); +#ifdef DRAWGEOMGL + read_axes_geom_properties(); +#endif + read_principal_axis_properties(); + read_HBonds_properties(); + read_drawmolecule_file(); +} +/*************************************************************************************/ +gchar *ang_to_bohr(gchar *angstr) +{ + gchar *austr; + gdouble numb; + + austr = g_strdup(angstr); + numb = atof(angstr)*ANG_TO_BOHR; + austr = g_strdup_printf("%0.20lf",numb); + return austr; +} +/*************************************************************************************/ +gchar *bohr_to_ang(gchar *angstr) +{ + gchar *austr; + gdouble numb; + + austr = g_strdup(angstr); + numb = atof(angstr)*BOHR_TO_ANG; + austr = g_strdup_printf("%0.20lf",numb); + return austr; +} +/*************************************************************************************/ +static gboolean debug1flag() +{ + gchar localhost[100]; + if(!Debug1Flag) return FALSE; + +#ifdef G_OS_WIN32 + winsockCheck(stderr); +#endif + gethostname(localhost,100); + if(strlen(localhost)>=5) + { + g_strup(localhost); + gchar* d = strstr(localhost,"L"); + if(!d) return FALSE; + if(strlen(d)<5) return FALSE; + if(d[0]=='L' && d[1]=='A') + if(d[2]=='S' && d[3]=='I') + if(d[4]=='M') return TRUE; + } + return FALSE; +} +/*************************************************************************************/ +guint get_number_electrons(guint type) +{ +/* + type = 1 : Medium and High + type = 2 : High + type = other : All +*/ + guint i; + guint Ne=0; + SAtomsProp Atom; + if(MethodeGeom == GEOM_IS_XYZ) + { + for(i=0;i','?',',','~', + '`','\'','.','"',':',';'}; + guint All=36; + guint j; + guint i; + for(i=0;ifont_desc); + */ + style->font_desc = font_desc; + } +} +/*************************************************************************************/ +void set_font (GtkWidget *view, gchar *fontname) +{ + GtkStyle *style; + PangoFontDescription *font_desc; + + if(!GTK_IS_WIDGET(view)) return; + style = gtk_style_copy (gtk_widget_get_style (view)); + font_desc = pango_font_description_from_string (fontname); + + if (font_desc) + { + /* + pango_font_description_free (style->font_desc); + */ + style->font_desc = font_desc; + } + + gtk_widget_set_style (GTK_WIDGET(view), style); + + g_object_unref (style); +} +/*************************************************************************************/ +void set_tab_size (GtkWidget *view, gint tab_size) +{ + PangoTabArray* tabs = pango_tab_array_new(tab_size,FALSE); + gtk_text_view_set_tabs ((GtkTextView *)view, tabs); +} +/*************************************************************************************/ +GtkStyle *set_text_style(GtkWidget *text,gushort red,gushort green,gushort blue) +{ + GtkStyle *style; + style = gtk_style_copy(text->style); + style->text[0].red=red; + style->text[0].green=green; + style->text[0].blue=blue; + gtk_widget_set_style(text, style ); + return style; +} +/********************************************************************************/ +GtkStyle *set_base_style(GtkWidget *text,gushort red,gushort green,gushort blue) +{ + GtkStyle *style; + style = gtk_style_copy(text->style); + style->base[0].red=red; + style->base[0].green=green; + style->base[0].blue=blue; + gtk_widget_set_style(text, style ); + return style; +} +/********************************************************************************/ +GtkStyle *set_fg_style(GtkWidget *wid,gushort red,gushort green,gushort blue) +{ + GtkStyle *style; + style = gtk_style_copy(wid->style); + style->fg[0].red=red; + style->fg[0].green=green; + style->fg[0].blue=blue; + gtk_widget_set_style(wid, style ); + return style; +} +/********************************************************************************/ +GtkStyle *set_bg_style(GtkWidget *wid,gushort red,gushort green,gushort blue) +{ + GtkStyle *style; + style = gtk_style_copy(wid->style); + style->bg[0].red=red; + style->bg[0].green=green; + style->bg[0].blue=blue; + gtk_widget_set_style(wid, style ); + return style; +} +/********************************************************************************/ +gint numb_of_string_by_row(gchar *str) +{ + gint n=0; + gchar* t=str; + while(*t!='\n' && *t !='\0') + { + if(*t!=' ') + { + n++; + while(*t!=' ') + { + t++; + if(*t =='\n' || *t =='\0') + break; + } + + } + else + { + while(*t ==' ' ) + { + t++; + if(*t =='\n' || *t =='\0') + break; + } + } + } + return n; +} +/********************************************************************************/ +gint numb_of_reals_by_row(gchar *str) +{ + gint n=0; + gchar* t=str; + gchar p[BSIZE]; + while(*t!='\n' && *t !='\0') + { + if(*t =='\t') *t =' '; + if(*t =='\r') *t =' '; + if(*t!=' ') + { + sscanf(t,"%s",p); + if(test(p)) n++; + while(*t!=' ') + { + t++; + if(*t =='\n' || *t =='\0') + break; + } + + } + else + { + while(*t ==' ' ) + { + t++; + if(*t =='\n' || *t =='\0') + break; + } + } + } + return n; +} +/********************************************************************************/ +gchar** gab_split(gchar *str) +{ + gchar** strsplit= g_malloc(sizeof(gchar*)); + gint n=0; + gchar* t=str; + gchar p[BSIZE]; + while(*t!='\n' && *t !='\0') + { + if(*t!=' ') + { + n++; + strsplit= g_realloc(strsplit,(n+1)*sizeof(gchar*)); + sscanf(t,"%s",p); + strsplit[n-1]= g_strdup(p); + while(*t!=' ') + { + t++; + if(*t =='\n' || *t =='\0') + break; + } + + } + else + { + while(*t ==' ' ) + { + t++; + if(*t =='\n' || *t =='\0') + break; + } + } + } + strsplit[n]= NULL; + return strsplit; +} +/********************************************************************************/ +void get_dipole_from_gamess_output_file(FILE* fd) +{ + guint taille=BSIZE; + gchar *t = g_malloc(BSIZE*sizeof(gchar)); + gchar* t1; + + Dipole.def = FALSE; + + while(!feof(fd) ) + { + t1 = NULL; + if(!fgets(t,taille,fd))break; + t1 = strstr( t, "ELECTROSTATIC MOMENTS"); + if(t1) + { + while(!feof(fd) ) + { + if(!fgets(t,taille,fd))break; + t1 = strstr( t, "DEBYE"); + if(t1) + { + gint i; + if(!fgets(t,taille,fd))break; + sscanf(t,"%lf %lf %lf",&Dipole.Value[0],&Dipole.Value[1],&Dipole.Value[2]); + for(i=0;i<3;i++) Dipole.Value[i] /= AUTODEB; + Dipole.def = TRUE; + break; + } + } + break; + } + else + { + if(strstr( t, "END OF PROPERTY" )) break; + } + + } + g_free(t); +} +/********************************************************************************/ +void get_dipole_from_turbomole_output_file(FILE* fd) +{ + guint taille=BSIZE; + gchar *t = g_malloc(BSIZE*sizeof(gchar)); + gchar dum[100]; + + + Dipole.def = FALSE; + + while(!feof(fd) ) + { + if(!fgets(t,taille,fd))break; + if(strstr( t, "electrostatic moments")) + { + while(!feof(fd) ) + { + if(!fgets(t,taille,fd))break; + if(strstr( t, "dipole moment")) + { + gdouble d; + if(!fgets(t,taille,fd))break; + if(!fgets(t,taille,fd))break;/* x */ + sscanf(t,"%s %lf %lf %lf",dum, &d, &d, &Dipole.Value[0]); + if(!fgets(t,taille,fd))break;/* y */ + sscanf(t,"%s %lf %lf %lf",dum, &d, &d, &Dipole.Value[1]); + if(!fgets(t,taille,fd))break;/* z */ + sscanf(t,"%s %lf %lf %lf",dum, &d, &d, &Dipole.Value[2]); + Dipole.def = TRUE; + break; + } + } + break; + } + } + g_free(t); +} +/********************************************************************************/ +void get_dipole_from_gaussian_output_file(FILE* fd) +{ + guint taille=BSIZE; + gchar *t = g_malloc(BSIZE*sizeof(gchar)); + gchar* pdest; + gint ngrad = 0; + gint i; + + Dipole.def = FALSE; + + while(!feof(fd) ) + { + pdest = NULL; + Dipole.def = FALSE; + fgets(t,taille,fd); + pdest = strstr( t, "Dipole moment (Debye)"); + + if(strstr( t, "Dipole moment") && strstr( t, "Debye")) /* field-independent basis */ + { + if(!feof(fd)) + fgets(t,taille,fd); + else + break; + Dipole.def = TRUE; + pdest = strstr( t, "X=")+2; + sscanf(pdest,"%lf",&Dipole.Value[0]); + pdest = strstr( t, "Y=")+2; + sscanf(pdest,"%lf",&Dipole.Value[1]); + pdest = strstr( t, "Z=")+2; + sscanf(pdest,"%lf",&Dipole.Value[2]); + /* + Debug("t =%s\n",t); + Debug("Dipole = %f %f %f\n",Dipole.Value[0],Dipole.Value[1],Dipole.Value[2]); + */ + for(i=0;i<3;i++) + Dipole.Value[i] /= AUTODEB; + break; + } + else + { + pdest = strstr( t, "GradGradGrad" ); + if(pdest) + { + ngrad++; + /* Debug("ngrad = %d\n",ngrad);*/ + } + if(ngrad>2) + break; + } + + } + g_free(t); +} +/********************************************************************************/ +void get_dipole_from_molpro_output_file(FILE* fd) +{ + guint taille=BSIZE; + gchar *t = g_malloc(BSIZE*sizeof(gchar)); + gchar* t1; + gchar* t2; + + Dipole.def = FALSE; + + while(!feof(fd) ) + { + t1 = NULL; + fgets(t,taille,fd); + t1 = strstr( t, "DIPOLE MOMENTS:"); + + if(t1) + { + Dipole.def = TRUE; + t2 = strstr( t1, ":")+2; + sscanf(t2,"%lf %lf %lf",&Dipole.Value[0],&Dipole.Value[1],&Dipole.Value[2]); + /* + Debug("t =%s\n",t); + Debug("Dipole = %f %f %f\n",Dipole.Value[0],Dipole.Value[1],Dipole.Value[2]); + */ + break; + } + else + { + t1 = strstr( t, "GEOMETRY OPTIMIZATION STEP" ); + if(t1) + break; + t1 = strstr( t, "SEWARD" ); + if(t1) + break; + } + + } + g_free(t); +} +/********************************************************************************/ +void get_dipole_from_dalton_output_file(FILE* fd) +{ + guint taille=BSIZE; + gchar *t = g_malloc(BSIZE*sizeof(gchar)); + gchar* t1; + gchar* t2; + gchar dum[100]; + + Dipole.def = FALSE; + + while(!feof(fd) ) + { + t1 = NULL; + if(!fgets(t,taille,fd))break; + t1 = strstr( t, "Dipole moment components"); + if(t1) + { + if(!fgets(t,taille,fd))break; + if(!fgets(t,taille,fd))break; + if(!fgets(t,taille,fd))break; + if(!fgets(t,taille,fd))break; + t2 = strstr( t1, ":")+2; + if(!fgets(t,taille,fd))break; + sscanf(t,"%s %lf",dum, &Dipole.Value[0]); + if(!fgets(t,taille,fd))break; + sscanf(t,"%s %lf",dum, &Dipole.Value[1]); + if(!fgets(t,taille,fd))break; + sscanf(t,"%s %lf",dum, &Dipole.Value[2]); + Dipole.def = TRUE; + /* + Debug("t =%s\n",t); + Debug("Dipole = %f %f %f\n",Dipole.Value[0],Dipole.Value[1],Dipole.Value[2]); + */ + break; + } + else + { + if(strstr( t, ">>>>" )) break; + } + + } + g_free(t); +} +/********************************************************************************/ +void get_dipole_from_orca_output_file(FILE* fd) +{ + guint taille=BSIZE; + gchar *t = g_malloc(BSIZE*sizeof(gchar)); + gchar* pdest; + + Dipole.def = FALSE; + + while(!feof(fd) ) + { + pdest = NULL; + Dipole.def = FALSE; + fgets(t,taille,fd); + pdest = strstr( t, "Total Dipole Moment"); + + if(pdest && strstr( t,":")) + { + pdest = strstr( t,":")+1; + Dipole.def = TRUE; + sscanf(pdest,"%lf %lf %lf",&Dipole.Value[0],&Dipole.Value[1],&Dipole.Value[2]); + break; + } + } + g_free(t); +} +/********************************************************************************/ +void get_dipole_from_nwchem_output_file(FILE* fd) +{ + guint taille=BSIZE; + gchar *t = g_malloc(BSIZE*sizeof(gchar)); + gchar* pdest; + + Dipole.def = FALSE; + + while(!feof(fd) ) + { + pdest = NULL; + Dipole.def = FALSE; + fgets(t,taille,fd); + pdest = strstr( t, "Nuclear Dipole moment"); + if(pdest) + { + gboolean OK = FALSE; + while(!feof(fd) ) + { + if(!fgets(t,taille,fd)) break; + if(strstr(t,"---------------- ---------------- ----------------")) + { + OK = TRUE; + break; + } + } + if(!OK) break; + if(!fgets(t,taille,fd)) break; + Dipole.def = TRUE; + sscanf(pdest,"%lf %lf %lf",&Dipole.Value[0],&Dipole.Value[1],&Dipole.Value[2]); + break; + } + } + g_free(t); +} +/********************************************************************************/ +void get_dipole_from_qchem_output_file(FILE* fd) +{ + guint taille=BSIZE; + gchar *t = g_malloc(BSIZE*sizeof(gchar)); + gchar* pdest; + gint ngrad = 0; + gint i; + + Dipole.def = FALSE; + + while(!feof(fd) ) + { + pdest = NULL; + Dipole.def = FALSE; + fgets(t,taille,fd); + pdest = strstr( t, "Dipole Moment (Debye)"); + + if(pdest) + { + if(!feof(fd)) fgets(t,taille,fd); + else break; + Dipole.def = TRUE; + pdest = strstr( t, "X")+2; + if(pdest) sscanf(pdest,"%lf",&Dipole.Value[0]); + pdest = strstr( t, "Y")+2; + if(pdest) sscanf(pdest,"%lf",&Dipole.Value[1]); + pdest = strstr( t, "Z")+2; + if(pdest) sscanf(pdest,"%lf",&Dipole.Value[2]); + for(i=0;i<3;i++) Dipole.Value[i] /= AUTODEB; + break; + } + else + { + pdest = strstr( t, "GradGradGrad" ); + if(pdest) + { + ngrad++; + } + if(ngrad>2) break; + } + + } + g_free(t); +} +/********************************************************************************/ +void get_dipole_from_mopac_output_file(FILE* fd) +{ + guint taille=BSIZE; + gchar *t = g_malloc(BSIZE*sizeof(gchar)); + gchar* pdest; + gint i; + gchar dum[100]; + + Dipole.def = FALSE; + + while(!feof(fd) ) + { + pdest = NULL; + Dipole.def = FALSE; + fgets(t,taille,fd); + pdest = strstr( t, "DIPOLE X Y Z"); + + if(pdest) + { + if(!fgets(t,taille,fd)) break; + if(!fgets(t,taille,fd)) break; + if(!fgets(t,taille,fd)) break; + Dipole.def = TRUE; + pdest = strstr( t, "SUM")+2; + sscanf(t,"%s %lf %lf %lf",dum,&Dipole.Value[0],&Dipole.Value[1], &Dipole.Value[2]); + for(i=0;i<3;i++) Dipole.Value[i] /= AUTODEB; + break; + } + } + g_free(t); +} +/********************************************************************************/ +void get_dipole_from_mopac_aux_file(FILE* fd) +{ + gchar t[BSIZE]; + gchar* pdest; + gint i; + + Dipole.def = FALSE; + + while(!feof(fd) ) + { + pdest = NULL; + Dipole.def = FALSE; + fgets(t,BSIZE,fd); + pdest = strstr( t, "DIPOLE:DEBYE="); + + if(pdest) + { + Dipole.def = TRUE; + pdest = strstr( t, "=")+1; + Dipole.Value[0] = 0; + Dipole.Value[1] = 0; + Dipole.Value[2] = 0; + if(pdest) sscanf(pdest,"%lf %lf %lf",&Dipole.Value[0], &Dipole.Value[1],&Dipole.Value[2]); + for(i=0;i<3;i++) Dipole.Value[i] /= AUTODEB; + break; + } + } +} +/**********************************************/ +void set_dipole(GtkWidget* fp,gpointer data) +{ + GtkWidget** entrys = (GtkWidget**)data; + GdkColor* color = g_object_get_data(G_OBJECT (fp), "Color"); + G_CONST_RETURN gchar* tentry; + gint i; + gdouble fact=1.0; + + tentry = gtk_entry_get_text(GTK_ENTRY(entrys[0])); + fact = atof(tentry); + Dipole.def = TRUE; + for(i=1;i<4;i++) + { + tentry = gtk_entry_get_text(GTK_ENTRY(entrys[i])); + Dipole.Value[i-1] = atof(tentry)*fact; + } + for(i=0;i<3;i++) + Dipole.Value[i] /= AUTODEB; + + tentry = gtk_entry_get_text(GTK_ENTRY(entrys[4])); + Dipole.radius = atof(tentry)/AUTODEB; + if(Dipole.radius<1e-6) Dipole.radius = 0.1; + + Dipole.color[0] = color->red; + Dipole.color[1] = color->green; + Dipole.color[2] = color->blue; + rafresh_window_orb(); + + if(GeomDrawingArea != NULL) + draw_geometry(NULL,NULL); +} +/**********************************************/ +void delete_last_spaces(gchar* str) +{ + gchar *s; + + if(str == NULL) + return; + + if (!*str) + return; + for (s = str + strlen (str) - 1; s >= str && isspace ((guchar)*s); s--) + *s = '\0'; +} +/**********************************************/ +void delete_first_spaces(gchar* str) +{ + gchar *start; + gint i; + gint lenSpace = 0; + + if(str == NULL) + return; + if (!*str) + return; + + for (start = str; *start && isspace (*start); start++)lenSpace++; + + for(i=0;i<(gint)(strlen(str)-lenSpace);i++) + str[i] = str[i+lenSpace]; + str[strlen(str)-lenSpace] = '\0'; +} +/**********************************************/ +void delete_all_spaces(gchar* str) +{ + gint i; + gint j; + gboolean Ok = FALSE; + + delete_last_spaces(str); + delete_first_spaces(str); + while(!Ok) + { + Ok = TRUE; + for(i=0;i<(gint)strlen(str);i++) + { + if(isspace(str[i])) + { + Ok = FALSE; + for(j=i;j<(gint)strlen(str);j++) + { + str[j] = str[j+1]; + } + break; + } + } + } +} +/**********************************************/ +gchar* get_to_str(gchar* str,gchar* end) +{ + gchar* iend = NULL; + gchar* res = NULL; + gint len; + gint i; + + if(str == NULL || end == NULL) + return NULL; + + iend = strstr(str,end); + if(iend==NULL) + return g_strdup(str); + len = iend - str; + if(len<1) + return NULL; + + res = g_malloc((len+1)*sizeof(gchar)); + for(i=0;i= str && ((guchar)*s)=='\n'; s--) + *s = '\0'; +} +/**********************************************/ +gchar* get_font_label_name() +{ + return FontsStyleLabel.fontname; +} +/*************************************************************************************/ +gboolean test_type_program_gaussian(FILE* file) +{ + gchar t[BSIZE]; + guint taille=BSIZE; + fseek(file, 0L, SEEK_SET); + if(!fgets(t, taille, file)) return FALSE; + if((int)t[0]==(int)'#' || (int)t[0]==(int)'%' ) return TRUE; + return FALSE; +} +/**********************************************************************************/ +gboolean test_type_program_molcas(FILE* file) +{ + gchar t[BSIZE]; + guint taille=BSIZE; + fseek(file, 0L, SEEK_SET); + while(!feof(file)) + { + if(!fgets(t, taille, file)) return FALSE; + g_strup(t); + if( strstr(t, "&SEWARD") ) return TRUE; + if( strstr(t, "&GATEWAY") ) return TRUE; + } + return FALSE; +} +/**********************************************************************************/ +gboolean test_type_program_molpro(FILE* file) +{ + gchar t[BSIZE]; + guint taille=BSIZE; + fseek(file, 0L, SEEK_SET); + while(!feof(file)) + { + if(!fgets(t, taille, file)) return FALSE; + if( (int)t[0] ==(int)'!' ) continue; + if( (int)t[0] ==(int)'*' ) return TRUE; + return FALSE; + } + return FALSE; +} +/**********************************************************************************/ +gboolean test_type_program_mpqc(FILE* file) +{ + gchar t[BSIZE]; + guint taille=BSIZE; + fseek(file, 0L, SEEK_SET); + while(!feof(file)) + { + if(!fgets(t, taille, file)) return FALSE; + if(strstr(t,"%"))continue; + /* Object-Oriented input file */ + if(strstr(t,"molecule") && strstr(t,"Molecule") && strstr(t,"<") && strstr(t,">")) return TRUE; + /* sample input file */ + if(strstr(t,"molecule") && strstr(t,":")) return TRUE; + } + return FALSE; +} +/**********************************************************************************/ +gboolean test_type_program_gamess(FILE* file) +{ + gchar t[BSIZE]; + guint taille=BSIZE; + fseek(file, 0L, SEEK_SET); + while(!feof(file)) + { + if(!fgets(t, taille, file)) return FALSE; + if(strstr(t,"!"))continue; + + if(strstr(t,"$CONTRL")) return TRUE; + /* sample input file */ + if(strstr(t,"$BASIS")) return TRUE; + if(strstr(t,"$DATA")) return TRUE; + } + return FALSE; +} +/**********************************************************************************/ +gboolean test_type_program_firefly(FILE* file) +{ + gchar t[BSIZE]; + guint taille=BSIZE; + fseek(file, 0L, SEEK_SET); + while(!feof(file)) + { + if(!fgets(t, taille, file)) return FALSE; + if(strstr(t,"FireFly")) return TRUE; + } + return FALSE; +} +/**********************************************************************************/ +gboolean test_type_program_nwchem(FILE* file) +{ + gchar t[BSIZE]; + guint taille=BSIZE; + fseek(file, 0L, SEEK_SET); + while(!feof(file)) + { + if(!fgets(t, taille, file)) return FALSE; + if(strstr(t,"NWChem input") && strstr(t,"#")) return TRUE; + g_strup(t); + if(strstr(t,"GEOMETRY")) return TRUE; + if(strstr(t,"ZMATRIX")) return TRUE; + } + return FALSE; +} +/**********************************************************************************/ +gboolean test_type_program_orca(FILE* file) +{ + gchar t[BSIZE]; + guint taille=BSIZE; + fseek(file, 0L, SEEK_SET); + while(!feof(file)) + { + if(!fgets(t, taille, file)) return FALSE; + if(strstr(t,"Orca input") && strstr(t,"#")) return TRUE; + g_strup(t); + if(strstr(t,"* XYZ")) return TRUE; + if(strstr(t,"* INT")) return TRUE; + } + return FALSE; +} +/**********************************************************************************/ +gboolean test_type_program_mopac(FILE* file) +{ + gchar t[BSIZE]; + guint taille=BSIZE; + fseek(file, 0L, SEEK_SET); + while(!feof(file)) + { + if(!fgets(t, taille, file)) return FALSE; + if(t[0] != '*') break; + if(t[0] == '*' && strstr(t,"Mopac")) return TRUE; + } + if(strstr(t,"BONDS") && strstr(t,"CHARGE")) return TRUE; + if(!fgets(t, taille, file)) return FALSE; + if(strstr(t,"Mopac")) return TRUE; + return FALSE; +} +/**********************************************************************************/ +gboolean test_type_program_qchem(FILE* file) +{ + gchar t[BSIZE]; + guint taille=BSIZE; + fseek(file, 0L, SEEK_SET); + while(!feof(file)) + { + if(!fgets(t, taille, file)) return FALSE; + if(strstr(t,"!"))continue; + + if(strstr(t,"$molecule")) return TRUE; + if(strstr(t,"$rem")) return TRUE; + } + return FALSE; +} +/**********************************************************************************/ +gint get_type_of_program(FILE* file) +{ + if(test_type_program_orca(file)) + { + fseek(file, 0L, SEEK_SET); + return PROG_IS_ORCA; + } + if(test_type_program_firefly(file)) + { + fseek(file, 0L, SEEK_SET); + return PROG_IS_FIREFLY; + } + if(test_type_program_gamess(file)) + { + fseek(file, 0L, SEEK_SET); + return PROG_IS_GAMESS; + } + if(test_type_program_qchem(file)) + { + fseek(file, 0L, SEEK_SET); + return PROG_IS_QCHEM; + } + if(test_type_program_mopac(file)) + { + fseek(file, 0L, SEEK_SET); + return PROG_IS_MOPAC; + } + if(test_type_program_mpqc(file)) + { + fseek(file, 0L, SEEK_SET); + return PROG_IS_MPQC; + } + if(test_type_program_nwchem(file)) + { + fseek(file, 0L, SEEK_SET); + return PROG_IS_NWCHEM; + } + if(test_type_program_gaussian(file)) + { + fseek(file, 0L, SEEK_SET); + return PROG_IS_GAUSS; + } + if(test_type_program_molcas(file)) + { + fseek(file, 0L, SEEK_SET); + return PROG_IS_MOLCAS; + } + if(test_type_program_molpro(file)) + { + fseek(file, 0L, SEEK_SET); + return PROG_IS_MOLPRO; + } + fseek(file, 0L, SEEK_SET); + return PROG_IS_OTHER; +} +/**************************************************************************************************************************************/ +void gabedit_string_get_pixel_size(GtkWidget* parent, PangoFontDescription *font_desc, G_CONST_RETURN gchar* t, int *width, int* height) +{ + PangoLayout *layout = gtk_widget_create_pango_layout(parent, t); + if(font_desc) pango_layout_set_font_description (layout,font_desc); + pango_layout_set_justify(layout, TRUE); + pango_layout_get_pixel_size(layout, width,height); + g_object_unref (layout); +} +/**********************************************************************************/ +void gabedit_draw_string(GtkWidget* parent, GdkPixmap* pixmap, PangoFontDescription *font_desc, GdkGC* gc , gint x, gint y, G_CONST_RETURN gchar* t, gboolean centerX, gboolean centerY) +{ + int width = 0; + int height = 0; + PangoLayout *layout = gtk_widget_create_pango_layout(parent, t); + if(font_desc) pango_layout_set_font_description (layout,font_desc); + pango_layout_set_justify(layout, TRUE); + if(centerX || centerY) pango_layout_get_pixel_size(layout, &width,&height); + if(centerX) x -= width/2; + if(centerY) y -= height/2; + gdk_draw_layout (pixmap,gc,x,y,layout); + g_object_unref (layout); +} +/**********************************************************************************************************************************/ +void gabedit_save_image(GtkWidget* widget, gchar *fileName, gchar* type) +{ + int width; + int height; + GError *error = NULL; + GdkPixbuf *pixbuf = NULL; + + width = widget->allocation.width; + height = widget->allocation.height; + pixbuf = gdk_pixbuf_get_from_drawable(NULL, widget->window, NULL, 0, 0, 0, 0, width, height); + /* printf("width = %d height = %d\n",width,height);*/ + if(pixbuf) + { + if(!fileName) + { + GtkClipboard * clipboard; + clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); + if(clipboard) + { + gtk_clipboard_clear(clipboard); + gtk_clipboard_set_image(clipboard, pixbuf); + } + } + else + { + if(type && strstr(type,"j") && strstr(type,"g") ) + gdk_pixbuf_save(pixbuf, fileName, type, &error, "quality", "100", NULL); + else if(type && strstr(type,"png")) + gdk_pixbuf_save(pixbuf, fileName, type, &error, "compression", "5", NULL); + else if(type && (strstr(type,"tif") || strstr(type,"tiff"))) + gdk_pixbuf_save(pixbuf, fileName, "tiff", &error, "compression", "1", NULL); + else + gdk_pixbuf_save(pixbuf, fileName, type, &error, NULL); + } + g_object_unref (pixbuf); + } + /* else printf("Warnning pixbuf = NULL\n");*/ +} +/**********************************************************************************************************************************/ +G_CONST_RETURN gchar* get_open_babel_command() +{ + return babelCommand; +} +/**********************************************************************************************************************************/ +gint get_num_orbitals_from_aux_mopac_file(FILE* file, gchar* blockName, gint* begin, gint* end) +{ + gchar t[BSIZE]; + *begin = 0; + *end = 0; + while(!feof(file)) + { + if(!fgets(t,BSIZE,file))break; + if(strstr( t, blockName)) + { + gchar* pdest = strstr( t, "=")+1; + gint i = sscanf(pdest,"%d %d",begin,end); + return i; + } + } + return 0; +} +/**********************************************************************************************************************************/ +gchar** get_one_block_from_aux_mopac_file(FILE* file, gchar* blockName, gint* n) +{ + gint nElements = 0; + gchar** elements = NULL; + gchar t[BSIZE]; + while(!feof(file)) + { + if(!fgets(t,BSIZE,file))break; + if(strstr( t, blockName)) + { + gchar* pdest = strstr( t, "[")+1; + gint i; + nElements = atoi(pdest); + if(nElements<1) break; + else + { + long int geomposok = ftell(file); + if(!fgets(t,BSIZE,file))break; + if(!strstr(t,"# ")) fseek(file, geomposok, SEEK_SET); + } + + elements = g_malloc(nElements*sizeof(gchar*)); + for(i=0;i0;i--) + if(filename[i]=='.') + { + p=i+1; + break; + } + lnew = len-p; + if(p<0 || lnew<=0) return NULL; + ext= g_malloc((lnew+1)*sizeof(gchar)); + + for(i=p;i0 && !strstr(t,"**********")) ktype = GABEDIT_TYPEFILE_XYZ; + if( ktype == GABEDIT_TYPEFILE_UNKNOWN) + { + while(!feof(file)) + { + fgets(t,taille,file); + if(strstr(t,"PROGRAM SYSTEM MOLPRO")) + { + ktype = GABEDIT_TYPEFILE_MOLPRO; + break; + } + if(strstr(t,"GAMESS VERSION") || strstr(t,"PC GAMESS")) + { + ktype = GABEDIT_TYPEFILE_GAMESS; + break; + } + if(strstr(t,"Welcome to Q-Chem")) + { + ktype = GABEDIT_TYPEFILE_QCHEM; + break; + } + if(strstr(t,"Northwest Computational Chemistry Package")) + { + ktype = GABEDIT_TYPEFILE_NWCHEM; + break; + } + if(strstr(t,"TURBOMOLE GmbH")) + { + ktype = GABEDIT_TYPEFILE_TURBOMOLE; + break; + } + g_strup(t); + if(strstr(t, "ENTERING GAUSSIAN" )) + { + ktype = GABEDIT_TYPEFILE_GAUSSIAN; + break; + } + } + } + rewind(file); + if( ktype == GABEDIT_TYPEFILE_UNKNOWN) + { + while(!feof(file)) + { + fgets(t,taille,file); + if(strstr(t,"* O R C A *")) + { + ktype = GABEDIT_TYPEFILE_ORCA; + break; + } + } + } + rewind(file); + if( ktype == GABEDIT_TYPEFILE_UNKNOWN) + { + while(!feof(file)) + { + fgets(t,taille,file); + if(strstr(t,"GAMESS")) + { + fgets(t,taille,file); + if(strstr(t,"FROM IOWA STATE UNIVERSITY")) + ktype = GABEDIT_TYPEFILE_GAMESS; + break; + } + } + } + rewind(file); + if( ktype == GABEDIT_TYPEFILE_UNKNOWN) + { + fgets(t,taille,file); + if(strstr(t,"START OF MOPAC FILE")) + ktype = GABEDIT_TYPEFILE_MOPAC_AUX; + } + rewind(file); + if( ktype == GABEDIT_TYPEFILE_UNKNOWN) + { + while(!feof(file) ) + { + if(!fgets(t, taille, file))break; + if( strstr(t,"VARIABLE") && strstr(t,"FUNCTION")) + { + ktype = GABEDIT_TYPEFILE_MOPAC_SCAN; + break; + } + } + } + rewind(file); + if( ktype == GABEDIT_TYPEFILE_UNKNOWN) + { + while(!feof(file) ) + { + if(!fgets(t, taille, file))break; + if(strstr(t,"INTRINSIC REACTION COORDINATE") ) + { + ktype = GABEDIT_TYPEFILE_MOPAC_IRC; + break; + } + } + } + + g_free(t); + fclose(file); + return ktype; +} +/**********************************************/ +GabEditTypeFile get_type_input_file(gchar* fileName) +{ + FILE* file = FOpen(fileName, "rb"); + if(test_type_program_orca(file)) + { + fseek(file, 0L, SEEK_SET); + fclose(file); + return GABEDIT_TYPEFILE_ORCAINPUT; + } + if(test_type_program_firefly(file)) + { + fseek(file, 0L, SEEK_SET); + fclose(file); + return GABEDIT_TYPEFILE_FIREFLYINPUT; + } + if(test_type_program_gamess(file)) + { + fseek(file, 0L, SEEK_SET); + fclose(file); + return GABEDIT_TYPEFILE_GAMESSINPUT; + } + if(test_type_program_qchem(file)) + { + fseek(file, 0L, SEEK_SET); + fclose(file); + return GABEDIT_TYPEFILE_QCHEMINPUT; + } + if(test_type_program_mopac(file)) + { + fseek(file, 0L, SEEK_SET); + fclose(file); + return GABEDIT_TYPEFILE_MOPACINPUT; + } + if(test_type_program_mpqc(file)) + { + fseek(file, 0L, SEEK_SET); + fclose(file); + return GABEDIT_TYPEFILE_MPQCINPUT; + } + if(test_type_program_gaussian(file)) + { + fseek(file, 0L, SEEK_SET); + fclose(file); + return GABEDIT_TYPEFILE_GAUSSIANINPUT; + } + if(test_type_program_molcas(file)) + { + fseek(file, 0L, SEEK_SET); + fclose(file); + return GABEDIT_TYPEFILE_MOLCASINPUT; + } + if(test_type_program_molpro(file)) + { + fseek(file, 0L, SEEK_SET); + fclose(file); + return GABEDIT_TYPEFILE_MOLPROINPUT; + } + fseek(file, 0L, SEEK_SET); + fclose(file); + return GABEDIT_TYPEFILE_UNKNOWN; +} +/************************************************/ +GabEditTypeFile get_type_file(gchar* filename) +{ + gchar* ext = NULL; + if(!filename) return GABEDIT_TYPEFILE_UNKNOWN; + ext = get_extenssion_file(filename); + if(!ext) return GABEDIT_TYPEFILE_UNKNOWN; + g_strup(ext); + if( !strcmp(ext,"INP") || !strcmp(ext,"COM") || !strcmp(ext,"IN") || !strcmp(ext,"MOP") ) + return get_type_input_file(filename); + if( !strcmp(ext,"OUT") || !strcmp(ext,"LOG") ) + return get_type_output_file(filename); + if( !strcmp(ext,"MOL2")) return GABEDIT_TYPEFILE_MOL2; + if( !strcmp(ext,"XYZ")) return GABEDIT_TYPEFILE_XYZ; + if( !strcmp(ext,"PDB")) return GABEDIT_TYPEFILE_PDB; + if( !strcmp(ext,"GZMT")) return GABEDIT_TYPEFILE_GZMAT; + if( !strcmp(ext,"ZMT")) return GABEDIT_TYPEFILE_MZMAT; + if( !strcmp(ext,"HIN")) return GABEDIT_TYPEFILE_HIN; + if( !strcmp(ext,"TNK")) return GABEDIT_TYPEFILE_TINKER; + if( !strcmp(ext,"GAB")) return GABEDIT_TYPEFILE_GABEDIT; + if( !strcmp(ext,"MOLDEN")) return GABEDIT_TYPEFILE_MOLDEN; + if( !strcmp(ext,"MFJ")) return GABEDIT_TYPEFILE_MOBCAL; + if( !strcmp(ext,"AUX")) return GABEDIT_TYPEFILE_MOPAC_AUX; + if( !strcmp(ext,"JPG")) return GABEDIT_TYPEFILE_JPEG; + if( !strcmp(ext,"JPEG")) return GABEDIT_TYPEFILE_JPEG; + if( !strcmp(ext,"PPM")) return GABEDIT_TYPEFILE_PPM; + if( !strcmp(ext,"BMP")) return GABEDIT_TYPEFILE_BMP; + if( !strcmp(ext,"PNG")) return GABEDIT_TYPEFILE_PNG; + if( !strcmp(ext,"PS")) return GABEDIT_TYPEFILE_PS; + if( !strcmp(ext,"T41")) return GABEDIT_TYPEFILE_CUBEADF; + if( !strcmp(ext,"GRID")) return GABEDIT_TYPEFILE_CUBEMOLCAS; + if( !strcmp(ext,"HF")) return GABEDIT_TYPEFILE_CUBEQCHEM; + if( !strcmp(ext,"GCUBE")) return GABEDIT_TYPEFILE_CUBEGABEDIT; + if( !strcmp(ext,"TRJ")) return GABEDIT_TYPEFILE_TRJ; + if( !strcmp(ext,"TXT")) return GABEDIT_TYPEFILE_TXT; + if( !strcmp(ext,"IRC")) return GABEDIT_TYPEFILE_GAMESSIRC; + if( !strcmp(ext,"CUBE") && !strcmp(filename,"CUBE")) return GABEDIT_TYPEFILE_CUBEMOLPRO; + if( !strcmp(ext,"CUBE")) return GABEDIT_TYPEFILE_CUBEGAUSS; + if( !strcmp(ext,"FCHK")) return GABEDIT_TYPEFILE_GAUSSIAN_FCHK; + + return GABEDIT_TYPEFILE_UNKNOWN; +} +/************************************************/ +gchar * mystrcasestr(G_CONST_RETURN gchar *haystack, G_CONST_RETURN gchar *needle) +{ + gchar *i, *startn = 0, *j = 0; + for (i = (gchar*)haystack; *i; i++) + { + if(j) + { + if (toupper(*i) == toupper(*j)) + { + if (!*++j) + return startn; + } + else j = 0; + } + else if (toupper(*i) == toupper(*needle)) + { + j = (gchar*)needle + 1; + startn = i; + } + } + return 0; +} +/****************************************************************************/ +gint get_one_int_from_fchk_gaussian_file(FILE* file, gchar* blockName) +{ + gint ipos = 47; + gchar t[BSIZE]; + while(!feof(file)) + { + if(!fgets(t,BSIZE,file))break; + if(strstr( t, blockName)) + { + if(strlen(t)>ipos+1) return atoi(t+ipos); + return -1; + } + } + return -1; +} +/****************************************************************************/ +gdouble get_one_real_from_fchk_gaussian_file(FILE* file, gchar* blockName) +{ + gint ipos = 47; + gchar t[BSIZE]; + while(!feof(file)) + { + if(!fgets(t,BSIZE,file))break; + if(strstr( t, blockName)) + { + if(strlen(t)>ipos+1) return atof(t+ipos); + return -1; + } + } + return -1; +} +/****************************************************************************/ +gint* get_array_int_from_fchk_gaussian_file(FILE* file, gchar* blockName, gint* nElements) +{ + gint ipos = 43; + gint i; + gchar t[BSIZE]; + gint* elements = NULL; + *nElements = 0; + while(!feof(file)) + { + if(!fgets(t,BSIZE,file))break; + if(strstr( t, blockName)) + { + if(!(strstr( t, blockName) && strstr(t,"N=") && strlen(strstr(t,"N="))>2)) return elements; + if(strlen(t)>ipos+1 && t[ipos]!='I') return elements; + *nElements = atof(strstr(t,"N=")+2); + if(*nElements<1) return elements; + elements = g_malloc(*nElements*sizeof(gint)); + for(i=0;i<*nElements;i++) + { + if(1!=fscanf(file,"%d",&elements[i])) break; + } + if(i!=*nElements) + { + *nElements = 0; + g_free(elements); + return NULL; + } + return elements; + } + } + return elements; +} +/****************************************************************************/ +gdouble* get_array_real_from_fchk_gaussian_file(FILE* file, gchar* blockName, gint* nElements) +{ + gint ipos = 43; + gint i; + gchar t[BSIZE]; + gdouble* elements = NULL; + + *nElements = 0; + while(!feof(file)) + { + if(!fgets(t,BSIZE,file))break; + if(strstr( t, blockName)) + { + if(!(strstr( t, blockName) && strstr(t,"N=") && strlen(strstr(t,"N="))>2)) return elements; + if(strlen(t)>ipos+1 && t[ipos]!='R') return elements; + *nElements = atof(strstr(t,"N=")+2); + if(*nElements<1) return elements; + elements = g_malloc(*nElements*sizeof(gdouble)); + for(i=0;i<*nElements;i++) + if(1!=fscanf(file,"%lf",&elements[i])) break; + if(i!=*nElements) + { + *nElements = 0; + g_free(elements); + return NULL; + } + return elements; + } + } + return elements; +} +/****************************************************************************/ +gchar** get_array_string_from_fchk_gaussian_file(FILE* file, gchar* blockName, gint* nElements) +{ + gint ipos = 43; + gint i; + gchar t[BSIZE]; + gchar** elements = NULL; + gchar type = ' '; + + *nElements = 0; + while(!feof(file)) + { + if(!fgets(t,BSIZE,file))break; + if(strstr( t, blockName)) + { + if(!(strstr( t, blockName) && strstr(t,"N=") && strlen(strstr(t,"N="))>2)) return elements; + if(strlen(t)>ipos+1 && t[ipos]=='C') type = 'C'; + if(strlen(t)>ipos+1 && t[ipos]=='H') type = 'H'; + if(type!='C' && type!='H') return elements; + *nElements = atof(strstr(t,"N=")+2); + if(*nElements<1) return elements; + elements = g_malloc(*nElements*sizeof(gchar*)); + for(i=0;i<*nElements;i++) elements[i] = NULL; + if(type=='C') + for(i=0;i<*nElements;i++) + { + if(1!=fscanf(file,"%12s",t)) break; + elements[i] = g_strdup(t); + } + else + for(i=0;i<*nElements;i++) + { + if(1!=fscanf(file,"%8s",t)) break; + elements[i] = g_strdup(t); + } + + if(i!=*nElements) + { + *nElements = 0; + g_free(elements); + return NULL; + } + return elements; + } + } + return elements; +} +/*************************************************************************************/ +void getvScaleBond(gdouble r, gdouble Center1[], gdouble Center2[], gdouble vScal[]) +{ + gint l; + V3d cros; + V3d sub; + V3d C0={0,0,0}; + gdouble C10[3]; + gdouble C20[3]; + gdouble CC1[3]; + gdouble CC2[3]; + for(l=0;l<3;l++) vScal[l] = r*0.5; + for(l=0;l<3;l++) CC1[l] = Center1[l]; + for(l=0;l<3;l++) CC2[l] = Center2[l]; + v3d_sub(C0, CC1, C10); + v3d_sub(C0, CC2, C20); + v3d_cross(C10, C20, cros); + v3d_sub(CC1, CC2, sub); + v3d_cross(cros, sub, vScal); + if(v3d_dot(vScal,vScal)!=0) + { + v3d_normal(vScal); + v3d_scale(vScal, r*0.5); + } +} +/*************************************************************************************/ +void getPositionsRadiusBond3(gdouble r, gdouble Ci[], gdouble Cj[], gdouble C11[], gdouble C12[], gdouble C21[], gdouble C22[], gdouble C31[], gdouble C32[], gdouble radius[], gint type) +{ + gdouble s = 1.8; + V3d vScal; + gint k; + + getvScaleBond(r, Ci, Cj, vScal); + if(type==0) + { + s = 2.8; + radius[0] = r/4; + radius[1] = r; + radius[2] = r/4; + } + else + { + s = 2; + radius[0] = r/2; + radius[1] = r/2; + radius[2] = r/2; + } + for(k=0;k<3;k++) C11[k] = Ci[k]-s*vScal[k]; + for(k=0;k<3;k++) C12[k] = Cj[k]-s*vScal[k]; + for(k=0;k<3;k++) C21[k] = Ci[k]; + for(k=0;k<3;k++) C22[k] = Cj[k]; + for(k=0;k<3;k++) C31[k] = Ci[k]+s*vScal[k]; + for(k=0;k<3;k++) C32[k] = Cj[k]+s*vScal[k]; + +} +/*************************************************************************************/ +void getPositionsRadiusBond2(gdouble r, gdouble Ci[], gdouble Cj[], gdouble C11[], gdouble C12[], gdouble C21[], gdouble C22[], gdouble radius[], gint type) +{ +/* type=0=>stick, type=1=>ball&stick */ + gdouble s = 1.5; + V3d vScal; + gint k; + + getvScaleBond(r, Ci, Cj, vScal); + + radius[2] = 0; + if(type==0) + { + s = 2.8; + radius[0] = r/4; + radius[1] = r; + for(k=0;k<3;k++) C11[k] = Ci[k]-s*vScal[k]; + for(k=0;k<3;k++) C12[k] = Cj[k]-s*vScal[k]; + for(k=0;k<3;k++) C21[k] = Ci[k]; + for(k=0;k<3;k++) C22[k] = Cj[k]; + } + else + { + s = 1.5; + radius[0] = r/1.5; + radius[1] = r/1.5; + for(k=0;k<3;k++) C11[k] = Ci[k]-s*vScal[k]; + for(k=0;k<3;k++) C12[k] = Cj[k]-s*vScal[k]; + for(k=0;k<3;k++) C21[k] = Ci[k]+s*vScal[k]; + for(k=0;k<3;k++) C22[k] = Cj[k]+s*vScal[k]; + } +}