SPIDER Programming Guidelines
- File names should be <= 12 characters long.
- The ar command mangles longer names.
- In general each subroutine should be in its own file
- The only exception is subroutines that are only called
from within another subroutine in the same file, or a few support
routines (such as document file handling, register handling, or
file handling) that require use of F90 modules and are written
in an "object oriented" manner.
- Add SPIDER header to each file, except those which we do not
keep copyright for.
- Get header from spider.f.
- Put subroutine purpose in SPIDER heading.
- Put parameter listing in SPIDER heading.
- Indicate which parameters are sent to routine and which are
returned (modified).
- No tabs. (use spaces instead)
- Minimize GO TO usage.
- All code must be compatible with Fortran 95.
- Use all uppercase for code and comments.
- Use descriptive variable names.
- Do not use very short names such as "A" for
a variable unless it is something like an index, etc.
- Document with comments what you are doing and WHY you
are coding this way.
- Use lots of comments.
- Nothing beyond column 72.
- Do not use labels on do loops.
- Use END DO instead.
- Use existing support routines for reading user input.
- Never use raw reads for input.
- Use opfile.f for opening a SPIDER file.
- Use opauxfile.f for opening a non-SPIDER file.
- Use lundoc....f for document files.
- Indent IF clauses, DO LOOP clauses.
- Indent 3 spaces per level.
- Align declarations neatly.
- All operations must have a manual page.
- Use run time allocation for
large memory assignments and automatic arrays for smaller
assignments.
- Do not unnecessary permantent local arrays (using SAVE).
- Do not incorporate code from other authors that is
inconsistent with their licenses or inconsistent with our
with our GPL license.
- Proprietary code is not to be used in SPIDER!
source: docs/tips/spiprogramming.html
last update: 02 jan 2009
ardean leith