AVR publishes a set of guides for every microcontroller they make. See http://www.atmel.com/devices/atmega16.aspx?tab=documents, and obtain the ATmega16(L) Complete document.
You will find a chapter dedicated to I2C (it is named 2-wire Serial Interface (TWI)). While there may be libraries, the general practice is to set the appropriate registers manually.
Each register is given a name (all caps, like a constant) - an 8-bit integer you can set in C. Specific bits will be used to set one microcontroller as a master or slave. For example, the following registers are relevant to the two-wire interface.
TWI Register Description
- TWI Bit Rate Register – TWBR
- Bits 7...0 – TWI Bit Rate Register
- TWI Control Register – TWCR
- Bit 7 – TWINT: TWI Interrupt Flag
- Bit 6 – TWEA: TWI Enable Acknowledge Bit
- Bit 5 – TWSTA: TWI START Condition Bit
- Bit 4 – TWSTO: TWI STOP Condition Bit
- Bit 3 – TWWC: TWI Write Collision Flag
- Bit 2 – TWEN: TWI Enable Bit
- Bit 1 – Res: Reserved Bit
- Bit 0 – TWIE: TWI Interrupt Enable
- TWI Status Register – TWSR
- TWI Data Register – TWDR
- TWI (Slave) Address Register – TWAR
Note that you set certain bits to specify bit rate, the data to transfer, the address a slave responds to, and when to start/stop transfers (the control register). You can also obtain the status of transmissions from the status register.
The document will also walk you through the steps to use it:
Obtained from the AVR "ATmega16(L) Complete" document