Local structure of amorphous and nanoscale systems by numerical XANES calculations