added the optional parameter numatoms
the reader now pass the session to the writer if reader.writer() is called