This thread is locked.Only browsing is available.
Top Page > Browsing
unable to make VPS for C with adpack (segmentation fault) [CONFIRMED]
Date: 2017/06/25 19:28
Name: Chris Latham


Using the input taken from the VPS file for C on the OpenMX website,

I am unable to reproduce the result: Adpack (2.2) fails with a segmentation fault after writing the line,

<ALL> Eeigen = -21.305032386138 (Hartree)

I have tried building the adpack binary with lower optimization levels; I have tried using a different lapack library; I have tried changing the parameters in the input file, and all fail the same way. However, the test input file C.inp provided with the distribution does work, and reproduces the result exactly as in the manual.

Please could some kind person suggest what I may be doing wrong, and how to fix it.

Thank you,

Dr. Christopher D. Latham.
Page: [1]

Re: unable to make VPS for C with adpack (segmentation fault) ( No.1 )
Date: 2017/06/24 17:39
Name: T. Ozaki


Since you explained as

> However, the test input file C.inp provided with the distribution does work,
> and reproduces the result exactly as in the manual.

the problem should be attributed to your input file.
Could you show us how you changed parameters?


Re: unable to make VPS for C with adpack (segmentation fault) ( No.2 )
Date: 2017/06/24 20:29
Name: Chris Latham


The details are as follows.

1. Download adpack 2.2 from and compile it with gcc on Ubuntu 16.04 [gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609] as per instructions on page 3 in the adpack pdf manual. My preferred lapack happens to be the one provided by the stock openblas in Ubuntu 16.04, but the result is the same with gcc 4.8 and other lapack libs I tried. Lowering the optimization level to -O2 also does not affect the outcome in what follows.

2. Do the test calculation described on page 4 of the adpack pdf manual, using the file C.inp from the work directory, as provided with the adpack 2.2 tar file, with no alterations. Except for the last decimal place, the output is the same as is shown on page 4 in the manual, including the part quoted from the generated file C0.alog.

3. Next, copy the input part of the file verbatim from, i.e.

# File Name

System.CurrrentDir ./ # default=./
System.Name C_CA13
Log.print off # ON|OFF


maxL.pao 4 # default=2
num.pao 20 # default=7
radial.cutoff.pao 6.0 # default=5.0 (Bohr)
height.of.wall 20000.0 # default=4000.0 (Hartree)
rising.edge 0.2 # default=0.5(Bohr),r1=rc-rising.edge
search.LowerE -3.000 # default=-3.000 (Hartree)
search.UpperE 70.000 # default=20.000 (Hartree)
num.of.partition 2000 # default=300
matching.point.ratio 0.77 # default=0.67

4. Search and replace "ocupied" which has one letter 'c' missing with "occupied" and save the file with a convenient name, e.g. "test.inp". Obviously, adpack will not work unless this mistake is corrected. The corrected part is as follows:


AtomSpecies 6
max.occupied.N 2
total.electron 6.0
valence.electron 4.0
1 2.0
2 2.0 2.0


5. Run adpack with the input file, as previously described. The result is as follows (the middle part of the SCF results are omitted for the sake of brevity):

The number of threads in each node for OpenMP parallelization is 1.

Welcome to ADPACK
Copyright (C), 2002-2007, T.Ozaki
This is a free software, and you are welcome to
redistribute it under the constitution of the GNU-GPL.

save results to ./C_CA13 after this calculation
<ALL> SCF= 1 Eeigen= -31.161699175060 NormRD= 9.811778640421
<ALL> SCF= 2 Eeigen= -31.269166501236 NormRD= 9.751821343080
<ALL> SCF= 3 Eeigen= -29.304786141702 NormRD= 6.460405281563
<ALL> SCF= 4 Eeigen= -24.368475336338 NormRD= 1.356457881497
<ALL> SCF= 47 Eeigen= -21.305053714968 NormRD= 0.000000000021
<ALL> SCF= 48 Eeigen= -21.305053675606 NormRD= 0.000000000021
<ALL> SCF= 49 Eeigen= -21.305053636317 NormRD= 0.000000000021
<ALL> **** Energies of atom ****
<ALL> Ekin = 37.234751187368 (Hartree)
<ALL> EHart = 17.633159350516 (Hartree)
<ALL> Exc = -4.729695659366 (Hartree)
<ALL> Eec = -87.578645149657 (Hartree)
<ALL> Etot = -37.440430271139 (Hartree)
<ALL> Eeigen = -21.305053597101 (Hartree)

