Multiwfn forum

Multiwfn official website: //www.umsyar.com/multiwfn. Multiwfn forum in Chinese: http://bbs.keinsci.com/wfn

You are not logged in.

#12023-03-24 12:34:13

mverissi
Member
Registered: 2022-02-19
Posts: 6

Compilation of Multiwfn for Mac with Apple Silicon chips

Hi all,

This isn't really a question, but something to help people who are using Macs with Apple Silicon chips. I have been using one lately and I wanted to perform some test calculations outside the cluster where I will run heavier stuff. Since the GUI depends on Motif and I couldn't find either Motif or the executable without the GUI for Mac, I set out to compile it myself. So I thought I could contribute with a very brief guide that worked for compiling the no GUI version of Multiwfn on my MacBook Air with M2 chip.

1) Download the latest Intel compiler for Mac athttps://www.intel.com/content/www/us/en … ml#fortran- without it, you'll need to “get your hands dirty” with changing some of the code. My Fortran skills are only good enough to write simple code, so after having to change 10 lines of code and still getting errors from gfortran, I decided that downloading and installing ifort was a wiser choice.

I downloaded the online installer mistakenly (26 KB; there's a link for downloading the offline installer, 96 MB), but it worked fine for me. Double click on the dmg and drag the installer file to the applications folder, then start it. After the installation, add the line

source /opt/intel/oneapi/setvars.sh

to .zshrc and source the .zshrc file.

2) Unzip the Multiwfn_3.7_src_Mac.zip file and enter the directory. Before anything, edit the Makefile_noGUI file. In the “OPT = (...)" line, change the -openmp and -openmp-link=static options to -qopenmp and -qopenmp-link=static, which are the corresponding ifort options in the latest versions. For a first compilation, keep the libreta_slow module. On my MacBook Air, the compilation with libreta_fast took over two hours to complete using 8 cores.

3) For the no GUI compilation, there's a bash script called “noGUI.sh”. Set it to executable with

chmod +x noGUI.sh

and execute it. It will create a noGUI directory; enter it and type make -j8. With the libreta_slow module, the compilation took less than 10 minutes to complete.

4) Edit your .zshrc file and add the line

export KMP_STACKSIZE=64000000

Source your .zshrc with

source ˜/.zshrc

5) Section 2.1.3 of the manual says we should set

kern.sysv.shmmax = 512000000

in the /etc/sysctl.conf file. I couldn't find it, so I created one (you'll need sudo for this) and added the line above, but without spaces:

kern.sysv.shmmax=512000000

This is because when I tried setting it through the command line (sudo sysctl kern.sysv.shmmax = 512000000), it didn't work. When I issued the command without the spaces (sudo sysctl kern.sysv.shmmax=512000000), it worked fine. However, setting it through the command line will only work for your current session and will require sudo every time; if you reboot the system, this setting will be lost.

6) The file settings.ini is not included in Multiwfn_3.7_src_Mac.zip . The workaround is to download Multiwfn_3.7_bin_Mac.zip, unzip it and copy the settings.ini file to the Multiwfn_3.7_src_Mac/noGUI directory.

7) When you compile the no GUI version, no libdislin_d.11.dylib is created. At that point, I decided to test if Multiwfn had compiled correctly simply by executing it. It appears to be fine, but I didn't run any real tests; the executable just starts without errors.

8) Setting the Multiwfnpath environment variable can be done as explained in section 2.1.2 of the manual.

I hope this will help people who work on Macs to compile Multiwfn and use it. I would very much rather use a Linux system instead but, while my Linux computer isn't repaired, I'll have to work on the Mac.

If Prof Lu finds this worth of inclusion in the Multiwfn manual, I can update this after having performed a few tests. So far, I have converted a file in molden format to Gaussian wfx without crashes.

Best regards,

Marcos

Universidade Federal Fluminense, Volta Redonda, Brazil / Lund University, Lund, Sweden (until September 2024)

Last edited by mverissi (2023-03-24 13:09:01)

Offline

#22023-03-24 19:43:32

sobereva
Tian Lu (Multiwfn developer)
From: Beijing
Registered: 2017-09-11
Posts: 1,777
Website

Re: Compilation of Multiwfn for Mac with Apple Silicon chips

Very nice. I will add link of this post in Section 2.1.3 of Multiwfn manual.

Offline

Board footer

Baidu
map