This how to details the process of adding new code into freud
- Does this code simply wrap or augment an external python library?
If you answered "yes" to any of the above questions, your code probably does not belong in Freud. A good rule of thumb is if the code I plan to write does not require C++, it does not belong in Freud.
There are, of course, exceptions.
You should branch your code off master into a new branch. Do not add new code directly into master
If the code you are adding is in a new module, not an existing module, you must do the following
- Add
${CMAKE_CURRENT_SOURCE_DIR}/ModuleName
toinclude_directories
- Add
ModuleName/SubModule.cc
andModuleName/SubModule.h
to the FREUD_SOURCES inset
Add from . import ModuleName
so that your module is imported by default
Add include "ModuleName.pxi"
to freud/__init__.py
. This must be done to have freud include your python-level code
This will house the python-level code
Make sure there is an import for each C++ class in your module:
from ._freud import MyC++Class
This file will expose the C++ classes in your module to python
Make sure your new module is referenced in the documentation
To add a new class to an existing module/function (or a newly created one) do the following
New classes should be grouped into paired .h, .cc files. There may be a few instances where new classes could be added to an existing .h, .cc pairing
Add a line for each C++ class in your module
from ._freud import MyC++Class
You must include sphinx-style documentation