Segmentation fault (core dumped)

So, the only change in the first instance it to fix the mistake in "occupied". SCF convergence is much cleaner and faster using scf.Mixing.Type = GR-Pulay, but the final outcome remains "Segmentation fault (core dumped)". I also tried maxL.pao = 3, num.pao = 15, and num.of.partition = 4000, but none of these changed the result. I think I tried all three eq.type options, and both LDA and GGA for xc.type as well, but without success.

Thank you and kind regards,

Re: unable to make VPS for C with adpack (segmentation fault) ( No.3 )
Date: 2017/06/24 22:14
Name: T. Ozaki


Thank you for your detailed explanation.
I performed exactly the same procedure, and found no problem.
As you can confirm, the largest difference between "C.inp" and "test.inp"
is that pseudopotential is generated by "test.inp", while "C.inp" is for only
all-electron calculation.

I guess that the problem might be machine or compiler dependent.
My settings for CC and LIB are as follows:

CC = cc -Dnoomp -std=c99 -O3 -I/home/ozaki/include -I/home/ozaki/ACML5.3.0/ifort64_mp/include
LIB = -L/home/ozaki/ACML5.3.0/ifort64_mp/lib -lacml_mp -Wl,-rpath=/home/ozaki/ACML5.3.0/ifort64_mp/lib -Wl,-rpath=/home/ozaki/ACML5.3.0/ifort64_mp/lib

I am always using gcc version 4.1.2 20080704 (Red Hat 4.1.2-52) on Intel(R) Xeon(R) CPU E5-2670
when I generate PP and VPS.

I hope that the information would be helpful.


Re: unable to make VPS for C with adpack (segmentation fault) ( No.4 )
Date: 2017/06/24 23:58
Name: Chris Latham

Greetings all,

The nearest I can get to your configuration, Taisuke, is gcc 4.4 and acml 5.3.1, but that ought to be near enough. So, using the following in my makefile,

# [...]

CC = /usr/bin/gcc-4.4 -Dnoomp -std=c99 -O3 \
LIB= -L/opt/acml/5.3.1/gfortran64_mp_int64/lib -lacml_mp \
-Wl,-rpath=/opt/acml/5.3.1/gfortran64_mp_int64/lib \



# [...]

the result is exactly the same as I reported previously, namely "Segmentation fault (core dumped)". The gcc 5.4.0 yields the same result with acml 5.3.1, but there are many more warnings when compiling. (The same is true for OpenMX as well - there are masses of warnings with the gcc 5.4.)

About C.inp, I worked through all the examples given in the adpack pdf manual, and all were successful, giving exactly the same results as shown in the manual.

The machine I used for this test is an old Intel Core i5 760 with 12 GB memory, which also happens to have the acml on it, and old versions of the gcc, because it is old. However, the acml is now no longer supported. We do have a new Intel Xeon E5-2680v4 server that I could try, which also running Ubuntu 16.04, but I doubt that this will change the result, and it does not have any of the legacy packages because it is new.

Thank you and best wishes,

Re: unable to make VPS for C with adpack (segmentation fault) ( No.5 )
Date: 2017/06/25 17:29
Name: T. Ozaki


Starting from "C.inp" and modifying two parameters as

calc.type vps
vps.typ MBK

can you reproduce a similar segmentation fault?

If you encounter the same problem, at this moment
I may not be able to help you.


Re: unable to make VPS for C with adpack (segmentation fault) [CONFIRMED] ( No.6 )
Date: 2017/06/25 19:27
Name: Chris Latham

Hello Taisuke, et al.,

Starting from "C.inp" provided with the adpack 2.2 tar file, I find the following.

1. Change calc.type from all to vps *only*, and leaving vps.type as TM, works correctly, and generates some files "C0.*".

2. Change vps.typ from TM to MBK *only*, and leaving calc.type as all, works correctly, and generates some files "C0.*".

3. Change *both* calc.type from all to vps and vps.typ from TM to MBK only, fails with "Segmentation fault (core dumped)".

For each test, I started from the original state by removing any new files "C0.*" that were generated previously. I hope this helps to identify exactly what the problem is. I think it is fair now to change the status of this thread to [CONFIRMED].

Many thanks for your help,

Re: unable to make VPS for C with adpack (segmentation fault) [CONFIRMED] ( No.7 )
Date: 2017/06/27 14:23
Name: T. Ozaki


Your series of calculations imply that a routine "MBK.c" gets in trouble in your computational environment.

