| 1 |
This version of c2x is intended to be built with spglib |
| 2 |
( https://github.com/atztogo/spglib/releases ), although it can be |
| 3 |
built without it. |
| 4 |
|
| 5 |
C2x should build straightforwardly with an ANSI C compiler on a |
| 6 |
POSIX-compliant system, including Cygwin and MSYS2, as well as MacOS X |
| 7 |
and most UNIXes. |
| 8 |
|
| 9 |
The build of c2x itself is controlled by its Makefile. This can be edited, |
| 10 |
and then one simply types "make" and the result should be an |
| 11 |
executable in the current directory. |
| 12 |
|
| 13 |
There are three options for spglib |
| 14 |
|
| 15 |
1/ Compile without it. Not really recommended, as c2x will lose |
| 16 |
some functionality. For this simply do not define SPGLIB in the |
| 17 |
makefile (i.e. comment out references to "-DSPGLIB"). |
| 18 |
|
| 19 |
2/ Use a pre-installed system spglib. It should not be necessary to |
| 20 |
set CPPFLAGS and LDFLAGS, for presumably the relevant header files and |
| 21 |
library files will be found automatically. However, if spglib has been |
| 22 |
built with OpenMP support, Windows users may need to add -fopenmp or |
| 23 |
similar to LDFLAGS. |
| 24 |
|
| 25 |
3/ Download and compile your own version of SPGLIB. This is how c2x is |
| 26 |
developed. In this case one needs to build a static version of the |
| 27 |
spglib library. Further notes on compiling spglib can be found at the |
| 28 |
end of this file. |
| 29 |
|
| 30 |
The only two files from spglib that c2x needs to build are |
| 31 |
spglib.h and libsymspg.a. One approach is to copy them from the spglib |
| 32 |
build tree to the c2x build tree (they are probably found as |
| 33 |
src/spglib.h and src/.libs/libsymspg.a after building spglib), and |
| 34 |
then set |
| 35 |
|
| 36 |
CPPFLAGS=-I. |
| 37 |
LDFLAGS=-L. |
| 38 |
|
| 39 |
otherwise replace the above two dots with the path to the directory |
| 40 |
containing the include file and the library respectively. |
| 41 |
|
| 42 |
If one wishes to validate one's build of c2x, a basic test suite is |
| 43 |
available at www.c2x.org.uk/downloads . |
| 44 |
|
| 45 |
MJR 1/2017, 2/2019, 12/2022 |
| 46 |
|
| 47 |
|
| 48 |
Further notes on compiling spglib 2.0 |
| 49 |
===================================== |
| 50 |
|
| 51 |
Download the version 2.0.2 with |
| 52 |
|
| 53 |
curl -o spglib.zip -L https://github.com/spglib/spglib/archive/refs/tags/v2.0.2.zip |
| 54 |
|
| 55 |
Unpack archive with |
| 56 |
|
| 57 |
unzip spglib.zip |
| 58 |
|
| 59 |
and change to its directory |
| 60 |
|
| 61 |
cd spglib-2.0.2 |
| 62 |
|
| 63 |
If you have cmake, consider the instructions at |
| 64 |
https://spglib.github.io/spglib/install.html |
| 65 |
|
| 66 |
If you don't, or if you don't like cmake, then the following may work. |
| 67 |
|
| 68 |
cd src |
| 69 |
cp [c2x build directory]/Makefile.spglib Makefile |
| 70 |
[if using spglib before 2.0, comment out MORE_OBJS lines as appropriate] |
| 71 |
make |
| 72 |
cp spglib.h libsymspg.a [c2x build directory] |
| 73 |
|
| 74 |
If one uses the cmake method, spglib will be built with OpenMP |
| 75 |
support, and then, for static linking, -fopenmp should be added to |
| 76 |
LDFLAGS in the c2x Makefile. |
| 77 |
|
| 78 |
Versions of spglib after 2.0.2 use an autogenerated version.h file, |
| 79 |
which requires the use of cmake. So if using cmake one can download |
| 80 |
more recent versions of spglib, such as 2.5.0. |