DL_POLY_2 contains a number of in-built error checks scattered throughout the package which detect a wide range of possible errors. In all cases, when an error is detected the subroutine ERROR is called, resulting in an appropriate message and termination of the program execution (either immediately, or after additional processing.).
Users intending to insert new error checks should ensure that all error checks are performed concurrently on all nodes, and that in circumstances where a different result may obtain on different nodes, a call to the global status routine GSTATE is made to set the appropriate global error flag on all nodes. Only after this is done, a call to subroutine ERROR may be made. An example of such a procedure might be:
logical safe
safe=(test_condition)
call gstate(safe)
if(.not.safe) call error(node_id,message_number)
In this example it is assumed that the logical operation test_condition will result in the answer .true. if it is safe for the program to proceed, and .false. otherwise. The call to ERROR requires the user to state the identity of the calling node (node_id), so that only the nominated node in ERROR (i.e. node 0) will print the error message. The variable message_number is an integer used to identify the appropriate message to be printed.
In all cases, if ERROR is called with a non-negative message number, the program run terminates. If the message number is negative, execution continues, but even in this case DL_POLY_2 will terminate the job at a more appropriate place. This feature is used in processing the CONTROL and FIELD file directives. A possible modification users may consider is to dump additional data before the call to ERROR is made.
A description of the ERROR subroutine is found in chapter 8 the DL_POLY_2 Reference Manual.
A full list of the DL_POLY_2 error messages and the appropriate user action can be found in Appendix C of this document.