Skip to content

Commit 603fb71

Browse files
committed
add apps, python packages, tests, sample input files, etc.
1 parent ad55029 commit 603fb71

157 files changed

Lines changed: 29516 additions & 747 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Compiled Object files
2+
*.slo
3+
*.lo
4+
*.o
5+
*.os
6+
7+
# Compiled Dynamic libraries
8+
*.so
9+
*.dylib
10+
*.ii
11+
*.s
12+
13+
# Compiled Static libraries
14+
*.lai
15+
*.la
16+
*.a
17+
*.d
18+
19+
# Temporary backups
20+
*~
21+
*.orig
22+
[#]*[#]
23+
24+
# Mac files
25+
.DS_Store
26+
27+
# Custom stylize scripts
28+
my_stylize.sh
29+
stylized.sh
30+
my_style
31+
sedme.sh
32+
.is_stylized.txt
33+
34+
# Python
35+
*.pyc
36+
37+
#vim sessions
38+
*.vim
39+
*.local
40+
.*.swp
41+
.ycm_extra_conf.py
42+
.ycm_extra_conf.pyc
43+
types_c.taghl
44+
45+
#ctags
46+
tags
47+
*.taghl
48+
49+
#stuff in src/general that isn't good enough to share
50+
src/general/occucounter
51+
src/general/phononbox
52+
src/general/populator
53+
54+
#scons
55+
.sconsign.dblite
56+
57+
#binaries
58+
bin/*

INSTALL.md

Lines changed: 309 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,309 @@
1+
2+
## Dependencies
3+
4+
### Compilation ###
5+
6+
**C++11**
7+
8+
CASM must be compiled with a compiler that supports the C++11 standard.
9+
10+
**If using Mac OS X - Xcode command-line tools**
11+
12+
On OS X it may be necessary to have the Xcode command line tools installed. To install, run ``xcode-select --install`` from the Terminal.
13+
14+
### SCons
15+
16+
CASM is built using SCons. SCons is available through many package managers, or can be downloaded from the SCons website: [http://www.scons.org](http://www.scons.org).
17+
18+
**Mac OS X**
19+
20+
Using Macports:
21+
22+
``
23+
sudo port install scons
24+
``
25+
26+
or using Homebrew:
27+
28+
``
29+
brew install scons
30+
``
31+
32+
**Linux Ubuntu**
33+
34+
Install SCons with:
35+
36+
``
37+
sudo apt-get install scons
38+
``
39+
40+
**From the SCons website**
41+
42+
Scons can be downloaded and installed from source following instructions found at the Scons website: [http://www.scons.org/doc/2.3.0/HTML/scons-user/x167.html](http://www.scons.org/doc/2.3.0/HTML/scons-user/x167.html).
43+
44+
45+
### Boost
46+
47+
CASM uses several Boost libraries, which are often available installed on many computing clusters. you can install Boost yourself via a package management tool, or by downloading from the Boost website: [http://www.boost.org](http://www.boost.org). CASM uses the system, filesystem, program_options, and unit_test_framework libraries, and their dependencies. Most CASM testing has been performed with Boost version 1.54 or later.
48+
49+
*Important: Boost should be compiled using the same compiler that you will use to compile CASM.*
50+
51+
**Mac OS X**
52+
Using Macports:
53+
54+
``
55+
sudo port install boost
56+
``
57+
58+
or using Homebrew:
59+
60+
``
61+
brew install boost
62+
``
63+
64+
**Linux Ubuntu**
65+
66+
Install Boost with:
67+
68+
``
69+
sudo apt-get install libboost-all-dev
70+
``
71+
72+
**From the Boost website**
73+
74+
Boost can be downloaded and installed from source following instructions found at the Boost website: [http://www.boost.org/users/download/](http://www.boost.org/users/download/).
75+
76+
77+
### Python
78+
79+
CASM includes python modules for automating the submission and analysis of VASP calculations. They have been most extensively tested using Python 2.7.5, and should be compatible with versions 2.x+. (*Note however that for recent versions of SCons, support for Python versions before 2.7 has been deprecated.*) The latest version can be obtained from the Python website: [https://www.python.org](https://www.python.org)
80+
81+
**NumPy**
82+
83+
Individual module dependencies include NumPy ([http://www.numpy.org](http://www.numpy.org)), which can be obtained by installing SciPy using one of the methods described on their website: [http://www.scipy.org/install.html](http://www.scipy.org/install.html).
84+
85+
**pbs**
86+
87+
The Python module pbs is used to automate submission and management of PBS batch jobs on a cluster. It can be obtained from its GitHub repository: [https://github.com/prisms-center/pbs](https://github.com/prisms-center/pbs).
88+
89+
90+
### Included with CASM
91+
92+
CASM is distributed with the following dependencies:
93+
94+
- **Eigen, v3.1.3**: [http://eigen.tuxfamily.org](http://eigen.tuxfamily.org)
95+
96+
- **JSON Spirit, v4.06**: [http://www.codeproject.com/Articles/20027/JSON-Spirit-A-C-JSON-Parser-Generator-Implemented](http://www.codeproject.com/Articles/20027/JSON-Spirit-A-C-JSON-Parser-Generator-Implemented)
97+
98+
- **Mersenne Twister random number generator -- a C++ class MTRand, v1.1**, 28 September 2009, by Richard J. Wagner, wagnerr@umich.edu, based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus. For more information, see the inventors' web page at [http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html](http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html).
99+
100+
101+
## Installation
102+
103+
#### Getting CASM
104+
105+
There are two options for downloading CASM:
106+
107+
1. Fork and clone the repository
108+
- Use this option if you think you may contribute bug fixes or new features
109+
- The CASM repository is located at: [https://github.com/prisms-center/CASMcode](https://github.com/prisms-center/CASMcode).
110+
- For help see: [https://help.github.com/articles/fork-a-repo/](https://help.github.com/articles/fork-a-repo/).
111+
112+
2. Download as archive
113+
- Use this option if you do not plan on contributing bug fixes or new features
114+
- CASM can be downloaded as a .zip or .tar.gz archive from: [https://github.com/prisms-center/CASMcode/releases](https://github.com/prisms-center/CASMcode/releases)
115+
116+
#### Configuration
117+
CASM is built using SCons, but some configuration of environment variables may be necessary first. Help can be obtained via:
118+
119+
scons -h
120+
121+
and is also reproduced here:
122+
123+
Type: 'scons' to build all binaries,
124+
'scons install' to install all libraries, binaries, scripts and python packages,
125+
'scons test' to run all tests,
126+
'scons unit' to run all unit tests,
127+
'scons A_UNIT_TEST' to run a particular unit test (where A_UNIT_TEST
128+
is replaced with the name of the particular unit test,
129+
typically a class name),
130+
'scons casm_test' to run tests/casm.
131+
132+
In all cases, add '-c' to perform a clean up or uninstall.
133+
134+
Default compile options are: '-O3 -DNDEBUG -Wno-unused-parameter'
135+
136+
137+
Recognized environment variables:
138+
139+
$CXX:
140+
Explicitly set the C++ compiler. If not set, scons chooses a default compiler.
141+
142+
$CASMPREFIX:
143+
Where to install CASM. By default, this uses '/usr/local'. Then header files are
144+
installed in '$CASMPREFIX/include', shared libraries in '$CASMPREFIX/lib', executables
145+
in '$CASMPREFIX/bin', and the path is used for the setup.py --prefix option for
146+
installing python packages.
147+
148+
$CASMBOOST_PATH:
149+
Search path for Boost. '$CASMBOOST_PATH/include' is searched for header files, and
150+
'$CASMBOOST_PATH/lib' for libraries. Boost and CASM should be compiled with the
151+
same compiler.
152+
153+
$OPTIMIZATIONLEVEL:
154+
Sets the -O optimization compiler option. If not set, uses -O3.
155+
156+
$DEBUGSTATE:
157+
Sets to compile with debugging symbols. In this case, the optimization level gets
158+
set to -O0, and NDEBUG does not get set.
159+
160+
$LD_LIBRARY_PATH:
161+
Search path for dynamic libraries, may need $CASMBOOST_PATH/lib
162+
and $CASMPREFIX/lib added to it.
163+
On Mac OS X, this variable is $DYLD_FALLBACK_LIBRARY_PATH.
164+
This should be added to your ~/.bash_profile (Linux) or ~/.profile (Mac).
165+
166+
167+
Additional options that override environment variables:
168+
169+
Use 'cxx=X' to set the C++ compiler. Default is chosen by scons.
170+
'opt=X' to set optimization level, '-OX'. Default is 3.
171+
'debug=X' with X=0 to use '-DNDEBUG',
172+
or with X=1 to set debug mode compiler options '-O0 -g -save-temps'.
173+
Overrides $DEBUGSTATE.
174+
'prefix=X' to set installation directory. Default is '/usr/local'.
175+
Overrides $CASMPREFIX.
176+
'boost_path=X' set boost search path. Overrides $CASMBOOST_PATH.
177+
178+
179+
180+
For example, on a cluster where Boost is installed in a shared directory ``/home/software/rhel6/boost/1.54.0-gcc-4.7.0`` (*Important: Boost and CASM should be compiled with the same compiler.*), and your executables and Python modules are stored in your userspace at ``$HOME/software``, you could add the following to the ``.bash_profile`` file in your home directory:
181+
182+
export CASMBOOST_PATH=/home/software/rhel6/boost/1.54.0-gcc-4.7.0
183+
export CASMPREFIX=$HOME/software
184+
export PATH=$PATH:$CASMPREFIX/bin
185+
export CPATH=$CPATH:$CASMPREFIX/include
186+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CASMPREFIX/lib
187+
188+
and then run ``source $HOME/.bash_profile`` for these changes to take effect. These commands to set environment variables could also be run from the command line, in which case the environment variables only persist until your terminal session is closed. *Note: On Mac OS X, use ``DYLD_FALLBACK_LIBRARY_PATH`` instead of ``LD_LIBRARY_PATH``.*
189+
190+
#### Build and install
191+
192+
193+
Once any necessary environment variables are set, you are ready to build and install. Move to the directory in which the CASM source resides and run ``scons install``:
194+
195+
cd /path/to/CASM
196+
scons install
197+
198+
*Note: Use 'scons install -j N', where N is number of jobs, to enable multi-threaded compilation. This can make a nice difference.*
199+
200+
This will compile and install:
201+
202+
- ``$CASMPREFIX/bin/casm`` the primary CASM program
203+
- ``$CASMPREFIX/bin/eci_search`` a program for fitting effective cluster interactions (ECI)
204+
- ``$CASMPREFIX/bin/vasp.setup`` a script for setting up VASP jobs
205+
- ``$CASMPREFIX/bin/vasp.relax`` a script for setting up and submitting VASP jobs
206+
- ``$CASMPREFIX/bin/kpoint_converge`` a script for performing k-point convergence
207+
- ``$CASMPREFIX/include/casm/`` headers files for ``libcasm``
208+
- ``$CASMPREFIX/lib/libcasm.so`` a shared library containing much of the implementation. May be ``libcasm.dylib`` on Mac OS X.
209+
- ``$CASMPREFIX/lib/pythonX.Y/site-packages/casm`` a python package that provides an interface between ``casm`` and the software used to calculate training data. Currently only VASP is supported.
210+
- ``$CASMPREFIX/lib/pythonX.Y/site-packages/vasp`` a python package for running VASP calculations.
211+
212+
213+
#### Checking installation ####
214+
215+
If ``casm`` is installed correctly, execute ``casm`` from any directory and you will see the ``casm`` help menu:
216+
217+
*** casm usage ***
218+
219+
casm [--version] <subcommand> [options] [args]
220+
221+
available subcommands:
222+
bset
223+
composition
224+
enum
225+
fit
226+
format
227+
import
228+
init
229+
perturb
230+
query
231+
ref
232+
run
233+
select
234+
settings
235+
status
236+
super
237+
sym
238+
update
239+
240+
For help using a subcommand use: 'casm <subcommand> --help'
241+
242+
For step by step help use: 'casm status -n'
243+
244+
245+
246+
**Frequently encountered issues**:
247+
248+
- I tried to install (``scons install``) or uninstall (``scons install -c``), but get errors about not having permission.
249+
- If you don't have permissions to write to ``/usr/local/``, as is usual on a computer cluster, you can change the environment variable ``$CASMPREFIX`` to a location that you do have permission to use. For instance, you can create a software directory in your home directory:
250+
251+
cd ~
252+
mkdir software
253+
254+
Then you can edit the ``.bash_profile`` file in your home directory to set your ``$PATH`` and libary search path to include your software directory by adding the lines:
255+
256+
export CASMPREFIX=$HOME/software
257+
export PATH=$PATH:$CASMPREFIX/bin
258+
export CPATH=$CPATH:$CASMPREFIX/include
259+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CASMPREFIX/lib
260+
261+
To make the changes take effect use ``source ~/.bash_profile`` or open a new session. Then try installing again (``cd /path/to/CASM; scons install``). *Note: On Mac OS X, use ``DYLD_FALLBACK_LIBRARY_PATH`` instead of ``LD_LIBRARY_PATH``.*
262+
263+
- If you have administrative access you can install using ``sudo``, although this is not recommended. For example: ``sudo scons install``.
264+
265+
266+
267+
- I installed CASM without errors, but when I try to execute ``casm`` I get the error:
268+
269+
$ casm
270+
-bash: casm: command not found
271+
272+
If ``scons install`` ran without error, this means that ``casm`` was installed in a directory that is not in your $PATH. You can check what directories are searched for executables using ``echo $PATH``. Possible solutions include:
273+
1. Uninstall CASM and re-install it in a directory that is in your ``$PATH``. This can be accomplished by uninstalling (``scons install -c``) and changing ``$CASMPREFIX`` such that ``$CASMPREFIX/bin`` is in your ``$PATH`` (``export $CASMPREFIX=/some/place/in_my_path/)
274+
1. Append the location where ``casm`` was installed to your ``$PATH``. This can be accomplished by adding the line ``export PATH=$PATH:/path/to/bin`` to the file ``.bash_profile`` in your home directory, where ``/path/to/bin`` is replaced with the actual path to the directory where ``casm`` is installed.
275+
276+
277+
- I installed CASM without errors, but when I try to execute ``casm`` I get the error:
278+
279+
$ casm
280+
casm: error while loading shared libraries: libcasm.so: cannot open
281+
shared object file: No such file or directory
282+
283+
This means ``casm`` has been installed correctly but the shared library ``libcasm.so`` (or ``libcasm.dylib`` on Mac OS X) is not being found in any of the places being searched. Possible solutions include:
284+
- (Linux): Update the default library search path using ``ldconfig``. For example, see [this](http://codeyarns.com/2014/01/14/how-to-add-library-directory-to-ldconfig-cache/).
285+
- Change the ``LD_LIBRARY_PATH`` environment variable to specify which directory to search for ``libcasm`` by editing the ``.bash_profile`` file in your home directory to include:
286+
287+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
288+
289+
*Note: On Mac OS X, use ``DYLD_FALLBACK_LIBRARY_PATH`` instead of ``LD_LIBRARY_PATH``.*
290+
291+
#### For developers: Testing new features ####
292+
293+
If you are developing new features you can run all unit and integration tests from the main repository directory via:
294+
295+
scons test
296+
297+
Individual tests can also be run via:
298+
299+
scons unit
300+
scons casm_test
301+
scons eci_search_test
302+
# replace UnitTestName with a particular unit test (UnitTestName in tests/unit/*/UnitTestName_test.cpp)
303+
scons UnitTestName
304+
305+
Individual tests may be cleaned by re-running with any of the above commands with an added ``-c``. For instance ``scons Clexulator -c`` or ``scons casm_test -c``. In particular, ``scons test`` and ``scons casm_test`` must be cleaned before re-running or there will be errors about trying to initialize a CASM project in a directory where one already exists.
306+
307+
New unit tests using the Boost unit test framework can be added and automatically run by placing a ``UnitTestName_test.cpp`` file in any subdirectory of ``tests/unit`` by following the template of existing unit tests. If the unit test creates any files that it doesn't remove by itself, the ``tests/unit/SConscript`` file should be edited to enable cleaning them.
308+
309+

0 commit comments

Comments
 (0)