-
Notifications
You must be signed in to change notification settings - Fork 59
AddingInteraction
All places in the code, where something should be added, are commented. These comments start with TO ADD NEW INTERACTION FORMULATION
and contain detailed description; the text below is less detailed. Added code should be analogous to interaction formulations already present. The procedure is the following:
- Add new interaction term descriptor in the file const.h. Starting descriptor name with
G_
is recommended, as well as adding a descriptive comment. - Add information about the new interaction formulation in the file param.c.
- Modify string constants after
PAR(int)
in the constant arrayoptions
: add new argument to list{...}
and its description to the next string. - Add one line to the else-if sequence in the function
PARSE_FUNC(int)
. If new formulation allows sub-arguments, process them here. - If the new Green's tensor is non-symmetric (very unlikely) update the definition of
reduced_FFT
in functionVariablesInterconnect
accordingly. - Add a case to the relevant switch in the function
PrintInfo
.
- Modify string constants after
- Main part of the code should be added to interaction.c.
- Add functions that actually perform the calculation of the interaction term, according to the new formulae. At the end you need to have two functions according to the declarations
InterTerm_int
andInterTerm_real
in interaction.h. There are two ways to proceed:- either (recommended) create one main function with the following declaration
which works for double input vector. After the function definition you specify
static inline void InterTerm_<name>(double qvec[static 3],doublecomplex result[static 6])
WRAPPERS_INTER(InterTerm_<name>)
, which automatically produces wrappers compatible with declarations in interaction.h. - or create two separate functions named
InterTerm_<name>_int
andInterTerm_<name>_real
with declarations described in interaction.h. If the new formulation does not support arbitrary real input vector (e.g. it is based on tables), then useNO_REAL_WRAPPER(InterTerm_<name>)
instead of the real-input declaration.
- either (recommended) create one main function with the following declaration
- Update assignment of function pointers in function
InitInteraction
. If new formulation requires initialization, add it here as well, preferably by a separate function. Also test for possible incompatibilities with other ADDA parameters, if any, and add an exception. - If you allocate any memory (for tables, etc.), free it in function
FreeInteraction
.
- Add functions that actually perform the calculation of the interaction term, according to the new formulae. At the end you need to have two functions according to the declarations
Please refer to section Interaction Term of the manual for general overview and precise definition of the interaction term inside ADDA.
If you add a new interaction formulation to ADDA according to the described procedure, please consider contributing your code to be incorporated in future releases. You may also consider generalizing the new formulation for particles near surface, and adding a new reflection formulation.
Home (Getting started)
Frequently asked questions
Features
Tutorial
Comparison with other codes
Largest simulations
Compiling ADDA
Installing FFTW3
Installing MPI
Using OpenCL
Installing clFFT
Installing clBLAS
Using sparse mode
Installing MinGW
Using MSYS2
Papers that use ADDA
Awards
References
Links
Acknowledgements
Instruction for committers
Code design & structure
Style guide
Using VS Code
Using Eclipse
Early development history
Adding new ...