#include <stdinc.h>proc get_potential (potname, potpars, potfile)potproc_double get_potential_double (potname, potpars, potfile)potproc_float get_potential_float (potname, potpars, potfile)string potname; /* generic name of potential */string potpars; /* parameters, separated by comma’s */string potfile; /* optional (file) name or string */ proc get_inipotential ()real get_pattern()void set_pattern(real omega)
get_potential reads a formulation file of a potential (see potential(5NEMO) ). potname is the generic name of the filename, which must contain at least two entry points inipotential and potential with a predefined parameter sequence. Modern compilers with stricter prototyping should use the _double or _float versions of the same function.
A default search path is provided by an environment variable POTPATH, normally set by the NEMO environment startup script NEMORC. Potential datafiles can be stored in c-source form (.c) or (e.g. in case you only them available in another language) object form (.o). In case only the source is available, it is compiled to an object file with a simple system call to the cc(1) compiler.
Once a potential has been loaded, two additional routines allow access to intrinsic properties of that potential:
get_pattern returns the pattern speed of the potential, which is conventionally the first parameter of the potpars list. Potentials which compute the pattern speed from another parameter (e.g. from the lagrangian radius) should return the pattern speed in the first array element of ini_potential. This routine is heavily used by routines which need the pattern speed.
set_pattern would also set the pattern speed, but the method in the previous paragraph is preferred, and known to work.
get_inipotential returns a pointer to the function which initializes the potential. In this way one could re-initialize and re-use the potential.
potproc mypot, get_potential();double pot,time;vector pos, acc;int ndim=NDIM;...mypot = get_potential("harmonic","0.0,1.0,0.5",NULL);(*mypot)(&ndim,pos,acc,&pot,&time);...
Fortran C interface only works on certain implementation where a fortran character string gets its length passed by value as the last argument.
make orbint L="$NEMOLIB/potential0.o -lnemo $NEMOOBJ/potential/plummer.o"and make sure potential0.o is loaded before the nemo library.
~/src/orbit/potential potential.c potential0.c
13-Jul-87 V1.0: Original created PJT 8-Apr-88 V2.0: added ’name’ parameter for hackforce PJT 13-mar-89 V2.1: ’name_len’ in case Fortran was used PJT 9-feb-89 V3.0: added time parameter to potential()-repair doc PJT 25-oct-90 V3.2: minor upgrades PJT 10-mar-93 -- also added potential0.c when loadobj doesn’t work PJT 11-oct-93 V5.0: added get_pattern PJT 13-sep-01 V5.4: added _float/_double versions w/ prototyping PJT 10-jan-22 V5.5: added set_pattern() - though not really needed PJT
Table of Contents