[gmx-developers] Doxygen commenting

Matthew Chan talcite at gmail.com
Sun Dec 28 10:11:06 CET 2008


Hi Everyone,

I have good news! I managed to have everything building in eclipse, so
my productivity should increase a bit now, which hopefully will
translate into patches for GROMACS.

I've also given a shot at commenting a file according to Doxygen syntax.
I've attached a patch for submission along with the doxygen config if
you'd like to take a look. Make sure to change the compile directories
for the doxygen config. It's for the include/random.h header.

The descriptions are a bit crude, I manually traced the execution of the
functions and tried to guess what each variable was used for. Also, I
had no idea what the L parameter was in calc_cm(). Also, I'm trying to
pick up the latex mathematical syntax, so if you have any formulaic
representation of functions,in random.h or anywhere else, I can add them
into the descriptions for functions like I did in make_seed().

Please don't hesitate to write back with any comments or suggestions on
improving the quality of documentation.

I'll give a few more of these a shot and see if I can get the hang of
it. I find the hardest part is understanding what each parameter and
return value is for. 

Happy Holidays,
Matt

-------------- next part --------------
### Eclipse Workspace Patch 1.0
#P gmx
Index: include/random.h
===================================================================
RCS file: /home/gmx/cvs/gmx/include/random.h,v
retrieving revision 1.17
diff -u -r1.17 random.h
--- include/random.h	5 Aug 2008 14:41:51 -0000	1.17
+++ include/random.h	28 Dec 2008 08:38:57 -0000
@@ -34,6 +34,11 @@
  * Gromacs Runs On Most of All Computer Systems
  */
 
+/**
+ * @file random.h
+ * A random number generator. 
+ */
+
 #ifndef _random_h
 #define _random_h
 
@@ -43,24 +48,56 @@
 
 #include <typedefs.h>
 
+/**
+ * Seeds the random number generator.
+ * generates seeds according to the formula \f$(time + pid) \bmod 1000000\f$.
+ * @return the seed. 
+ */
 extern int make_seed(void);
-/* Make a random seed: (time+getpid) % 1000000 */
 
+/**
+* Generates a random number.
+* Number generated is between 0 and 1.
+* @param *seed a pointer for the function to store the random number.
+* @return the seed stored in *seed. 
+*/
 extern real rando(int *seed);
-/* Generate a random number 0 <= r < 1. seed is the (address of) the
- * random seed variable.
- */
 
+/**
+* Generates a velocity according to maxwellian distribution.
+* @param tempi scaled initial generated temperature. Used to initialize low_mspeed. 
+* @param seed a seed used to initialize the gmx random number generator in gmx_rng_init. Auto generated if seed is -1.
+* @param *mtop molecule topology. See gmx_mtop_t for more information. 
+* @param v[] the velocities (natoms)
+*/
 extern void maxwell_speed(real tempi,int seed, 
 			  gmx_mtop_t *mtop, rvec v[]);
-/* Generate velocites according to a maxwellian distribution */
 
+/**
+* Calculates the centre of mass position, velocity, acceleration and the moment of Inertia.
+* @param *log the file to log if DEBUG is defined.
+* @param natoms number of elements in mass[], x[] and v[].
+* @param mass[] mass of atoms corresponding to x[] and v[].
+* @param x[] co-ordinates of atoms corresponding to mass[] and v[].
+* @param v[] velocities of atoms corresponding to mass[] and x[].
+* @param xcm c.o.m. position.
+* @param vcm c.o.m. velocity. 
+* @param acm rotational velocity around c.o.m.
+* @param L L does something. 
+* @return the total mass.
+*/
 extern real calc_cm(FILE *log,int natoms,real mass[],rvec x[],rvec v[],
 		    rvec xcm,rvec vcm,rvec acm,matrix L);
-/* Calculate the c.o.m. position, velocity, acceleration and the
- * moment of Inertia. Returns the total mass.
- */
 
+/**
+* Stops the centre of mass motion.
+* Subtracts the velocity from v[] using calc_cm. 
+* @param *log the file to log if DEBUG is defined.
+* @param natoms number of elements in mass[], x[] and v[].
+* @param mass[] mass of atoms corresponding to x[] and v[].
+* @param x[] co-ordinates of atoms corresponding to mass[] and v[].
+* @param v[] velocities of atoms corresponding to mass[] and x[].
+*/
 extern void stop_cm(FILE *log,int natoms,real mass[],rvec x[],rvec v[]);
 
 #endif	/* _random_h */
-------------- next part --------------
# Doxyfile 1.5.6

