Skip to content

Commit

Permalink
update /compile-vasp-m1-mac post to sync with gist
Browse files Browse the repository at this point in the history
update deps, update oss.yml
  • Loading branch information
janosh committed Mar 30, 2024
1 parent 5519b7e commit 72c5eee
Show file tree
Hide file tree
Showing 9 changed files with 279 additions and 50 deletions.
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Expand Up @@ -13,7 +13,6 @@ repos:
- id: check-symlinks
- id: check-yaml
- id: destroyed-symlinks
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
Expand All @@ -37,7 +36,7 @@ repos:
args: [--ignore-words-list, 'ist,yau,te,manuel', --check-filenames]

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.0.0-beta.1
rev: v9.0.0-rc.0
hooks:
- id: eslint
types: [file]
Expand Down
18 changes: 9 additions & 9 deletions package.json
Expand Up @@ -29,10 +29,10 @@
"@iconify/svelte": "^3.1.6",
"@rollup/plugin-yaml": "^4.1.2",
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.5.1",
"@sveltejs/kit": "^2.5.5",
"@sveltejs/vite-plugin-svelte": "^3.0.2",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"devalue": "^4.3.2",
"elementari": "^0.2.3",
"eslint": "^8.57.0",
Expand All @@ -41,22 +41,22 @@
"hast-util-select": "^6.0.2",
"hastscript": "^9.0.0",
"js-yaml": "^4.1.0",
"katex": "^0.16.9",
"katex": "^0.16.10",
"mdsvex": "^0.11.0",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.1",
"prettier-plugin-svelte": "^3.2.2",
"rehype-autolink-headings": "^7.1.0",
"rehype-katex-svelte": "^1.2.0",
"rehype-slug": "^6.0.0",
"remark-math": "3.0.0",
"svelte": "^4.2.12",
"svelte-check": "^3.6.4",
"svelte-check": "^3.6.8",
"svelte-multiselect": "^10.2.0",
"svelte-preprocess": "^5.1.3",
"svelte-preprocess-import-assets": "^1.1.0",
"svelte-zoo": "^0.4.10",
"svelte2tsx": "^0.7.1",
"typescript": "^5.3.3",
"vite": "^5.1.4"
"svelte2tsx": "^0.7.5",
"typescript": "^5.4.3",
"vite": "^5.2.7"
}
}
46 changes: 23 additions & 23 deletions src/lib/oss.yml
Expand Up @@ -9,8 +9,8 @@ projects:
- Python
- Cython
- Jupyter Notebook
stars: 1266
commits: 948
stars: 1336
commits: 979
- name: Matbench Discovery
url: https://matbench-discovery.materialsproject.org
logo: https://janosh.github.io/matbench-discovery/favicon.svg
Expand All @@ -25,8 +25,8 @@ projects:
- TypeScript
- JavaScript
- HTML
stars: 57
commits: 315
stars: 66
commits: 318
- name: CHGNet
url: https://chgnet.lbl.gov
repo: https://github.com/CederGroupHub/chgnet
Expand All @@ -43,16 +43,16 @@ projects:
- HTML
- JavaScript
- TypeScript
stars: 174
commits: 169
stars: 184
commits: 175
- name: MACE
url: https://mace-docs.readthedocs.io
repo: https://github.com/ACEsuit/mace
role: Contributor
paper: riebesell_foundation_2023
description: Fast and accurate machine learning interatomic potentials with higher order equivariant message passing.
logo: https://avatars.githubusercontent.com/u/68508620
stars: 313
stars: 345
commits: 21
languages:
- Python
Expand All @@ -68,7 +68,7 @@ projects:
- Python
- JavaScript
- HTML
stars: 113
stars: 118
commits: 174
- name: pymatviz
url: https://pymatviz.janosh.dev
Expand All @@ -82,8 +82,8 @@ projects:
- TypeScript
- HTML
- JavaScript
stars: 104
commits: 237
stars: 111
commits: 242
- name: Tensorboard Reducer
repo: https://github.com/janosh/tensorboard-reducer
logo: https://raw.githubusercontent.com/janosh/tensorboard-reducer/main/assets/tensorboard-reducer-square.svg
Expand All @@ -92,15 +92,15 @@ projects:
languages:
- Python
- TeX
stars: 61
stars: 65
commits: 79
- name: Normalizing Flows
repo: https://github.com/janosh/awesome-normalizing-flows
logo: https://api.iconify.design/logos:awesome.svg?color=%23888888
description: Curated list of resources for learning and using normalizing flows, a powerful tool in ML for modeling probability distributions.
languages:
- Python
stars: 1265
stars: 1283
commits: 72
- name: atomate2
repo: https://github.com/materialsproject/atomate2
Expand All @@ -112,8 +112,8 @@ projects:
potential-powered structure relaxation workflows.
languages:
- Python
stars: 116
commits: 353
stars: 119
commits: 357
- name: jobflow
repo: https://github.com/materialsproject/jobflow
role: Maintainer
Expand All @@ -124,8 +124,8 @@ projects:
languages:
- Python
- TeX
stars: 81
commits: 100
stars: 83
commits: 115
- name: Aviary
repo: https://github.com/CompRhys/aviary
role: Maintainer
Expand All @@ -134,7 +134,7 @@ projects:
pypi: https://pypi.org/project/tensorboard-reducer
languages:
- Python
stars: 38
stars: 39
commits: 234
- name: MatCalc
url: https://materialsvirtuallab.github.io/matcalc
Expand All @@ -144,13 +144,13 @@ projects:
description: A Python library for calculating materials properties from ML force field potential energy surfaces.
languages:
- Python
stars: 40
commits: 68
stars: 41
commits: 72
- name: TikZ
url: https://tikz.janosh.dev
repo: https://github.com/janosh/tikz
description: Collection TikZ figures for concepts in physics/chemistry/ML.
stars: 170
stars: 174
commits: 187
languages:
- TeX
Expand All @@ -168,7 +168,7 @@ projects:
logo: https://github.com/janosh/tikz/raw/main/assets/plate-capacitor/plate-capacitor.svg
paper: riebesell_pushing_2024
stars: 7
commits: 12
commits: 14
languages:
- Python
- ReScript
Expand All @@ -183,5 +183,5 @@ projects:
- CSS
- HTML
- JavaScript
stars: 253
commits: 270
stars: 263
commits: 271
2 changes: 1 addition & 1 deletion src/routes/+page.svelte
Expand Up @@ -42,7 +42,7 @@
</address>

