I'm not sure what you're asking for.
To stop the computer, go to the Apple menu, and choose "Shut Down...".
Programatically you could call the "halt" or "shutdown" command in the shell. I can't imagine many situations in which you would actually do this though.
I believe there is also a graceful shutdown command in AppleScript, in case you want to setup your Mac to run a series of scripted tasks and then turn itself off when finished.