From 0ad40ee839f5ba4d4c301ea0fbe31511380efec3 Mon Sep 17 00:00:00 2001 From: Chengcheng Xiao Date: Mon, 8 Apr 2019 20:35:56 +0800 Subject: [PATCH 1/5] Updated README.MacOS, added p4v_pygtk.rb for homebrew pygtk installation. --- README.MacOS | 16 ++++++++++++++-- p4v_pygtk.rb | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 p4v_pygtk.rb diff --git a/README.MacOS b/README.MacOS index 3062890..66ffafc 100644 --- a/README.MacOS +++ b/README.MacOS @@ -1,28 +1,40 @@ p4vasp compillation in MacOS: -(Tested on Mac OS 10.13.4, all updates installed.) +(Tested on Mac OS 10.14.4, all updates installed.) 0) You will need X11 and the command-line tools for Xcode installed. For Xquratz, visit: https://www.xquartz.org/ For command-line tools: $ xcode-select --install + To install header file: install /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg by double click. 1) For FLTK installation, we use homebrew's fltk: Install homebrew: $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" Install fltk: $ brew install fltk -2) Install other necessary library: $ brew install python@2 pip gcc gtk+ pygtk —with-libglade && pip install pyopengl numpy + +2) Install other necessary library: $ brew install python@2 + $ pip install pyopengl numpy + $ brew install gcc@7 + $ brew install gtk+ + $ bre install --build-from-source ./p4v_pygtk.rb —-with-libglade + +(*)Note that homebrew team merged a pull request that deleted the pygtk with libglade support, please use provided p4v_pygtk.rb to install pygtk. + 3) Apply patch to the sourcefile: $ patch -p0 -i MacOS.patch + 5) Copy the Makefile.MacOS to Makefile in the p4vasp root directory and in the src directory: $ cp Makefile.MacOS Makefile $ cp odpdom/Makefile.MacOS odpdom/Makefile $ cp src/Makefile.MacOS src/Makefile + 6) Run make and install: make local && make && make install + 7) The executable should located at ~/p4vasp/bin diff --git a/p4v_pygtk.rb b/p4v_pygtk.rb new file mode 100644 index 0000000..733c104 --- /dev/null +++ b/p4v_pygtk.rb @@ -0,0 +1,41 @@ +class Pygtk < Formula + desc "GTK+ bindings for Python" + homepage "http://www.pygtk.org/" + url "https://download.gnome.org/sources/pygtk/2.24/pygtk-2.24.0.tar.bz2" + sha256 "cd1c1ea265bd63ff669e92a2d3c2a88eb26bcd9e5363e0f82c896e649f206912" + revision 2 + + bottle do + cellar :any + sha256 "6aa04785bcbf9c1e79a268b27263ce61dbfa64cb21023c426b70ead3b6671689" => :mojave + sha256 "228a919cbba58afc99747e9b5dc6d01013ef8463de2ede5d81c20103afccbb9f" => :high_sierra + sha256 "fce76d2bf1e1748ac110aede98a622e5f8b737390a3a5e22f56872834b73c033" => :sierra + sha256 "fd1cef5484267e02971c4daa1eda42e3a66c77786923b0f76b496007282b10a1" => :el_capitan + end + + depends_on "pkg-config" => :build + depends_on "atk" + depends_on "glib" + depends_on "gtk+" + depends_on "py2cairo" + depends_on "pygobject" + depends_on "libglade" => :optional + + def install + ENV.append "CFLAGS", "-ObjC" + system "./configure", "--disable-dependency-tracking", + "--prefix=#{prefix}" + system "make", "install" + + # Fixing the pkgconfig file to find codegen, because it was moved from + # pygtk to pygobject. But our pkgfiles point into the cellar and in the + # pygtk-cellar there is no pygobject. + inreplace lib/"pkgconfig/pygtk-2.0.pc", "codegendir=${datadir}/pygobject/2.0/codegen", "codegendir=#{HOMEBREW_PREFIX}/share/pygobject/2.0/codegen" + inreplace bin/"pygtk-codegen-2.0", "exec_prefix=${prefix}", "exec_prefix=#{Formula["pygobject"].opt_prefix}" + end + + test do + (testpath/"codegen.def").write("(define-enum asdf)") + system "#{bin}/pygtk-codegen-2.0", "codegen.def" + end +end From 0452189a9666595c418e3fb9d1a5f7ce027bfe0e Mon Sep 17 00:00:00 2001 From: Chengcheng Xiao Date: Tue, 9 Apr 2019 14:57:04 +0800 Subject: [PATCH 2/5] Updated README.MacOS, change formula name to brew_pygtk.rb --- README.MacOS | 18 ++++++++++++++---- p4v_pygtk.rb => brew_pygtk.rb | 0 2 files changed, 14 insertions(+), 4 deletions(-) rename p4v_pygtk.rb => brew_pygtk.rb (100%) diff --git a/README.MacOS b/README.MacOS index 66ffafc..f6e80c0 100644 --- a/README.MacOS +++ b/README.MacOS @@ -1,5 +1,8 @@ p4vasp compillation in MacOS: -(Tested on Mac OS 10.14.4, all updates installed.) +(Tested on Mac OS 10.14.4 by Chengcheng-Xiao, all updates installed. ) +(Contact me by E-mail : iconxicon@me.com ) +( or Github : https://github.com/orest-d/p4vasp/issues/ ) + 0) You will need X11 and the command-line tools for Xcode installed. For Xquratz, visit: https://www.xquartz.org/ @@ -9,6 +12,7 @@ p4vasp compillation in MacOS: 1) For FLTK installation, we use homebrew's fltk: Install homebrew: $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + update homebrew: $ brew update Install fltk: $ brew install fltk @@ -16,9 +20,11 @@ p4vasp compillation in MacOS: $ pip install pyopengl numpy $ brew install gcc@7 $ brew install gtk+ - $ bre install --build-from-source ./p4v_pygtk.rb —-with-libglade + $ brew install --build-from-source ./brew_pygtk.rb —-with-libglade -(*)Note that homebrew team merged a pull request that deleted the pygtk with libglade support, please use provided p4v_pygtk.rb to install pygtk. +(*)Note that homebrew team are deleting all formula options to avoid compilation. +(*)In one merged pull request (#35732) they deleted the pygtk with libglade support. +(*)Please use provided brew_pygtk.rb to install pygtk. 3) Apply patch to the sourcefile: $ patch -p0 -i MacOS.patch @@ -36,5 +42,9 @@ p4vasp compillation in MacOS: 7) The executable should located at ~/p4vasp/bin + you can put it in your PATH by: + $ export PATH=~/p4vasp/bin:$PATH - +Known bugs: +(1). Close window directly can causes froze-window. FIX: Uses exit option under Files. +(2). Buttons can be unresponsive sometimes. FIX: try wait a while..... diff --git a/p4v_pygtk.rb b/brew_pygtk.rb similarity index 100% rename from p4v_pygtk.rb rename to brew_pygtk.rb From 77db039d25651e6b58490963987d48888997629d Mon Sep 17 00:00:00 2001 From: Chengcheng Xiao Date: Tue, 9 Apr 2019 15:16:24 +0800 Subject: [PATCH 3/5] address issue #8 --- MacOS.patch | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/MacOS.patch b/MacOS.patch index 8cc4d30..3c6080a 100644 --- a/MacOS.patch +++ b/MacOS.patch @@ -15,7 +15,7 @@ diff -c -r ./src/VisDrawer.cpp ../p4vasp-0.3.31/src/VisDrawer.cpp #include #include #include -! #include +! #include const char *VisDrawer::getClassName(){return "VisDrawer";} @@ -35,7 +35,7 @@ diff -c -r ./src/VisIsosurfaceDrawer.cpp ../p4vasp-0.3.31/src/VisIsosurfaceDrawe #include #include #include -! #include +! #include #include #include #include @@ -55,7 +55,7 @@ diff -c -r ./src/VisMain.cpp ../p4vasp-0.3.31/src/VisMain.cpp #include #include #include -! #include +! #include #include THREAD(Vis_thread); @@ -75,7 +75,7 @@ diff -c -r ./src/VisNavDrawer.cpp ../p4vasp-0.3.31/src/VisNavDrawer.cpp #include #include #include -! #include +! #include #include #include @@ -95,7 +95,7 @@ diff -c -r ./src/VisPrimitiveDrawer.cpp ../p4vasp-0.3.31/src/VisPrimitiveDrawer. #include #include #include -! #include +! #include #include #include @@ -115,7 +115,7 @@ diff -c -r ./src/VisStructureArrowsDrawer.cpp ../p4vasp-0.3.31/src/VisStructureA #include #include #include -! #include +! #include #include #include #include @@ -135,7 +135,7 @@ diff -c -r ./src/VisStructureDrawer.cpp ../p4vasp-0.3.31/src/VisStructureDrawer. #include #include #include -! #include +! #include #include #include #include @@ -183,7 +183,7 @@ diff -c -r ./src/include/p4vasp/VisFLWindow.h ../p4vasp-0.3.31/src/include/p4vas #include #include -! #include +! #include #include "VisWindow.h" class VisFLWindow : public Fl_Gl_Window{ @@ -203,7 +203,7 @@ diff -c -r ./src/include/p4vasp/VisIsosurfaceDrawer.h ../p4vasp-0.3.31/src/inclu #include "Chgcar.h" #include "threads.h" #include -! #include +! #include #ifndef VisWindow class VisWindow; @@ -223,7 +223,7 @@ diff -c -r ./src/include/p4vasp/VisPrimitiveDrawer.h ../p4vasp-0.3.31/src/includ #include "VisDrawer.h" #include "threads.h" #include -! #include +! #include #ifndef VisWindow class VisWindow; @@ -243,7 +243,7 @@ diff -c -r ./src/include/p4vasp/VisStructureArrowsDrawer.h ../p4vasp-0.3.31/src/ #include "VisStructureDrawer.h" #include "threads.h" #include -! #include +! #include #ifndef VisWindow class VisWindow; @@ -263,7 +263,7 @@ diff -c -r ./src/include/p4vasp/VisStructureDrawer.h ../p4vasp-0.3.31/src/includ #include "VisPrimitiveDrawer.h" #include "threads.h" #include -! #include +! #include #include "AtomInfo.h" #include "Structure.h" From de022085d522c25c545ee3158a69bf96c0f0866d Mon Sep 17 00:00:00 2001 From: Chengcheng Xiao Date: Fri, 28 Jun 2019 21:10:28 +0800 Subject: [PATCH 4/5] Update homebrew pygtk installation process. Added a 'dirty' fix for vasp v5.4.4 and up. --- 544_update.patch | 174 ++++++++++++++++++++++++++++++++++++++ README | 1 - README.MacOS | 6 +- README.md | 15 ++-- brew_pygtk.rb => pygtk.rb | 0 5 files changed, 187 insertions(+), 9 deletions(-) create mode 100644 544_update.patch rename brew_pygtk.rb => pygtk.rb (100%) diff --git a/544_update.patch b/544_update.patch new file mode 100644 index 0000000..ff979b3 --- /dev/null +++ b/544_update.patch @@ -0,0 +1,174 @@ +diff -bruN ./data/glade/lbandsapplet.glade ../p4vasp_mod/data/glade/lbandsapplet.glade +--- ./data/glade/lbandsapplet.glade 2019-06-28 20:51:04.000000000 +0800 ++++ ../p4vasp_mod/data/glade/lbandsapplet.glade 2019-06-28 20:40:39.000000000 +0800 +@@ -444,14 +444,14 @@ + + + GtkCheckButton +- dx2 ++ x2-y2 + True + + toggled + on_d_toggled + Wed, 04 Dec 2002 15:42:50 GMT + +- ++ + True + True + +diff -bruN ./data/glade/ldosapplet.glade ../p4vasp_mod/data/glade/ldosapplet.glade +--- ./data/glade/ldosapplet.glade 2019-06-28 20:51:04.000000000 +0800 ++++ ../p4vasp_mod/data/glade/ldosapplet.glade 2019-06-28 20:40:21.000000000 +0800 +@@ -511,14 +511,14 @@ + + + GtkCheckButton +- dx2 ++ x2-y2 + True + + toggled + on_d_toggled + Wed, 04 Dec 2002 15:42:50 GMT + +- ++ + True + True + +diff -bruN ./data/glade2/elcontrolapplet.glade ../p4vasp_mod/data/glade2/elcontrolapplet.glade +--- ./data/glade2/elcontrolapplet.glade 2019-06-28 20:51:04.000000000 +0800 ++++ ../p4vasp_mod/data/glade2/elcontrolapplet.glade 2019-06-28 20:41:13.000000000 +0800 +@@ -695,10 +695,10 @@ + + + +- ++ + True + True +- dx2 ++ x2-y2 + True + GTK_RELIEF_NORMAL + True +diff -bruN ./data/glade2/lbandsapplet.glade ../p4vasp_mod/data/glade2/lbandsapplet.glade +--- ./data/glade2/lbandsapplet.glade 2019-06-28 20:51:04.000000000 +0800 ++++ ../p4vasp_mod/data/glade2/lbandsapplet.glade 2019-06-28 20:41:28.000000000 +0800 +@@ -409,10 +409,10 @@ + + + +- ++ + True + True +- dx2 ++ x2-y2 + True + GTK_RELIEF_NORMAL + True +diff -bruN ./data/glade2/ldosapplet.glade ../p4vasp_mod/data/glade2/ldosapplet.glade +--- ./data/glade2/ldosapplet.glade 2019-06-28 20:51:04.000000000 +0800 ++++ ../p4vasp_mod/data/glade2/ldosapplet.glade 2019-06-28 20:40:54.000000000 +0800 +@@ -454,10 +454,10 @@ + + + +- ++ + True + True +- dx2 ++ x2-y2 + True + GTK_RELIEF_NORMAL + True +diff -bruN ./doc/api/python/p4vasp.SQLSystemPM-pysrc.html ../p4vasp_mod/doc/api/python/p4vasp.SQLSystemPM-pysrc.html +--- ./doc/api/python/p4vasp.SQLSystemPM-pysrc.html 2019-06-28 20:51:04.000000000 +0800 ++++ ../p4vasp_mod/doc/api/python/p4vasp.SQLSystemPM-pysrc.html 2019-06-28 20:42:17.000000000 +0800 +@@ -1143,7 +1143,7 @@ + 226 spins.sort() + 227 if spins[0]<0: + 228 spins.reverse() +-229 sorbitals=map(intern,["s","p","px","py","pz","d","dxy","dyz","dxz","dz2","dx2","f", ++229 sorbitals=map(intern,["s","p","px","py","pz","d","dxy","dyz","dxz","dz2","x2-y2","f", + 230 "f1","f2","f3","f4","f5","f6","f7"]) + 231 for x in orbitals[:]: + 232 if x not in sorbitals: +diff -bruN ./doc/api/python/p4vasp.applet.ElectronicApplet-module.html ../p4vasp_mod/doc/api/python/p4vasp.applet.ElectronicApplet-module.html +--- ./doc/api/python/p4vasp.applet.ElectronicApplet-module.html 2019-06-28 20:51:04.000000000 +0800 ++++ ../p4vasp_mod/doc/api/python/p4vasp.applet.ElectronicApplet-module.html 2019-06-28 20:41:57.000000000 +0800 +@@ -115,7 +115,7 @@ + +   + +- orbitals = orbitals = map(intern, ["s", "px", "py", "pz", "dxy", "dyz", "... + + +@@ -130,7 +130,7 @@ + +   + +- orbitals_d = map(intern, ["dxy", "dyz", "dxz", "dz2", "dx2"]) ++ orbitals_d = map(intern, ["dxy", "dyz", "dxz", "dz2", "x2-y2"]) + + + +@@ -186,7 +186,7 @@ +
+
Value:
+
+-map(intern, ["s", "px", "py", "pz", "dxy", "dyz", "dxz", "dz2", "dx2",\
++map(intern, ["s", "px", "py", "pz", "dxy", "dyz", "dxz", "dz2", "x2-y2",\
+  "f1", "f2", "f3", "f4", "f5", "f6", "f7"])
+ 
+
+diff -bruN ./doc/api/python/p4vasp.applet.ElectronicApplet-pysrc.html ../p4vasp_mod/doc/api/python/p4vasp.applet.ElectronicApplet-pysrc.html +--- ./doc/api/python/p4vasp.applet.ElectronicApplet-pysrc.html 2019-06-28 20:51:04.000000000 +0800 ++++ ../p4vasp_mod/doc/api/python/p4vasp.applet.ElectronicApplet-pysrc.html 2019-06-28 20:42:33.000000000 +0800 +@@ -100,10 +100,10 @@ + 32 import gtk + 33 + 34 +- 35 orbitals =map(intern,["s","px","py","pz","dxy","dyz","dxz","dz2","dx2", ++ 35 orbitals =map(intern,["s","px","py","pz","dxy","dyz","dxz","dz2","x2-y2", + 36 "f1","f2","f3","f4","f5","f6","f7"]) + 37 orbitals_p=map(intern,["px","py","pz"]) +- 38 orbitals_d=map(intern,["dxy","dyz","dxz","dz2","dx2"]) ++ 38 orbitals_d=map(intern,["dxy","dyz","dxz","dz2","x2-y2"]) + 39 orbitals_f=map(intern,["f1","f2","f3","f4","f5","f6","f7"]) + 40 +
41 -class Line: +diff -bruN ./lib/p4vasp/SQLSystemPM.py ../p4vasp_mod/lib/p4vasp/SQLSystemPM.py +--- ./lib/p4vasp/SQLSystemPM.py 2019-06-28 20:51:03.000000000 +0800 ++++ ../p4vasp_mod/lib/p4vasp/SQLSystemPM.py 2019-06-28 20:42:50.000000000 +0800 +@@ -226,7 +226,7 @@ + spins.sort() + if spins[0]<0: + spins.reverse() +- sorbitals=map(intern,["s","p","px","py","pz","d","dxy","dyz","dxz","dz2","dx2","f", ++ sorbitals=map(intern,["s","p","px","py","pz","d","dxy","dyz","dxz","dz2","x2-y2","f", + "f1","f2","f3","f4","f5","f6","f7"]) + for x in orbitals[:]: + if x not in sorbitals: +diff -bruN ./lib/p4vasp/applet/ElectronicApplet.py ../p4vasp_mod/lib/p4vasp/applet/ElectronicApplet.py +--- ./lib/p4vasp/applet/ElectronicApplet.py 2019-06-28 20:51:03.000000000 +0800 ++++ ../p4vasp_mod/lib/p4vasp/applet/ElectronicApplet.py 2019-06-28 20:43:03.000000000 +0800 +@@ -32,10 +32,10 @@ + import gtk + + +-orbitals =map(intern,["s","px","py","pz","dxy","dyz","dxz","dz2","dx2", ++orbitals =map(intern,["s","px","py","pz","dxy","dyz","dxz","dz2","x2-y2", + "f1","f2","f3","f4","f5","f6","f7"]) + orbitals_p=map(intern,["px","py","pz"]) +-orbitals_d=map(intern,["dxy","dyz","dxz","dz2","dx2"]) ++orbitals_d=map(intern,["dxy","dyz","dxz","dz2","x2-y2"]) + orbitals_f=map(intern,["f1","f2","f3","f4","f5","f6","f7"]) + + class Line: diff --git a/README b/README index 73ce374..42a12d4 100644 --- a/README +++ b/README @@ -120,4 +120,3 @@ odpdom/COPYING). This package as well may contain other packages (in ext directory) under various open-source licenses: fltk (www.fltk.org), sqlite (www.sqlite.org) and pysqlite (code.google.com/p/pysqlite). These packages are provided for convenience only to make the installation easier. - diff --git a/README.MacOS b/README.MacOS index f6e80c0..0d91a4d 100644 --- a/README.MacOS +++ b/README.MacOS @@ -20,11 +20,11 @@ p4vasp compillation in MacOS: $ pip install pyopengl numpy $ brew install gcc@7 $ brew install gtk+ - $ brew install --build-from-source ./brew_pygtk.rb —-with-libglade + $ brew install --build-from-source ./pygtk.rb —-with-libglade (*)Note that homebrew team are deleting all formula options to avoid compilation. -(*)In one merged pull request (#35732) they deleted the pygtk with libglade support. -(*)Please use provided brew_pygtk.rb to install pygtk. +(*)In one merged pull request (#35732) they deleted the libglade support. +(*)Please use the provided formula file pygtk.rb to install pygtk. 3) Apply patch to the sourcefile: $ patch -p0 -i MacOS.patch diff --git a/README.md b/README.md index d771c1b..4c62751 100644 --- a/README.md +++ b/README.md @@ -113,11 +113,11 @@ Installation (MacOS) $ brew install fltk ``` -3) Install other necessary library: +3) Install other necessary library: ``` $ brew install python@2 pip gcc gtk+ pygtk —with-libglade && pip install pyopengl numpy ``` -4) Apply patch to the sourcefile: +4) Apply patch to the sourcefile: ``` $ patch -p0 -i MacOS.patch ``` @@ -134,7 +134,14 @@ Installation (MacOS) 7) The executable should located at `~/p4vasp/bin` - +VASP (version 5.4.4+) update +-------------------------- +In VASP version 5.4.4, the projection label `dx2` for dx2-y2 orbital changed to `x2-y2`. +(0) Apply patch to the source files: +``` + $ patch -p0 -i 544_update.patch +``` +Note: This fix is not backward compatible. Starting: -------------------------- @@ -160,5 +167,3 @@ odpdom/COPYING). This package as well may contain other packages (in ext directory) under various open-source licenses: [fltk](www.fltk.org), [sqlite](www.sqlite.org) and [pysqlite](code.google.com/p/pysqlite). These packages are provided for convenience only to make the installation easier. - - diff --git a/brew_pygtk.rb b/pygtk.rb similarity index 100% rename from brew_pygtk.rb rename to pygtk.rb From c9793fde2c24644cbd33805d88750ea69db36a1e Mon Sep 17 00:00:00 2001 From: Chengcheng Xiao Date: Fri, 28 Jun 2019 21:42:29 +0800 Subject: [PATCH 5/5] renamed python to python2 to keep up MacOS version with #4 --- Makefile.MacOS | 8 ++++---- odpdom/Makefile.MacOS | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.MacOS b/Makefile.MacOS index 2f6f566..7ce89c6 100644 --- a/Makefile.MacOS +++ b/Makefile.MacOS @@ -43,9 +43,9 @@ P4V = p4v all: p4vasp local: - cd install && python configure.py local + cd install && python2 configure.py local config: - cd install && python configure.py + cd install && python2 configure.py p4vasp: p4vasp_config uninstallsh appletlist cd odpdom && $(MAKE) libODP.a cd src && $(MAKE) @@ -67,9 +67,9 @@ launcher: echo "#export APPMENU_DISPLAY_BOTH=1" >>$(P4V) echo "export UBUNTU_MENUPROXY=0" >>$(P4V) echo "export P4VASP_HOME="$(P4VASP_HOME) >> $(P4V) - echo "exec python "$(BINDIR)"/p4v.py \"\$$@\"" >>$(P4V) + echo "exec python2 "$(BINDIR)"/p4v.py \"\$$@\"" >>$(P4V) appletlist: - cd install && python makeappletlist.py + cd install && python2 makeappletlist.py bashrc:setenvironment echo "" >> ~/.bashrc cat $(SETENVIRONMENT) >> ~/.bashrc diff --git a/odpdom/Makefile.MacOS b/odpdom/Makefile.MacOS index 9863730..4af4166 100644 --- a/odpdom/Makefile.MacOS +++ b/odpdom/Makefile.MacOS @@ -9,7 +9,7 @@ FLAGS = -DPY_DOMEXC_MODULE="\"xml.dom.\"" # -DNO_POS_CACHE # -DNO_THROW -PYINCLUDE=`python -c "import sys;import os.path;print os.path.join(sys.prefix,\"include\",\"python\"+sys.version[:3])"` +PYINCLUDE=`python2 -c "import sys;import os.path;print os.path.join(sys.prefix,\"include\",\"python\"+sys.version[:3])"` CFLAGS += -fpic -g $(FLAGS) -I$(PYINCLUDE) -Iinclude SWIGFLAGS = -python -c++ $(FLAGS)