Please use the above citation when using Freud.
Welcome to Freud! Freud provides users the ability to analyze generic data from a variety of sources including simulation and experimental data for advanced metrics such as the radial distribution function and various order parameters.
If you have a question, please consider posting to the Freud-Users mailing list.
Example Jupyter notebooks can be found in a separate repository. These examples are available as a static notebook on nbviewer and as an interactive version on mybinder.
Official binaries of Freud are available via conda through
the glotzer channel.
To install Freud, first download and install
miniconda following conda's instructions.
Then add the glotzer
channel and install Freud:
$ conda config --add channels glotzer
$ conda install freud
Use cmake to configure an out of source build and make to build freud.
mkdir build
cd build
cmake ../
make -j20
By default, freud installs to the USER_SITE directory. Which is in
~/.local
on linux and in ~/Library
on mac. USER_SITE
is on the python search path by default, there is no need to
modify PYTHONPATH
.
To run out of the build directory, add the build directory to your PYTHONPATH
:
bash
export PYTHONPATH=`pwd`:$PYTHONPATH
For more detailed instructions, see the documentation.
Freud makes use of submodules. CMAKE has been configured to automatically init and update submodules. However, if this does not work, or you would like to do this yourself, please execute:
git submodule init
- Required:
- Python >= 2.7 (3.x recommended)
- Numpy >=1.7
- Boost (headers only)
- CMake >= 2.8.0 (to compile freud)
- C++ 11 capable compiler (tested with gcc >= 4.8.5, clang 3.5)
- Intel Thread Building Blocks
- Optional:
- Cython >= 0.23 (to compile your own _freud.cpp)
Freud analysis scripts are python scripts.
Here is a simple example.
import freud
# create a freud compute object (rdf is the canonical example)
rdf = freud.density.rdf(rmax=5, dr=0.1)
# load in your data (freud does not provide a data reader)
box_data = np.load("pth/to/box_data.npy")
pos_data = np.load("pth/to/pos_data.npy")
# create freud box
box = freud.box.Box(Lx=box_data[0]["Lx"], Ly=box_data[0]["Ly"], is2D=True)
# compute RDF
rdf.compute(box, pos_data[0], pos_data[0])
# get bin centers, rdf data
r = rdf.getR()
y = rdf.getRDF()
You may read the documentation online, download the documentation in the downloads section, or you may build the documentation yourself:
Documentation written in sphinx. Please install sphinx:
conda install sphinx
OR
pip install sphinx
To view the full documentation run the following commands in the source directory:
# Linux
cd doc
make html
xdg-open build/html/index.html
# Mac
cd doc
make html
open build/html/index.html
If you have latex and/or pdflatex, you may also build a pdf of the documentation:
# Linux
cd doc
make latexpdf
xdg-open build/latex/freud.pdf
# Mac
cd doc
make latexpdf
open build/latex/freud.pdf
Run all unit tests with nosetests in the source directory. To add a test, simply add a file to the tests
directory,
and nosetests will automatically discover it. See http://pythontesting.net/framework/nose/nose-introduction/ for
an introduction to writing nose tests.
cd source
nosetests