Wales Group Fortran conventions for group software

From CUC3
Revision as of 13:51, 29 April 2008 by import>Dw34
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Fortran 90 offers many useful features and enables some code to be written very concisely. However, if the code is too concise then it may be difficult for other people to understand it and subsequently edit it.

When coding for OPTIM, GMIN or PATHSAMPLE please follow the guidelines below.

Use fortran 90 for new subroutines.

Program statements should be in uppercase to permit case sensitive editing without guessing capitalisation schemes.

Comment statements should be typeset with normal capitalisation, as for plain text.

Please write comment statements in english.

If you alter or add discrete blocks of code please put your userid in a comment statment at the start.

Always include explicit ranges when dealing with arrays. Although

X = 0.0D0

is very compact, the next person to edit the file may not know whether X is a scalar, vector, or some other array, so it is better to write:

X(1:3*NATOMS) = 0.0D0

Do not use pointers for static storage, and only use such constructs if they cannot be avoided. Code written with pointers can be particularly concise and elegant, which often makes it particularly difficult for other people to understand.