Sorry for your inconvenience.


Re: unable to make VPS for C with adpack (segmentation fault) [CONFIRMED] ( No.8 )
Date: 2017/06/28 00:19
Name: Chris Latham

Greetings All,

A possible difference between the system that you are using, Taisuke, and mine (Ubuntu 16.04 and gcc 5.4) is that the gcc option -fstack-protector-strong is now always used to reduce the risk of buffer overruns. This can be demonstrated by making adpack with the following options:

CC = gcc -Dnoomp -g -std=c99 -O1 -fstack-protector-strong -fsanitize=address -ggdb
LDFLAGS = -fsanitize=address -ggdb -llapack -lm

A stack overflow occurs when adpack.c calls MBK.c, as follows:

==16211==ERROR: AddressSanitizer: stack-overflow on address 0x7ffe9d799cc4 (pc 0x0000004217fc bp 0x000000000001 sp 0x7ffe9d799bf0 T0)
#0 0x4217fb in MBK /home/[...]/adpack/2.2/source/MBK.c:93
#1 0x401e77 in main /home/[...]/adpack/2.2/source/adpack.c:142
#2 0x7f14d1bc182f in __libc_start_main (/lib/x86_64-linux-gnu/
#3 0x401a78 in _start (/home/[...]/adpack/2.2/source/adpack+0x401a78)

SUMMARY: AddressSanitizer: stack-overflow /home/[...]/adpack/2.2/source/MBK.c:93 MBK

To check on the details, I replaced lines 125-128 after the call to Init_VPS() in adpack.c with a switch statement that has an emergency stop at the end, just in case something horrible happens:

switch(VPP_switch) {
case 0:
case 1:
case 2:
case 5:
fprintf(stderr,"Calling MBK...\n");
fprintf(stderr,"Unsupported pseudopotential type (%i).\n",VPP_switch);

Then, in MBK.c, immediately after the comment /* allocation of arrays */ at line 120, I inserted

fprintf(stderr,"Allocating memory in MBK...\n");

as the first executable line. With these two alterations, I can confirm that the stack overflow and consequent segmentation fault occurs after successfully writing the message "Calling MBK...\n" in adpack.c, and before it reaches the first executable line in MBK.c. The message that I put in MBK.c is not output.

Thank you and best wishes,

Re: unable to make VPS for C with adpack (segmentation fault) [CONFIRMED] ( No.9 )
Date: 2017/07/01 07:24
Name: T. Ozaki

Dear Christopher,

Thank you very much for your detailed report again.
I repeated the same calculations on three machines specified with

Intel(R) Xeon(R) CPU E5-2670
Red Hat 4.1.2-52
gcc version 4.1.2 20080704

Intel(R) Xeon(R) CPU E5-2690 v4
Red Hat 4.4.7-17
gcc version 4.4.7 20120313

Intel(R) Xeon(R) CPU E5-2603 v3
Red Hat 4.8.3-9
gcc version 4.8.5 20150623

and found that there is no problem in my environment.

Though I agree with you that there might be problems in the code, I would like to
postpone the problem at this moment, since I cannot reproduce it.

Thank you for your understanding and sorry for your inconvenience.


Re: unable to make VPS for C with adpack (segmentation fault) [CONFIRMED] ( No.10 )
Date: 2017/07/03 01:16
Name: Daniil

Hello all,

I tried to calculate example inputs Ca_PAO.inp and Ca_VPS.inp, and I get the same problem:
<ALL> SCF= 59 Eeigen= -404.255095180853 NormRD= 0.000000000006
<ALL> **** Energies of atom ****
<ALL> Ekin = 685.028230012996 (Hartree)
<ALL> EHart = 286.488830060662 (Hartree)
<ALL> Exc = -35.970012257878 (Hartree)
<ALL> Eec = -1615.803568024892 (Hartree)
<ALL> Etot = -680.256520209113 (Hartree)
<ALL> Eeigen = -404.255095240071 (Hartree)

mpirun noticed that process rank 1 with PID 17569 on node xeon2 exited on signal 11 (Segmentation fault).

My makefile parameters are:
CC = mpicc -O3 -fopenmp -I/usr/lib64/mpi/gcc/openmpi/include/
LIB = -L/usr/local/lib -lfftw3 -llapack -lblas -lgfortran -lmpi_f77 -lmpi_f90


Distro: openSUSE 12.2 (Mantis) (x86_64)

Best regards,

Page: [1]