atom_codes
The built-in Prolog predicate atom_codes can convert an atom into the list of the numeric codes used internally to represent the characters in the atom, or vice-versa. Examples:

?- atom_codes(pizza, List).
List = [112, 105, 122, 122, 97] 

?- atom_codes(Atom, [98, 101, 101, 114]). 
Atom = beer 

See also atom_chars.