Replace space in column with letter for several rows

I have a pbd file, which has the following format:

TITLE     Protein X
MODEL        1
ATOM      1  N   PRO    24      45.220  71.410  43.810  1.00  0.00            
ATOM      2  H1  PRO    24      45.800  71.310  42.000  1.00  0.00            
TER
ENDMDL

Column 22 is the chain identifier for lines that begin with ATOM. I would like to replace the space in column 22 with the letter A. The actual file has thousands of rows labeled ATOM. An example output is given below:

TITLE     Protein X
MODEL        1
ATOM      1  N   PRO A  24      45.220  71.410  43.810  1.00  0.00            
ATOM      2  H1  PRO A  24      45.800  71.310  42.000  1.00  0.00            
TER
ENDMDL

Any help is much appreciated.

Try:

sed '/^ATOM /s/./A/22' file

That worked perfectly. Very much appreciated!

To make sure you replace nothing but a space, do it like

 sed '/^ATOM /s/ /A/22' file 

. Scrutinizer's proposal will replace ANY character.

The above code will change the 22nd <space> character on a line; not a space that is the 22nd character on a line. If the requirement is to change the 22nd character on a line to an <A> if and only if that character was a <space>, try something more like (assuming you have a POSIX-conforming version of sed :

sed '/^\(ATOM ................\) /s//\1A/' file

Which could be reduced to:

sed '/^ATOM /s/\(.\{21\}\) /\1A/' file

or

sed 's/^\(ATOM .\{16\}\) /\1A/' file