How to compile LAMMPS with polymlp on macOS (arm) with conda-forge compilers

conda create -n lammps
conda activate lammps
conda install compilers tree

Supposed directory structure:

% tree lammps lammps-polymlp-package -d -L 1 
├── bench
├── cmake
├── doc
├── examples
├── fortran
├── lib
├── potentials
├── python
├── src
├── tools
└── unittest
├── lib
└── src

Go to LAMMPS source code directory (lammps). In the following of this post, shell commands are performed with respect to this directory.

Copy source code of polymlp in LAMMPS source code directory.

% cp -r ../lammps-polymlp-package/lib/polymlp lib/
% cp -r ../lammps-polymlp-package/src/POLYMLP src/

Add polymlp to the list of PACKAGE in src/Makefile

cat src/Makefile
        adios \
        amoeba \
        poems \
        polymlp \
        ptm \
        ml-iap \

Modify lib/polymlp/Makefile.lammps

% cat lib/polymlp/Makefile.lammps
polymlp_INC = -fopenmp -DLAMMPS_EXCEPTIONS
polymlp_PATH = -L../../lib/polymlp
polymlp_SYSINC = -I${CONDA_PREFIX}/include
polymlp_SYSLIB = -L${CONDA_PREFIX}/lib -lomp

Copy a specific Makefile for setting conda environment.

% cp src/MAKE/Makefile.serial src/MAKE/Makefile.conda

Modify src/MAKE/Makefile.conda

% cat src/MAKE/Makefile.conda
CC =            ${CONDA_PREFIX}/bin/clang++
CCFLAGS =       -g -O3 -std=c++11
SHFLAGS =       -fPIC
DEPFLAGS =      -M

LINK =          ${CONDA_PREFIX}/bin/clang++
LINKFLAGS =     -g -O3 -std=c++11
SIZE =          size

ARCHIVE =       ${CONDA_PREFIX}/bin/ar
ARFLAGS =       -rc
SHLIBFLAGS =    -shared -rdynamic

Make LAMMPS with polymlp

% ulimit -s unlimited
% cd src
% make yes-polymlp 
% make ps
% make mpi-stubs
% make conda

Executable lmp_conda is created in src directory. Note that the compilation of polymlp_gtinv_data.cpp requires large stacksize, so before compilation, ulimit -s unlimite may be executed.

At run time,


is required. It is convenient if this environment variable is written in $CONDA_PREFIX/etc/conda/activate.d/

Precomputed polymlp data for elements are found at

LAMMPS crystal structure relaxation

Quite many options exist in LAMMPS, and I googled to find how to optimize crystal structure.

LAMMPSで格子変形を許して構造緩和をする - lan496の日記

It seems no fix command results in relaxation of internal atomic positions only...

Pymatgen can handle LAMMPS input/output files. module — pymatgen 2023.5.10 documentation

Upgrade conda-forge postgresql from 14 to 15

Assume having old postgresql (v14) db directory exists at


Upgrade postgresql (14 -> 15) of the current conda env (myproj)

Create a new conda env (psql) with old postgresql (14).

initdb -D /home/username/myproj/psql15
cp /home/username/myproj/psql/pg_hba.conf /home/username/myproj/psql15/
cp /home/username/myproj/psql/postgresql.conf /home/username/myproj/psql15/
pg_upgrade --old-datadir=/home/username/myproj/psql --new-datadir=/home/username/myproj/psql15 --old-bindir=/home/username/.miniforge/envs/psql/bin --new-bindir=/home/username/.miniforge/envs/myproj/bin --old-options '-c config_file=/home/username/myproj/psql/postgresql.conf' --new-options '-c config_file=/home/username/myproj/psql15/postgresql.conf' --check

If all OK, remove --check and rerun the above again.

mv /home/username/myproj/psql /home/username/myproj/psql14
ln -s /home/username/myproj/psql15 /home/username/myproj/psql

Ganglia web frontend

Ubuntu 22.04ではPHPのバージョンアップが理由でGanglia web frontendが動かない。MonitorとGmetadは動く。Ganglia web frontendのためにUbuntu 20.04のVM(KVM)を用意して設定を行った。

# cat sites-enabled/ganglia.conf
Alias /ganglia /usr/share/ganglia-webfrontend

<Directory "/usr/share/ganglia-webfrontend">
    AllowOverride All
    Order allow,deny
    Allow from all
    Deny from none


$conf['default_metric'] = "cpu_report";

バグフィックス( /usr/share/ganglia-webfrontend/cluster_view.php

  $context_metrics = array();


data_source "mycluster" 60

クラスタ側ではgmetadとgmondが走っていてrrdが蓄積される。VMからクラスタにアクセスしてVM上でganglia web frontendを使う。


data_source "my_cluster" 60


ufw allow from


ssh -L mycluster