#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING      = UTF-8
PROJECT_NAME           = test
PROJECT_NUMBER         = test
OUTPUT_DIRECTORY       = /home/matt/temp/doxygen/
CREATE_SUBDIRS         = NO
OUTPUT_LANGUAGE        = English
BRIEF_MEMBER_DESC      = YES
REPEAT_BRIEF           = YES
ABBREVIATE_BRIEF       = "The $name class" \
                         "The $name widget" \
                         "The $name file" \
                         is \
                         provides \
                         specifies \
                         contains \
                         represents \
                         a \
                         an \
                         the
ALWAYS_DETAILED_SEC    = NO
INLINE_INHERITED_MEMB  = NO
FULL_PATH_NAMES        = YES
STRIP_FROM_PATH        = /home/matt/temp/
STRIP_FROM_INC_PATH    = 
SHORT_NAMES            = NO
JAVADOC_AUTOBRIEF      = YES
QT_AUTOBRIEF           = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP         = NO
INHERIT_DOCS           = YES
SEPARATE_MEMBER_PAGES  = NO
TAB_SIZE               = 8
ALIASES                = 
OPTIMIZE_OUTPUT_FOR_C  = YES
OPTIMIZE_OUTPUT_JAVA   = NO
OPTIMIZE_FOR_FORTRAN   = NO
OPTIMIZE_OUTPUT_VHDL   = NO
BUILTIN_STL_SUPPORT    = NO
CPP_CLI_SUPPORT        = NO
SIP_SUPPORT            = NO
IDL_PROPERTY_SUPPORT   = YES
DISTRIBUTE_GROUP_DOC   = NO
SUBGROUPING            = YES
TYPEDEF_HIDES_STRUCT   = NO
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL            = NO
EXTRACT_PRIVATE        = NO
EXTRACT_STATIC         = NO
EXTRACT_LOCAL_CLASSES  = YES
EXTRACT_LOCAL_METHODS  = NO
EXTRACT_ANON_NSPACES   = NO
HIDE_UNDOC_MEMBERS     = YES
HIDE_UNDOC_CLASSES     = YES
HIDE_FRIEND_COMPOUNDS  = NO
HIDE_IN_BODY_DOCS      = NO
INTERNAL_DOCS          = NO
CASE_SENSE_NAMES       = YES
HIDE_SCOPE_NAMES       = NO
SHOW_INCLUDE_FILES     = YES
INLINE_INFO            = YES
SORT_MEMBER_DOCS       = YES
SORT_BRIEF_DOCS        = NO
SORT_GROUP_NAMES       = NO
SORT_BY_SCOPE_NAME     = NO
GENERATE_TODOLIST      = YES
GENERATE_TESTLIST      = YES
GENERATE_BUGLIST       = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS       = 
MAX_INITIALIZER_LINES  = 30
SHOW_USED_FILES        = YES
SHOW_DIRECTORIES       = NO
SHOW_FILES             = YES
SHOW_NAMESPACES        = YES
FILE_VERSION_FILTER    = 
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET                  = NO
WARNINGS               = YES
WARN_IF_UNDOCUMENTED   = YES
WARN_IF_DOC_ERROR      = YES
WARN_NO_PARAMDOC       = NO
WARN_FORMAT            = "$file:$line: $text"
WARN_LOGFILE           = 
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT                  = /home/matt/temp/
INPUT_ENCODING         = UTF-8
FILE_PATTERNS          = *.c \
                         *.cc \
                         *.cxx \
                         *.cpp \
                         *.c++ \
                         *.d \
                         *.java \
                         *.ii \
                         *.ixx \
                         *.ipp \
                         *.i++ \
                         *.inl \
                         *.h \
                         *.hh \
                         *.hxx \
                         *.hpp \
                         *.h++ \
                         *.idl \
                         *.odl \
                         *.cs \
                         *.php \
                         *.php3 \
                         *.inc \
                         *.m \
                         *.mm \
                         *.dox \
                         *.py \
                         *.f90 \
                         *.f \
                         *.vhd \
                         *.vhdl \
                         *.C \
                         *.CC \
                         *.C++ \
                         *.II \
                         *.I++ \
                         *.H \
                         *.HH \
                         *.H++ \
                         *.CS \
                         *.PHP \
                         *.PHP3 \
                         *.M \
                         *.MM \
                         *.PY \
                         *.F90 \
                         *.F \
                         *.VHD \
                         *.VHDL
