The ATOMIC directive specifies that a specific memory location must be updated atomically, rather than letting multiple threads attempt to write to it. In essence, this directive provides a mini-CRITICAL section.
!$OMP ATOMIC statement_expression
#pragma omp atomic newline statement_expression
The directive applies only to a single, immediately following statement.
An atomic statement must follow a specific syntax. See the most recent OpenMP specs for this.