ATMM.F: Functions