<p style="max-width: min(40em, 80vw); margin: auto;">
Interested in<br />
I'm interested in<br />
<a href={mbd?.repo}>🔎 computational materials discovery&emsp;</a>
<a href="https://arxiv.org/abs/2401.00096v1">🤖 machine learning</a><br />
<a href={pmg?.repo}>💻 software engineering&emsp;</a>
Expand Down
Expand Up @@ -2,7 +2,7 @@
title: Compile VASP on M1 Mac
date: 2022-03-28
cover:
img: compile-vasp-m1-mac.svg
img: compiling-vasp-m1-mac.svg
tags:
- Guide
- Fortran
Expand All @@ -12,48 +12,50 @@ tags:

> This post started out [as a gist](https://gist.github.com/janosh/a484f3842b600b60cd575440e99455c0). There's some Q&A there that may be useful.
**Courtesy of Alex Ganose [@utf](https://github.com/utf) with additions from yours truly [@janosh](https://github.com/janosh).**
**Written by Alex Ganose [@utf](https://github.com/utf) and Janosh Riebesell [@janosh](https://github.com/janosh). Last updated on 2024-03-30.**

1. Install Xcode command line tools
Follow these steps to compile VASP on an M1 Mac:

1. Install Xcode command line tools:

```sh
xcode-select --install
```

2. Install gcc, OpenMPI and OpenMP using homebrew
2. Install dependencies using Homebrew:

```sh
brew install gcc openmpi scalapack fftw qd openblas
```

Consider appending `hdf5` if you want to compile [VASP with HDF5 support][vasp-hdf5].
Optionally, add `hdf5` for [HDF5 support in VASP][vasp-hdf5].

3. Compile VASP
3. Compile VASP:

These instructions are for VASP 6.3.0; they should be transferable to other versions of VASP but the variable names may be different
These instructions are for VASP 6.4.1 but should work with minor adjustments for other versions.

```sh
cd /path/to/vasp-6.x.y
cp arch/makefile.include.gnu_omp makefile.include
```

Then edit `makefile.include` as follows:
Edit `makefile.include` in the VASP `src` directory:

- Add the following to CPP_OPTIONS:
- Add to `CPP_OPTIONS`:

```make
-D_OPENMP \
-Dqd_emulate
```

- Change all instances of `gcc` to `gcc-11` and `g++` to `g++-11`
- Change all instances of `gcc` to `gcc-13` and `g++` to `g++-13`

- Add the following lines after `LLIBS = -lstdc++`. This is necessary to emulate quad precision.
- Add after `LLIBS = -lstdc++` to emulate quad precision:

```make
QD ?= /opt/homebrew/
LLIBS += -L$(QD)/lib -lqdmod -lqd
INCS += -I$(QD)/include/qd
QD ?= /opt/homebrew/
LLIBS += -L$(QD)/lib -lqdmod -lqd
INCS += -I$(QD)/include/qd
```

- Set `SCALAPACK_ROOT ?= /opt/homebrew`
Expand All @@ -71,6 +73,45 @@ tags:
INCS += -I$(HDF5_ROOT)/include
```

- Append `getshmem.o` to `OBJECTS_LIB` in `makefile.include` ([VASP wiki](https://www.vasp.at/wiki/index.php/Shared_memory))

```diff
- OBJECTS_LIB = linpack_double.o
+ OBJECTS_LIB = linpack_double.o getshmem.o
```

- In `src/parser/makefile`, change (as noted by [@zhuligs](https://gist.github.com/janosh/a484f3842b600b60cd575440e99455c0?permalink_comment_id=4323518#gistcomment-4323518)):

```diff
- ar vq libparser.a $(CPPOBJ_PARS) $(COBJ_PARS) locproj.tab.h
+ ar vq libparser.a $(CPPOBJ_PARS) $(COBJ_PARS)
```

Do not replace the tab at the beginning of the line with spaces!

- In `src/lib/getshmem.c`, add the line `#define SHM_NORESERVE 0` ([VASP forum](https://www.vasp.at/forum/viewtopic.php?t=15106)):

```c
/*output: shmem id
*/
#define SHM_NORESERVE 0 // this line was added

void getshmem_C(size_t _size, int *_id)
```

- In `makefile.include`, update the parser section ([VASP forum](https://www.vasp.at/forum/viewtopic.php?f=2&t=17477)):

```diff
# For the parser library
CXX_PARS = g++-13
- LLIBS = -lstdc++
+ LIBS += parser
+ LLIBS = -Lparser -lparser -lstdc++
QD ?= /opt/homebrew
LLIBS += -L$(QD)/lib -lqdmod -lqd
INCS += -I$(QD)/include/qd
```

4. Finally, run:

```sh
Expand All @@ -81,9 +122,15 @@ tags:

> Fatal Error: `string.mod` not found
If successful, the VASP binaries will be in `src/bin`. Test with `make test`.

## Last Tested on 2024-03-30

Confirmed working with VASP 6.4.1 on M1 Pro with Sonoma 14.2.1 and `gcc@13.2.0`.

## Resulting `makefile.include` with all modifications

See `makefile.include` below.
See [`makefile.include`](https://gist.github.com/janosh/a484f3842b600b60cd575440e99455c0#file-makefile-include).

## Benchmarking

Expand Down

0 comments on commit 72c5eee

Please sign in to comment.