ATM is also known as flex thrust, because assumed temperature can be adjusted to fit a variety of conditions, runway & TOGW permitting.
Derate is a fixed decrement (-4%, -10%, etc) and separate AFM performance charts are provided giving certified aircraft performance for each derate.
Derate may be used whenever TOGW will allow.
Flex or ATM may NOT be used with contaminated runway.
Here is a
prior thread with more detail.