Table of Contents

Name

get_potential - obtain potential descriptor and pattern speed

Synopsis


#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()

Description

potential(3NEMO) provides a uniform interface to handle the input of the potential(5NEMO) ’datafile’ format. It returns a pointer to the function wich computes potentials, forces etc.

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.

get_inipotential returns a pointer to the function which initializes the potential. In this way one could re-initialize and re-use the potential.

Example


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);...

See Also

potlist(1NEMO) ,potential(5NEMO) ,loadobj(3NEMO) ,acceleration(3NEMO)

Bugs

Uses a dynamic object loader. See loadobj(3NEMO) for implementations, but see below for a standalone loader.

Fortran C interface only works on certain implementation where a fortran character string gets its length passed by value as the last argument.

Examples

The non-loadobj version of the potential loader is called potential0.c and it can compile programs as follows:
    make orbint L="$NEMOLIB/potential0.o -lnemo $NEMOOBJ/potential/plummer.o"
and make sure potential0.o is loaded before the nemo library.

Author

Peter Teuben

Files


~/src/orbit/potential      potential.c potential0.c

Update History


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


Table of Contents