RECURSIVE              = NO
EXCLUDE                = 
EXCLUDE_SYMLINKS       = NO
EXCLUDE_PATTERNS       = 
EXCLUDE_SYMBOLS        = 
EXAMPLE_PATH           = 
EXAMPLE_PATTERNS       = *
EXAMPLE_RECURSIVE      = NO
IMAGE_PATH             = 
INPUT_FILTER           = 
FILTER_PATTERNS        = 
FILTER_SOURCE_FILES    = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER         = NO
INLINE_SOURCES         = NO
STRIP_CODE_COMMENTS    = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION    = NO
REFERENCES_LINK_SOURCE = YES
USE_HTAGS              = NO
VERBATIM_HEADERS       = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX     = NO
COLS_IN_ALPHA_INDEX    = 5
IGNORE_PREFIX          = 
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML          = YES
HTML_OUTPUT            = html
HTML_FILE_EXTENSION    = .html
HTML_HEADER            = 
HTML_FOOTER            = 
HTML_STYLESHEET        = 
HTML_ALIGN_MEMBERS     = YES
GENERATE_HTMLHELP      = NO
GENERATE_DOCSET        = NO
DOCSET_FEEDNAME        = "Doxygen generated docs"
DOCSET_BUNDLE_ID       = org.doxygen.Project
HTML_DYNAMIC_SECTIONS  = NO
CHM_FILE               = 
HHC_LOCATION           = 
GENERATE_CHI           = NO
CHM_INDEX_ENCODING     = 
BINARY_TOC             = NO
TOC_EXPAND             = NO
DISABLE_INDEX          = NO
ENUM_VALUES_PER_LINE   = 4
GENERATE_TREEVIEW      = NONE
TREEVIEW_WIDTH         = 250
FORMULA_FONTSIZE       = 10
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX         = YES
LATEX_OUTPUT           = latex
LATEX_CMD_NAME         = latex
MAKEINDEX_CMD_NAME     = makeindex
COMPACT_LATEX          = NO
PAPER_TYPE             = a4wide
EXTRA_PACKAGES         = 
LATEX_HEADER           = 
PDF_HYPERLINKS         = YES
USE_PDFLATEX           = YES
LATEX_BATCHMODE        = NO
LATEX_HIDE_INDICES     = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF           = NO
RTF_OUTPUT             = rtf
COMPACT_RTF            = NO
RTF_HYPERLINKS         = NO
RTF_STYLESHEET_FILE    = 
RTF_EXTENSIONS_FILE    = 
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN           = NO
MAN_OUTPUT             = man
MAN_EXTENSION          = .3
MAN_LINKS              = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML           = NO
XML_OUTPUT             = xml
XML_SCHEMA             = 
XML_DTD                = 
XML_PROGRAMLISTING     = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF   = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD       = NO
PERLMOD_LATEX          = NO
PERLMOD_PRETTY         = YES
PERLMOD_MAKEVAR_PREFIX = 
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor   
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING   = YES
MACRO_EXPANSION        = NO
EXPAND_ONLY_PREDEF     = NO
SEARCH_INCLUDES        = YES
INCLUDE_PATH           = 
INCLUDE_FILE_PATTERNS  = 
PREDEFINED             = 
EXPAND_AS_DEFINED      = 
SKIP_FUNCTION_MACROS   = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references   
#---------------------------------------------------------------------------
TAGFILES               = 
GENERATE_TAGFILE       = 
ALLEXTERNALS           = NO
EXTERNAL_GROUPS        = YES
PERL_PATH              = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool   
#---------------------------------------------------------------------------
CLASS_DIAGRAMS         = NO
MSCGEN_PATH            = 
HIDE_UNDOC_RELATIONS   = YES
HAVE_DOT               = YES
DOT_FONTNAME           = FreeSans
DOT_FONTPATH           = 
CLASS_GRAPH            = YES
COLLABORATION_GRAPH    = YES
GROUP_GRAPHS           = YES
UML_LOOK               = NO
TEMPLATE_RELATIONS     = NO
INCLUDE_GRAPH          = YES
INCLUDED_BY_GRAPH      = YES
CALL_GRAPH             = NO
CALLER_GRAPH           = NO
GRAPHICAL_HIERARCHY    = YES
DIRECTORY_GRAPH        = YES
DOT_IMAGE_FORMAT       = png
DOT_PATH               = 
DOTFILE_DIRS           = 
DOT_GRAPH_MAX_NODES    = 50
MAX_DOT_GRAPH_DEPTH    = 1000
DOT_TRANSPARENT        = YES
DOT_MULTI_TARGETS      = NO
GENERATE_LEGEND        = YES
DOT_CLEANUP            = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine   
#---------------------------------------------------------------------------
SEARCHENGINE           = NO


More information about the gromacs.org_gmx-developers mailing list