File size: 223,474 Bytes
7e59e4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
 <chapter id="modelCreation" xreflabel="Model Creation">
<!-- Begin CVS Header -->
<!--   $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/userdocs/userguide/copasi_GUI.xml,v $ -->
<!--   $Revision: 1.57 $ -->
<!--   $Name:  $ -->
<!--   $Author: shoops $ -->
<!--   $Date: 2009/04/21 16:22:02 $ -->
<!-- End CVS Header -->

<!-- Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual -->
<!-- Properties, Inc., EML Research, gGmbH, University of Heidelberg, -->
<!-- and The University of Manchester. -->
<!-- All rights reserved. -->

<!-- Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual -->
<!-- Properties, Inc. and EML Research, gGmbH. -->
<!-- All rights reserved. -->

<title>Model Creation</title>
<sect1 id="introduction" xreflabel="introduction"><title>Introduction</title>
<para>
The COPASI graphical user interface has been written using the <ulink
url="http://www.trolltech.com">Qt toolkit</ulink>. This allows us to
release COPASI on all platforms that Qt supports.
</para>
<para>
It also has the advantage that COPASI essentially behaves the same on
all platforms supported, while still showing platform specific
behavior. E.g. on a computer running Mac OS X<!--&trade;-->, the user
will have the menu at the top of the screen and the menu entry for the
about dialog will appear in the COPASI menu rather than the help menu.
</para>
<para>
In the following sections, we will explain how to use the graphical
user interface of COPASI. Everything should be applicable to all
supported platforms. If there is a difference for some platforms we
will try to point that out explicitly.
</para>
</sect1>

<sect1 id="commandLineSwitches" xreflabel="COPASI commandline options">
<title>Commandline Version and Commandline Options</title>
<para>
COPASI comes in two versions. One with a (hopefully) nice GUI for
interactive work and one without a GUI for batch processing of model
files. Both versions support the same set of commandline arguments,
although some do not make sense for the GUI version and will be
ignored. 
</para>
<para>
In addition to the commandline options, you can specify one or more
COPASI (or Gepasi) files after the commandline options which will then
be processed. Specifying more than one file again only makes sense for
the commandline version of COPASI. For each of the files, the
activated tasks will be run. The commandline options for importing and
exporting SBML as well as the --save option are ignored if more than one
file is specified. Since the GUI version of COPASI can only handle one
file at a time, it only makes sense to specify one file after the
commandline options. 
</para>
<variablelist><title>Commandline options</title>
<varlistentry><term>--SBMLSchema</term>
<listitem>
<para>
This switch works in combination with the --exportSBML switch and
determines which SBML level and version is going to be used for SBML export.
Currently the following schemas are supported L1V2 for SBML Level 1 Version 2,
L2V1 for SBML Level 2 Version 1, L2V2 for SBML Level 2 Version 2 and L2V3 for 
SBML Level 2 Version 3. 
</para>
<para>
If no schema is given, the exported creates SBML Level 2 Version 3 files. 
</para>
</listitem>
</varlistentry>

<varlistentry><term>--home</term>
<listitem>
<para>
This can be used to tell COPASI where your home directory is
located. Normally you don't have to use this. 
</para>
</listitem>
</varlistentry>

<varlistentry><term>--configdir</term>
<listitem>
<para>
This can be used to specify the directory where COPASI stores its
configuration files. Normally this is called .copasi and is located in
the users home directory. But if you want COPASI to use a different
one, you can specify it with this switch. 
</para>
</listitem>
</varlistentry>

<varlistentry><term>--configfile</term>
<listitem>
<para>
This can be used to specify the filename where COPASI loads and stores
its configuration. Normally this is called COPASI and is located in
the directory specified with --configdir. But if you want COPASI to use
a different filename, you can specify it with this switch. 
</para>
</listitem>
</varlistentry>


<varlistentry><term>-c</term><term>--copasidir</term>
<listitem>
<para>
This specifies the directory where COPASI  has been installed. It is
needed to find e.g. help files. On Windows and Mac OS X this is set
automatically. On Linux it has to be specified if you want to use
certain features. The GUI version of COPASI will issue a warning on
startup if this has not been set. The commandline version does not
need this directory to be specified and therefore ignores this option.
</para>
</listitem>
</varlistentry>

<varlistentry><term>--exportBerkeleyMadonna</term>
<listitem>
<para>
With this option you can specify a name for the Berkeley Madonna file
COPASI should export. This is useful if you want to export some COPASI
files to Berkeley Madonna file format in a batch job. This only makes
sense for the commandline version and it will be ignored by the GUI
version.
</para>
</listitem>
</varlistentry>

<varlistentry><term>--exportC</term>
<listitem>
<para>
With this option you can specify a name for the C source file COPASI
should export. This is useful if you want to export some COPASI files
to C source code in a batch job. This only makes sense for the
commandline version and it will be ignored by the GUI version.
</para>
</listitem>
</varlistentry>

<varlistentry><term>-e</term><term>--exportSBML</term>
<listitem>
<para>
With this option you can specify a name for the SBML file COPASI
should export. This is useful if you want to export some COPASI files
to SBML in a batch job. This only makes sense for the commandline
version and it will be ignored by the GUI version.
</para>
</listitem>
</varlistentry>

<varlistentry><term>--exportXPPAUT</term>
<listitem>
<para>
With this option you can specify a name for the XPPAUT file
COPASI should export. This is useful if you want to export some COPASI
files to XPPAUTs ODE file format in a batch job. This only makes
sense for the commandline version and it will be ignored by the GUI
version.
</para>
</listitem>
</varlistentry>

<varlistentry><term>--license</term>
<listitem>
<para>
With this commandline option, COPASI will print its license and exit.
</para>
</listitem>
</varlistentry>

<varlistentry><term>-i</term><term>--importSBML</term>
<listitem>
<para>
This options lets you specify an SBML file that COPASI shall import.
</para>
</listitem>
</varlistentry>

<varlistentry><term>-s</term><term>--save</term>
<listitem>
<para>
This option is used to specify the name file where COPASI should store
a model. This is useful if you intend to convert some SBML files to
COPASI files in a batch job. This also makes sense only for the
commandline version and will be ignored by the GUI version.
</para>
</listitem>
</varlistentry>
<varlistentry><term>-t</term><term>--tmp</term>
<listitem>
<para>
This option can be used to specify a temporary directory where COPASI
will auto-save some data periodically. Normally COPASI uses the
systems temporary directory (e.g. /tmp/ under Linux). 
</para>
</listitem>
</varlistentry>

<varlistentry><term>--verbose</term>
<listitem>
<para>
This commandline option tells COPASI to print more output on what it
is doing to std::out.
</para>
</listitem>
</varlistentry>

<varlistentry><term>--nologo</term>
<listitem>
<para>
This option suppresses the output of the "Logo" when CopasiSE is run. The "Logo" usually consist of the version of COPASI and some license statement.
</para>
</listitem>
</varlistentry>

<varlistentry><term>--validate</term>
<listitem>
<para>
This commandline version can be used to validate the given file. The file can either be a COPASI file or an SBML file.
</para>
</listitem>
</varlistentry>



</variablelist>


</sect1>
<sect1 id="generalGUILayout" xreflabel="COPASI GUI Elements">
<title>COPASI GUI Elements</title>
<para>
The COPASI graphical user interface essentially consists of four
elements.
</para>
 <para> 
<screenshot>
<screeninfo>
Produced with COPASI 4.3 (Build 25) on Leopard on 02/06/2008
</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Layout_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>COPASI GUI elements.</phrase>
 </textobject>
 <caption>
  <para>Elements of the COPASI user interface</para>
 </caption> 
</mediaobject>
</screenshot> 
</para>
<para>
On the top of the main window, you have the menu bar (on the Mac, the
menu bar is on the top of the screen). Below that, you have a tool bar
with some common tasks like opening a file or saving a file. The rest
of the window is vertically divided into two parts by a slider. The
size of the two elements can be adjusted by moving the bar that
separates them. The left element is called the object tree and it
shows your current model and the tasks that you can perform on this
model. Depending on the element that is selected in the object tree,
the view on the right will change in order to enable you to edit the
model or run and modify the task you selected in the object tree.
</para>
<para>
If you start COPASI without any command line argument, COPASI will
start with a new model. The root of the object tree will be selected
and on the right side of the main window, you will see the COPASI
logo.
</para> 
<para>
The object tree has five branches below the root element. The first
one contains all objects that belong to the current model. The second
and third ones contain all tasks that COPASI can execute, the fourth
one contains the different output objects COPASI can handle and the
last branch contains all the (kinetic) functions that are
defined. These include the build in functions as well as functions
defined by the user.
</para>
<para>
If you now click on the <guibutton>Model</guibutton> branch, the view
to the right of the object tree will change and you will see a screen
that allows you to make <xref linkend="generalSettings" />. In the
following sections, we will describe the individual dialogs that you
can open by selecting different branches in the object tree. During
this explanation, you will learn how to create a model in COPASI and
run different tasks on this model like calculating a trajectory. 
</para>
</sect1>
<sect1 id="generalSettings" xreflabel="model settings">
<title>General Model Settings</title>
<para>
If you click on the <guibutton>Model</guibutton> branch of the object
tree which was explained in the <xref linkend="generalGUILayout" />
section, you activate the dialog that lets you specify certain
parameters for your model like its name and the units that are to be
used for time, volume and concentration quantities throughout the
current model. You can also give a textual description of your model
that is more expressive than reactions and equations. You could for
example state which part of the metabolism the model describes
(e.g. glycolysis) and add some references to articles related to the
model. This will help others (and yourself) to understand and identify
your models.
</para>
<para>   
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/06/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/General_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog for general model settings</phrase>
 </textobject>
 <caption>
  <para>Dialog for general model settings</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
<caution>
<para>
You should be aware that changing the default units actually changes
the model. If you, for example, change the default volume units from
liters to milliliters, all the particle numbers in your model change
by a factor of 1000.
</para>
</caution>
</para>
<para>
COPASI internally represents amounts of species by particle
numbers. If a concentration has to be displayed or is needed for some
output this is calculated from the particle number, the volume of the
compartment the species belongs to and Avogadro's number
(<inlineequation><mml:math><mml:mrow><mml:mn>6.0221415</mml:mn><mml:mo>*</mml:mo><mml:msup><mml:mn>10</mml:mn><mml:mn>23</mml:mn></mml:msup>
<mml:mfrac>
<mml:mi>particles</mml:mi><mml:mi>Mole</mml:mi></mml:mfrac></mml:mrow></mml:math></inlineequation>).
Lets assume that you have set your default volume units to fl and your
default substance units to nMol and species A is present in the amount
of
<inlineequation><mml:math><mml:mrow><mml:mn>1.0</mml:mn><mml:mo>*</mml:mo><mml:msup><mml:mn>10</mml:mn><mml:mn>15</mml:mn></mml:msup><mml:mi>
</mml:mi><mml:mi>particles</mml:mi></mml:mrow></mml:math></inlineequation>.
Further assuming that the volume of the compartment containing A is
set to
<inlineequation><mml:math><mml:mn>1.0</mml:mn></mml:math></inlineequation>
(fl), A would be present in a concentration of <inlineequation><mml:math>
  <mml:mfrac>
    <mml:mrow>
      <mml:mn>1.0</mml:mn><mml:mo>*</mml:mo><mml:msup><mml:mn>10</mml:mn><mml:mn>15</mml:mn></mml:msup><mml:mi> </mml:mi><mml:mi>particles</mml:mi>
    </mml:mrow>
    <mml:mrow>
      <mml:mn>6.0221415</mml:mn><mml:mo>*</mml:mo><mml:msup><mml:mn>10</mml:mn><mml:mn>23</mml:mn></mml:msup><mml:mi> </mml:mi><mml:mfrac><mml:mi>particles</mml:mi><mml:mi>Mole</mml:mi></mml:mfrac>
      <mml:mo>*</mml:mo>
      <mml:mn>1.0</mml:mn><mml:mi> </mml:mi><mml:mi> fl</mml:mi>
    </mml:mrow>
  </mml:mfrac>
</mml:math></inlineequation>. Since the default substance unit is set
to nMol instead of Mole we have to multiply the result by
<inlineequation><mml:math><mml:mrow><mml:mn>1.0</mml:mn><mml:mo>*</mml:mo><mml:msup><mml:mn>10</mml:mn><mml:mn>9</mml:mn></mml:msup></mml:mrow></mml:math></inlineequation>.
So COPASI would display a concentration of
<inlineequation><mml:math><mml:mn>1.661</mml:mn><mml:mrow><mml:mi>
</mml:mi><mml:mfrac><mml:mi>nMol</mml:mi><mml:mi>fl</mml:mi></mml:mfrac></mml:mrow></mml:math></inlineequation>. 
</para>
<para>
You are able to easily change the display between concentrations and particle numbers by selecting the drop down list in the menu bar at the top. COPASI, per default, displays the concentrations.
</para>
<para>
With the drop down list labeled <guilabel>Rate Law
Interpretation</guilabel> you can specify how COPASI should interpret
the kinetic rate laws you specify for your reactions. Per default,
COPASI will interpret all rate laws as deterministic rate laws. Since
COPASI allows the user to simulate a model either deterministically or
stochastically, COPASI has to make some corrections to deterministic
rate laws when using them for a stochastic simulation. This
functionality sometimes interferes with rate laws that have been
written for stochastic simulation and where the before mentioned
corrections have already been made by the modeler. So if you have a
model with rate laws that have been written be used in a stochastic
simulation, you have to specify this by selecting stochastic from this
drop down list. If you do this, COPASI will not apply any corrections
to the rate laws specified in the model when doing stochastic
simulation. 
</para>
<para>
With the edit field labeled <guilabel>Time (s)</guilabel> under
the text of <guilabel>Initial</guilabel> the user
can tell COPASI to take the given value as the initial time for tasks
like time course. For example, if you already have run a time course
simulation for 1000 seconds in another program and your model values
reflect the state of the model after those 1000 seconds of simulation,
you can continue your simulation at that time point by setting the
initial time to 1000. (This assumes that the models time units in the
same widget are set to seconds.) If you run a time course simulation
and check the <guilabel>update model</guilabel> box there, COPASI will
automatically set the initial time to the end time of the time course
simulation after running it. For more information on running time
course simulation is COPASI see <xref linkend="calculatingTrajectory" /> 
</para>
</sect1>
<sect1 id="addingCompartments" xreflabel="Compartments">
<title>Compartments</title>
<para>
In COPASI, most of the time there are several ways to do something and
you just choose the way you prefer. This is especially true for
defining the elements of the model.
</para>
<para>
Actually if you are just defining a model that has a single
compartment, you will most likely not even bother to add the
compartment explicitly, but we will come back to this in the <xref
linkend="addingSpecies" /> and <xref linkend="addingReactions" />
sections.
</para>
<para>
Although you will probably not add compartments to often, it is good
to know how it is done, especially since adding other components of
the model, e.g. species or reactions, works essentially the same.
</para>
<para>
There are three methods to add a new compartment to a model, but for
all three, we have to navigate to the
<guibutton>Compartments</guibutton> branch of the object tree which is
located under the <guibutton>Model-&gt;Biochemical</guibutton>
branch. So first open the <guibutton>Model</guibutton> branch and
there open the <guibutton>Biochemical</guibutton> branch by clicking
on the expansion sign in front of the branch name, or by double
clicking on the branch name.
</para>
<para>  
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Compartments_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Compartment table without entries</phrase>
 </textobject>
 <caption>
  <para>Empty compartment table</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
If you start with a new model and you select the
<guibutton>Compartments</guibutton> branch, you will get an empty
table with eight columns (see above). The columns are named
<guilabel>Status</guilabel>, <guilabel>Name</guilabel>, <guilabel>Type</guilabel> 
<guilabel>Initial Volume</guilabel>, <guilabel>Volume</guilabel>, <guilabel>Rate</guilabel>, <guilabel>Initial Expression</guilabel>
 and <guilabel>Expression</guilabel>.  The meaning of the
<guilabel>Status</guilabel> column will be explained below.
<guilabel>Name</guilabel> is the actual
name of the compartment.
The <guilabel>Type</guilabel> specifies how the transient volume of the compartment is
determined whereas the <guilabel>Initial Volume</guilabel> and the <guilabel>Volume</guilabel> columns
show the volume of the compartment before any calculations and after re-calculation, respectively.
These two values, given in the volume units defined in the <xref
linkend="generalSettings" /> dialog, should be the same if the type is set to <emphasis>fixed</emphasis>.
The <guilabel>Rate</guilabel> column show the rate of change of the compartment (if it has been set by a calculation). The <guilabel>Initial Expression</guilabel> and the <guilabel>Expression</guilabel> columns show the mathematical expressions used to calculate the initial compartments volume and the transient one, respectively. These fields are empty if no expressions has been set.</para>
<para>
The most obvious way to add a new compartment is to click the
<guibutton>New</guibutton> button on the bottom of the window. This
will create a new compartment that is added to the table with a status
of <emphasis>new</emphasis> (see below). 
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Compartments_02.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Compartment table with newly added compartment</phrase>
 </textobject>
 <caption>
  <para>Compartment table with new compartment</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
A status of <emphasis>new</emphasis> means that the compartment has been created, but it
has not been added to the model yet. It will get added to the model if
you either click on the <guibutton>Commit</guibutton> button on the
bottom of the screen, if you select another element in the object tree
on the left, or if you double click on the table. In case of clicking on the <guibutton>Commit</guibutton> button, you will notice
that the status of the new compartment is no longer defined as <emphasis>new</emphasis>
since it has been added to the model.
</para> 
<para>
While the status of a compartment is shown as
<emphasis>new</emphasis>, you can remove the compartment from the
table by clicking the <guibutton>Revert</guibutton> button which will
cancel all modifications you made to the compartments that have not
been committed yet.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Compartments_03.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Compartment table with deleted compartment entry</phrase>
 </textobject>
 <caption>
  <para>Compartment table with deleted compartment</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
If you have already committed the compartment, you can delete it by
selecting the table row (or one cell of the table row) that contains
the compartment you want to delete and clicking the
<guibutton>Delete</guibutton> button. You will notice that the
compartment does not get deleted at once, but rather the status
changes to <emphasis>delete</emphasis> (see above). You can still undo the delete
by clicking the <guibutton>Revert</guibutton> button or the
<guibutton>Delete/Undelete</guibutton> button, or you can finalize the
delete action by clicking on the <guibutton>Commit</guibutton>
button. Again leaving this dialog by selecting another object in the
object tree or double clicking on the table has the same effect as
clicking on the <guibutton>Commit</guibutton> button. 
</para>
<para>
The <guibutton>clear</guibutton> button is just a convenience function
to delete all compartments. If you click on it, the status of all
compartments in the table will be changed to
<emphasis>delete</emphasis> and a subsequent
<guibutton>Commit</guibutton> will remove the compartments from the
model.
</para>
<para>
The most convenient way to add a compartment is to just click on an
empty name cell in the table and type the name of the
compartment. Once you leave the cell by either hitting the return or
the tab key or by clicking somewhere else, the compartment appears in
the table with a status of <emphasis>new</emphasis>. Actually hitting
the return key after typing the name brings you directly into the next
row and you can continue adding compartments until all compartments
are defined. You now only have to commit your changes in one of the
ways mentioned above and all the compartments get added to the model.
</para>
<para>
The third way to add a new compartment is to double click on an empty
row in the table. This is essentially the same as clicking the
<guibutton>New</guibutton> button and double clicking on the newly
added compartment entry.
</para>
<para>    
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Compartments_04.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog for changing compartment parameters</phrase>
 </textobject>
 <caption>
  <para>Compartment definition dialog</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
Double clicking on any compartment entry in the table will bring you
to another input dialog that lets you specify the parameters of the
compartment (see above). For each compartment, you are able to change 
the name of the compartment, the type of simulation specifying how 
the compartment volume, or its rate of change, will be determined, and 
the initial volume.
</para>
<para>
The field labeled <guilabel>Volume</guilabel> specifies the
volume the compartment has right now, e.g. during or at the end of a
simulation. Since the current version of COPASI does not support
variable compartment volumes yet, this will always be the same as the
initial volume. 
</para>
<para>
As stated above, compartment volumes don't have to have a constant value
but they can be reassigned during e.g. a time course simulation depending 
the values of one or more model entities. In order to specify whether a compartment has a constant volume 
or the volume is calculated on the fly according to a mathematical expression,
the drop down list called <guilabel>Simulation Type</guilabel> can be used.
It contains three entries:
<table id="tbl.CompartmentSimulationType" frame="all"><title>Compartments Simulation Types</title>
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colwidth="1*" />
<colspec colwidth="4*" />
<thead>
 <row>
   <entry>Name</entry>
   <entry>Description</entry>
 </row>
</thead>
<tbody>
 <row>
   <entry>fixed</entry>
   <entry> the volume of the compartment has a constant value (which corresponds to the given initial value)</entry>
 </row>
 <row>
   <entry>assignment</entry>
   <entry>the volume of the compartment is determined by evaluating the given mathematical expression</entry>
 </row>
 <row>
   <entry>ode</entry>
   <entry>the rate of change of the compartments volume is determined by an ordinary differential equation</entry>
 </row>
</tbody>
</tgroup>
</table>
</para>
<para>
If you want the compartment to be calculated from a given mathematical expression you select the entry called <emphasis>assignment</emphasis> from the drop down list. This enables a text field where the mathematical expression can be entered.
</para>
<para>    
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Compartments_05.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Compartment widget with assignment rule</phrase>
 </textobject>
 <caption>
  <para>Compartment widget with assignment rule</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<caution>
<para>
Please note, it is not possible in COPASI to calculate the volume of a compartment through an assignment based on the concentration of a species contained in the compartment. The reason for this restriction is that COPASI preserves the amount of a species during calculation, which leads to the following equation for the concentration <inlineequation><mml:math>
  <mml:mrow>
    <mml:mi>[S]</mml:mi>
    <mml:mo>=</mml:mo>
    <mml:msup>
      <mml:mi>S</mml:mi>
      <mml:mi>#</mml:mi>
    </mml:msup>
    <mml:mo>/</mml:mo>
    <mml:mi>V</mml:mi>
  </mml:mrow>
</mml:math></inlineequation> and therefore <inlineequation><mml:math>
  <mml:mrow>
    <mml:mi>V</mml:mi>
    <mml:mo>=</mml:mo>
    <mml:msup>
      <mml:mi>S</mml:mi>
      <mml:mi>#</mml:mi>
    </mml:msup>
    <mml:mo>/</mml:mo>
    <mml:mi>[S]</mml:mi>
  </mml:mrow>
</mml:math></inlineequation>. Obviously, specifying any assignment for the compartment volume like <inlineequation><mml:math>
  <mml:mrow>
    <mml:mi>V</mml:mi>
    <mml:mo>=</mml:mo>
    <mml:mi>f</mml:mi>
    <mml:mo>(</mml:mo>
    <mml:mi>[S]</mml:mi>
    <mml:mo>)</mml:mo>
  </mml:mrow>
</mml:math></inlineequation> would lead to conflicting values.
</para>
</caution>
<para>
Likewise if you want the rate of change of the compartments volume to be determined by an ordinary differential equation (ode) you select the entry called <emphasis>ode</emphasis> from the drop down list.
</para>
<para>
Not only the transient volume of a compartment can be specified as a mathematical expression (see above), but also the initial one (see below).
If you want to specify such a mathematical expression for the initial volume of a compartment, check the check box called <guilabel>Use Initial Expression</guilabel>.
An initial expression can only be specified if the <guilabel>Simulation Type</guilabel> drop down list is either set to <emphasis>fixed</emphasis> or to <emphasis>ode</emphasis>. If the list is set to <emphasis>assignment</emphasis>, the given assignment automatically acts as an initial assignment and there is no need to specify an additional initial assignment.
</para>
<para>    
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Compartments_06.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Compartment widget with initial assignment</phrase>
 </textobject>
 <caption>
  <para>Compartment widget with initial assignment</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
The mathematical expressions that can be specified for rules and initial assignments may contain the same elements as the expressions used to defined function definitions. For a detailed description of the elements see <xref linkend="addingFunctions" />.
When it comes to referencing values of other model entities within mathematical expressions, there is a slight difference between the mathematical expression for a rule and that for an initial assignment. The mathematical expression for a rule may reference transient values of other model entities whereas the mathematical expression for an initial assignment may only reference initial values of other model entities.
</para>
<para>
As you might already have noticed, this dialog for changing
compartment parameters is associated with the individual compartment
leaves in the object tree. So if you want to change the parameters, you can also navigate to the leave in the object tree
that represents the compartment you want to change instead of double
clicking on an entry in the compartment table. 
</para>
<para>    
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Compartments_07.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Compartment widget with ode rule and initial assignment</phrase>
 </textobject>
 <caption>
  <para>Compartment widget with ode rule and initial assignment</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
If there are already species defined that are part of the compartment
being edited, they will be listed in the text widget at the bottom of the
dialog called <guilabel>Contained Species</guilabel>. Otherwise, you should add new species.
</para>

</sect1>

<sect1 id="addingSpecies" xreflabel="Species">
<title>Species</title>
<para>
Adding new species works exactly the same as adding new compartment,
so we strongly suggest reading the <xref linkend="addingCompartments" /> section
if you haven't already done so. Here we will just cover the
differences between adding a compartment and adding a species. 
</para>
<para>    
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Species_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Species table with new entry</phrase>
 </textobject>
 <caption>
  <para>Species table with new entry</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
First of all in order to add a new species, as it is
called in COPASI, you have to navigate to the
<guibutton>Species</guibutton> branch of the object tree which is
located in the <guibutton>Model-&gt;Biochemical</guibutton> branch
directly below the <guibutton>Compartments</guibutton>. Here
again you see a table (see above), but this table consists of nine columns. This
is due to the fact that a species has more parameters than a
compartment. The <guilabel>Status</guilabel> and
<guilabel>Name</guilabel> columns should already be familiar from the
compartments table. The other columns specify the compartment where
the species is located in,
the way the concentration of the species is calculated, initial
concentration of the species, the transient concentration, the rate of change of the species as well as two mathematical expressions used to determine the initial concentration and the transient one, respectively.
For newly created species the rate will be empty since
it needs to be calculated first, e.g. during a <link
linkend="calculatingTrajectory">time course simulation</link>.
</para>
<para>
When a species is added and the model does not contain a
compartment yet, COPASI will automatically add a new compartment to
the model and the species will be added to this compartment. If
there already is one or more compartments, the species will be
added to the first compartment in the list. This can be changed
later. 
</para>
<para>
To add a new species you have the same three ways as for adding
compartments and if you are not familiar with those, we recommend to
read the <xref linkend="addingCompartments" /> section first.
</para> 
<para>    
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Species_02.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog for changing species parameters</phrase>
 </textobject>
 <caption>
  <para>Species definition dialog</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
Editing the parameters of a species also works exactly the way it
does for compartments. Either you double click on a species entry
in the table, or you use the object tree to navigate to the species
leaf you intend to edit. The parameters of a species lying on below
the separator line are determined automatically and
can not be changed by the user. The parameters that you can change are
the <guilabel>Species Name</guilabel>, the
<guilabel>Compartment</guilabel> the species belongs to, and how the concentration is calculated.
Unless the Simulation Type is set to <emphasis>assignment</emphasis>, its <guilabel>Initial Concentration</guilabel> could also be changed. 
<!-- As the given assignment automatically acts as an initial assignment, there is no need to specify an additional initial assignment.
-->
</para>
<para>
If you would rather change the initial particle number instead
of the <guilabel>Initial Concentration</guilabel>, you should select <emphasis>Particle Numbers</emphasis>
in the drop down list in the menu bar at the top. This will change all displays in the program to use particle numbers
rather than concentrations and you can now enter the 
<guilabel> Initial Particle Number</guilabel> (note the label will be changed).
The volume used to calculate particle numbers from concentration 
comes from the compartment associated with the species. 
<!-- Although per default COPASI displays the concentrations, it internally represents amount of species by particle numbers. -->
If you change back to initial concentration, COPASI will internally recalculate the initial particle number.
<caution><para>
  In some situations COPASI will prevent the user from changing the initial concentration. This is done when changing the concentration would lead to circular dependencies during the calculation of all initial values. The cause for this is most likely an assignment rule for the containing compartment. In such a case it is still possible to change the initial particle number.
</para></caution>
</para>

<para>
Normally the concentration of a species is determined by its initial concentration and by the reaction kinetics of the reactions it participates in either as a substrate or a product. The reactions are listed at the bottom of the species widget (see above).
</para>
<para>
<table id="tbl.SpeciesSimulationType" frame="all"><title>Species Simulation Types</title>
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colwidth="1*" />
<colspec colwidth="4*" />
<thead>
 <row>
   <entry>Name</entry>
   <entry>Description</entry>
 </row>
</thead>
<tbody>
 <row>
   <entry>reactions</entry>
   <entry> the concentration/amount of the species is determined by the kinetic laws of the reactions that modify the species</entry>
 </row>
 <row>
   <entry>fixed</entry>
   <entry> the concentration/amount of the species has a constant value (which corresponds to the given initial value)</entry>
 </row>
 <row>
   <entry>assignment</entry>
   <entry>the concentration/amount of the species is determined by evaluating the given mathematical expression</entry>
 </row>
 <row>
   <entry>ode</entry>
   <entry>the rate of change of the species volume is determined by an ordinary differential equation</entry>
 </row>
</tbody>
</tgroup>
</table>
Newer versions of COPASI also allow the concentration of a species to be determined by a mathematical expression or by providing an ordinary differential equation for its rate of change.
In order to specify whether a species has a constant volume, it is determined by reactions, 
or its volume is calculated on the fly according to a mathematical expression,
the drop down list called <guilabel>Simulation Type</guilabel> should be used. It contains four entries listed on the above table.
</para>
<para>
If you want the species to be calculated from a given mathematical expression you select the entry called <emphasis>assignment</emphasis> from the drop down list. This enables a text field where the mathematical expression can be entered (see below). Likewise if you want the rate of change of the species concentration to be determined by an ordinary differential equation (ode) you select the entry called <emphasis>ode</emphasis> from the drop down list.
</para>
<para>    
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Species_03.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Species widget with assignment rule</phrase>
 </textobject>
 <caption>
  <para>Species widget with assignment rule</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<!--
<para>
Likewise if you want the rate of change of the species concentration to be determined by an ordinary differential equation (ode) you select the entry called <emphasis>ode</emphasis> from the drop down list.
</para>
-->
<para>    
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Species_04.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Species widget with constant species and initial assignment</phrase>
 </textobject>
 <caption>
  <para>Species widget with constant species and initial assignment</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
Not only the transient concentration of a species can be specified as a mathematical expression, but also the initial concentration of the compartment.
If you want to specify such a mathematical expression for the initial concentration of a species, check the check box called <guilabel>Use Initial Expression</guilabel>.
<!-- An initial expression can only be specified if the <guilabel>Simulation Type</guilabel> drop down list is either set to <emphasis>fixed</emphasis>, <emphasis>reactions</emphasis> or to <emphasis>ode</emphasis>. If the list is set to <emphasis>assignment</emphasis>, the given assignment automatically acts as an initial assignment and there is no need to specify an additional initial assignment.
-->
An initial expression can be specified unless the <guilabel>Simulation Type</guilabel> drop down list is set to <emphasis>assignment</emphasis>. Since the given assignment automatically acts as an initial assignment, there is no need to specify an additional initial assignment.
</para>
<para>    
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Species_05.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Species widget with ode rule and initial assignment</phrase>
 </textobject>
 <caption>
  <para>Species widget with ode rule and initial assignment</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
The mathematical expressions that can be specified for rules and initial assignments may contain the same elements as the expressions used to defined function definitions. For a detailed description of the elements see <xref linkend="addingFunctions" />.
<!-- When it comes to referencing values of other model entities within mathematical expressions, there is a slight difference between the mathematical expression for a rule and that for an initial assignment. The mathematical expression for a rule may only reference transient values of other model entities whereas the mathematical expression for an initial assignment may only reference initial values of other model entities.
-->
When it comes to referencing values of other model entities within mathematical expressions, there is a slight difference between the mathematical expression for a rule and that for an initial assignment. The former may reference transient values of other model entities whereas the latter may only reference initial values of other model entities.
</para>

</sect1>
<sect1 id="addingReactions" xreflabel="Reactions">
<title>Reactions</title>
<para>
Again adding reactions essentially works the same way as adding
compartments or species. 
When you navigate to the
<guibutton>Reactions</guibutton> branch of the object tree which is
located under the <guibutton>Model-&gt;Biochemical</guibutton> branch,
you will see a table with five columns. The first two are
<guilabel>Status</guilabel> and <guilabel>Name</guilabel> of the
reaction. The third column called <guilabel>Equation</guilabel>
describes the chemical formula and maybe additional modifiers of the
reaction. The fourth column states the name of the kinetics for the
reaction which depends on the equation. We will come to this in a
second. The last column shows the <guilabel>flux</guilabel> through
this reaction. The flux can not be set by  the user but is calculated
automatically when you <link linkend="calculatingTrajectory">do a time
course simulation</link>.
</para>
<para>
The easiest way to add a reaction is to type the chemical equation
into an empty equation cell in the table. After you typed the
equation, you hit the return key and automatically land in the next
row where you can type the next reaction equation. This way you can
enter all the reactions that make up your model. When you are finished
with typing the reaction equations, you commit all the reactions. If
any of the reactions contain species that are not already present
in the model, they are added automatically. If there was no
compartment before, a compartment is also added and all new
species get added to this compartment. If there is already one or
more compartments, all new species get added to the first
compartment that is listed in the object tree. 
</para>
<caution>
<para>
When typing reaction equations you should keep in mind that species
names in COPASI can contain characters like "+" or even
white-spaces. Since these characters would make it very hard if not
impossible to parse the chemical reaction equation, you have to place
those species names in double quotes. E.g. "Species 1" +
"Species 2" -> "Species 3". No matter if your species names
contain special characters or not, the species names have to be
separated from the reaction symbols ( "+" , "=" and "->" ) by
white-spaces. 
</para>
</caution>
<para>    
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Reactions_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Reaction table with new entry</phrase>
 </textobject>
 <caption>
  <para>Reaction table with new entry</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
Each new reaction gets a default kinetic which is irreversible mass
action for reactions that contain a substrate. For reaction that only
have a product (e.g. influx into a system) a constant flux kinetic is
chosen.
</para>  
<para>    
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Reactions_02.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog for changing reaction parameters</phrase>
 </textobject>
 <caption>
  <para>Reaction definition dialog</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
Double clicking on an entry in the table will bring you to another
dialog that lets you change certain parameters of the reaction. You
can change the name of the reaction, the chemical equation and whether
the reaction is reversible or not. Changing the chemical equation and
the reversibility of a reaction influences the type of kinetics you
can choose for the reaction. Each kinetic function defines how many
substrates, products and modifiers it expects. Additionally it defines
whether it can be used for reversible or irreversible reactions only
or if it can be used on either. So depending on how many substrates,
products and modifiers your kinetic equation has and whether it is
reversible or not, only a subset of the defined kinetic functions will
be available in the <guilabel>Kinetics</guilabel> combo box. If the
kinetic function you want to assign to the reaction is not available
yet, you can add it by clicking on the <guibutton>New Rate
Law</guibutton> button (see also <xref linkend="addingFunctions"
/>). Depending on the kinetic function you chose, you get a selection
of parameters in the table named <guilabel>Symbol
Definition</guilabel>, all functions parameters get a default value of
0.1 which can be changed by clicking into the corresponding cell and
typing a new value.
</para>
<para>
Per default all parameters to a kinetic function are local parameters
and they exist only in the scope of the rate law of one
reaction. Sometimes it is of advantage to use the same parameter in
the rate laws for several reactions. This way if you want to change to
value of this parameter, you only have to change it in once instead of
having to change it in every reaction it occurs in
individually. Parameters that can be used in more than one reaction
are called global quantities
<!-- (of type <emphasis>fixed</emphasis>) --> in COPASI.
How you add
a global quantity to your model is described in the section called
<xref linkend="globalQuantities" />. Let us for the moment assume you
already added such a global quantity to your model and now want to use
it in a rate law. Each parameter in the <guilabel>Symbol
Definition</guilabel> table has a check box labeled
<guilabel>global</guilabel>. When you check this box, COPASI knows
that the parameter that belongs to it is a global quantity and lets
you select one from a list of global quantities that have been defined
in the model. If none have been defined yet, the list contains only an
entry termed <guilabel>unknown</guilabel>. In this case, you will have
to define one or more global quantities first and then come back to
the reaction where you want to use it. If the name of the global
quantity is set to the <emphasis>unknown</emphasis> term, COPASI will
reset the type of parameter to local if you leave the reaction widget.
</para>
<para>
So far we did not go into the details of how chemical equations are to
be specified. Chemical equations have a simple schema. First you state
all the substrates separated by  "+" characters. Please make sure that
you separate the name of the substrate and the "+" character by at
least one space character, otherwise COPASI will interpret the "+"
sign as belonging to the species name. (Having the "+" character
as part of a species name is allowed in COPASI !) after the list of
substrates, you specify either an equals ("=") character if the
reaction is reversible or the character combination "-&gt;" if the
reaction is irreversible. This is followed by the list of products
which must also be separated by the "+" character. Again make sure you
have spaces around the separating "+" characters. Optionally this term
can be followed by a semicolon and a list of modifiers which are
separated by spaces. Either the list of substrates or the list of
products may also be empty, but at least one of them must be
present. Lets look at two examples: 
<orderedlist numeration="loweralpha" >
<listitem><para>
Species A is irreversibly converted into Species B. The chemical
equation you would type is "A -&gt; B".
</para></listitem> 
<listitem><para>
Species A and B are reversibly converted to Species C, the
reaction has 2 modifiers C and D. The chemical equation for this in
COPASI would be: "A + B = C; C D"</para><para>Note that one of the
modifiers is the product!
</para></listitem>  
</orderedlist>   
</para>
<caution>
<para>
If the reaction takes place in one compartment, the reaction kinetic
specifies a rate of concentration change, whereas if the reaction
takes place in several compartments, the kinetic specifies the amount
of substance change over time.
</para>
<para>
E.g. in the reaction A -> B, if A and B are in the same compartment,
the kinetic function for the reaction returns its result in
mol/(l*s). If A and B reside in different compartments, the result is
returned in mol/s. (This assumes that your default units are set to
mol, l and s.)
</para>
</caution>
</sect1>

<sect1 id="globalQuantities" xreflabel="Global Quantities">
<title>Global Quantities</title>
<para>
In the model tree right below the <guibutton>Reaction</guibutton>
branch is the <guibutton>Global Quantities</guibutton> branch. If you
select this branch, you see a table with all the global quantities
that have been defined in your model. When you start a new model this
table, just like all the others so far, is empty (see below). The table has eight
columns and the ones named <guilabel>Status</guilabel> and
<guilabel>Name</guilabel> should by now be already familiar. The third
column specifies the type of the global quantity. There are three
alternatives for that: 
<emphasis>fixed</emphasis> means the global quantity has a
constant value (that can be used as a global parameter), 
<emphasis>assignment</emphasis> means the value of the quantity is calculated from a mathematical expression, and <emphasis>ode</emphasis>.
If the type is <emphasis>ode</emphasis> the quantity is treated as a variable of the model and a differential equation for this variable can be
provided. The forth and fifth column contain the initial and transient
value of the global quantity as well as the rate of change of the value is displayed on the sixth column. 
The last two columns contains the mathematical expressions which may be required as long as the type is not <emphasis>fixed</emphasis>.
</para>
<para>
As with all other model elements, you can choose how you want to add a
global parameter. The most convenient way is to just enter a name in
an empty cell of the column termed <guilabel>Name</guilabel>. 
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/GlobalQuantities_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Global quantities table with three entries</phrase>
 </textobject>
 <caption>
  <para>Global quantities table with three entries</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
If you click on the name of a global quantity in the tree on the left
or double click on a row of the table only the information correlated with 
the chosen global quantity will be displayed. 
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/GlobalQuantities_02.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Global quantity user interface with ode rule</phrase>
 </textobject>
 <caption>
  <para>Global quantity user interface with ode rule</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
Just as compartments and species, global quantities do not have to be a constant
but can be reassigned during e.g. a time course simulation depending 
the values of one or more model entities. In order to specify whether a parameter has a constant value 
or the value is calculated on the fly according to a mathematical expression,
the drop down list called <guilabel>Simulation Type</guilabel> should be used.
The drop down list contains three following entries:
<table id="tbl.GlobalQuantitiesSimulationType" frame="all"><title>Global Quantities Simulation Types</title>
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colwidth="1*" />
<colspec colwidth="4*" />
<thead>
 <row>
   <entry>Name</entry>
   <entry>Description</entry>
 </row>
</thead>
<tbody>
 <row>
   <entry>fixed</entry>
   <entry> the value of the parameter is constant (which corresponds to the given initial value)</entry>
 </row>
 <row>
   <entry>assignment</entry>
   <entry>the value of the parameter is determined by evaluating the given mathematical expression</entry>
 </row>
 <row>
   <entry>ode</entry>
   <entry>the rate of change of the parameters value is determined by an ordinary differential equation</entry>
 </row>
</tbody>
</tgroup>
</table>
</para>
<para>
If you want the parameters value to be calculated from a given mathematical expression you select the entry called <emphasis>assignment</emphasis> from the drop down list. This enables a text field where the mathematical expression can be entered. Likewise if you want the rate of change of the parameters value to be determined by an ordinary differential equation (ode) you select the entry called <emphasis>ode</emphasis> from the drop down list.
</para>
<para>
Not only the transient value of a parameter can be specified as a mathematical expression, but also the initial value of the parameter.
If you want do specify such a mathematical expression for the initial volume of a compartment, check the check box called <guilabel>Use Initial Expression</guilabel>.
An initial expression can only be specified if the <guilabel>Simulation Type</guilabel> drop down list is either set to <emphasis>fixed</emphasis> or to <emphasis>ode</emphasis>. If the list is set to <emphasis>assignment</emphasis>, the given assignment automatically acts as an initial assignment and there is no need to specify an additional initial assignment.
</para>
<para>    
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/GlobalQuantities_03.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Global quantity widget with an initial assignment</phrase>
 </textobject>
 <caption>
  <para>Global quantity widget with an initial assignment</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
The mathematical expressions that can be specified for rules and initial assignments may contain the same elements as the expressions used to defined function definitions. For a detailed description of the elements see <xref linkend="addingFunctions" />.
When it comes to referencing values of other model entities within mathematical expressions, there is a slight difference between the mathematical expression for a rule and that for an initial assignment. 
The former may reference transient values of other model entities whereas the latter may only reference initial values of other model entities.
</para>

<para>
Even so COPASI does not support building models from ordinary
differential equations, one can specify a model as a set of
differential equations using a set of global parameters which have the
type ode.
</para>
</sect1>
<!--
<sect1 id="events" xreflabel="Events">
<title>Events</title>
<para>An event in COPASI sets the values of one or more model elements at a certain point in time. The exact timepoint at which the assignments are executed depends on a condition called trigger and on an optional time delay.</para>
<para>
In order to be usable, an event needs a trigger expression that determines when an event takes place. The trigger expression is a mathematical expression which returns a boolean value. In order to return a boolean value (true, false), the expression must use comparison operators lt, le, eq, gt or ge. Theoretically a boolean expression can also consists of just the constants true or false, this does not make much sense as well be explained shortly.
Naturally the trigger expression can also be a combination of boolean subexpressions that are combined by logical operators <emphasis>and</emphasis>, <emphasis>or</emphasis>, <emphasis>not</emphasis> and <emphasis>xor</emphasis>. 
</para>
<para>
-->
<!--
Expression Examples
-->
<!--
</para>
<para>
As described above, the trigger expression determines when an event is triggered. The exact point when the event is triggered is that point in time where the result of the evaluated trigger expression changes from false to true. The event is triggered each time this happens, so an event can be triggered more than once. If the result of the trigger expression is true at the start of a simulation, the event is not triggered since the result of the expression did not make a transition from true to false.
</para>
<para>
Since an event is only triggered when the trigger expression makes a transition from true to false, it does not make much sense to use the constants <emphasis>true/TRUE</emphasis> or <emphasis>false/FALSE</emphasis> within the trigger expression.
</para>
<para>
Since computers usually calculate numbers with limited precision, it is not always easy to for a program to find out if an event has been triggered or not. But in most cases it is possible to come up with trigger expressions that make this takes a bit easier.
</para>
<para>
Even so, as has been described above, one can build trigger expressions, using all comparison operators, only <emphasis>lt</emphasis> and <emphasis>gt</emphasis> make sense. One could also use <emphasis>le</emphasis> and <emphasis>ge</emphasis> respectively to build trigger expressions, but due to the limited precision of the calculations, this is numerically the same as using <emphasis>lt</emphasis> and <emphasis>gt</emphasis>. While using <emphasis>le</emphasis> and <emphasis>ge</emphasis> is just redundant, using <emphasis>eq</emphasis> or <emphasis>ne</emphasis> to build trigger expressions will most likely lead to undesirable effects, meaning that the program will most likely not be able to find out that the trigger expression has changed from false to true. Why is this?
</para>
<para>
The algorithms that are used to calculate a time course in COPASI  do not calculate values for all possible time points between the start time and the endtime because there is an infinity number of those. All the algorithm can do is calculate values for all model entities for a finite number of steps between the start and the endtime. "Smart" algorithms even go one step further and try to limit the number of steps to the necessary minimum. But exactly herin lies the problem if <emphasis>eq</emphasis> and <emphasis>ne</emphasis> are used to build trigger expressions. The trigger expressions are calculated for each time step that the solver makes, that means that the trigger expressions are evaluated at discrete time points. So if a trigger expression evaluates to false at timepoint n and evaluates to true at timepoint n+1, the solver knows that the event has been triggered and can now try to located the exact timepoint where the event has been triggered which must be located somewhere between timepoint n and timepoint n+1. Now lets assume that we have a trigger expression "time eq 3.1", this expression evaluates to true when the simulation time is exactly 3.1, everywhere else, this expression evaluates to false. So lets also assume that the solver calculates one time step at t=3.0 and the next time step after that at t=3.2. At both of those time steps, the trigger expression above would evaluate to <emphasis>false</emphasis> and the algorithm would assume that the event has not been triggered at all. So it is very important to think about how to build trigger expressions. If you wanted to express that the event should fire once when the simulation has reached time=3.1 you could have written "time gt 3.1" instead "time eq 3.1". 
</para>
<para>
This problem is not restricted to the logical operators <emphasis>eq</emphasis> and <emphasis>ne</emphasis>, but it is generally also a bad idea to use the logical <emphasis>and</emphasis> to build logical expressions in COPASI. E.g. the expression "(time gt 3.05) and (time lt 3.06)" suffers from the same general problem. The time span in which the expression is <emphasis>true</emphasis> might be to short for the simulation algorithm to recognize that the event has been triggered. 
</para>
<para>
While most event triggers can be expressed in COPASI without problems, some can't be expressed in a safe way and you should be aware of this problem when you use logical expressions anywhere in COPASI, e.g. in an <emphasis>if</emphasis> statement within a algebraic expression.
</para>
<para>
In addition to the trigger, the user can set a so called delay expression. This expression is evaluated when the event is triggered and the numerical result from evaluating the expression is the time delay from the time point when the event was triggered until the assignments actually happen. The delay expression is a normal mathematical expression and it has to evaluate to a positive number or zero. Negative numbers are not allowed because this would mean that the assignments would have to be made before the event has even been triggered.
</para>
<para>
Last but not least, each event can have one or more assignments which consists of a model entity (compartment, species or global parameter) that is the target for the assignment and an expression that determines the value that the target is set to. This is very similar to setting an assignment on a model entity as described in , the only difference is that the event assignment is only executed if the event has been triggered whereas the normal assignment is done in each timestep of a simulation.
</para>
<para>
There are a few more things one has to be aware of when working with events in COPASI. Firstly, the values for the event assignments are calculated when an event is fired, that is if an event assignment references some model entity in the assignment expression, the value taken to evaluate the assignment expression is the value that the model entity has at the time the event is triggered. So if the same event also has a delay that is not zero, the assignment values are calculated when the event is triggered, but they are only applied once the delay time has passed.
</para>
<para>
The second thing one has to be aware of is the fact that event assignments within the same event do no influence each other and that the order of the event assignments is irrelevant for the calculations. All values that are referenced in an event assignment are taken prior to applying any event assignments. That is if there is an event assignment for species A which references species B and vice versa within the same event, it does not matter which event assignment is applied first, the result is always the same since the referenced values are taken before any of the two events is applied.
</para>
<para>
Last but not least, it is possible that applying the assignments of an event triggers one or more other events. The order in which those events are fired is the order in which they have been defined in the model since this is the order in which the solver will find that they have fired. The values referenced in those events fired by other events are taken after all assignments from the event that has lead the other event(s) to fire, have been applied.
</para>
<para>
Since the assignments in one event can lead to the triggering of other events, a whole cascade of events can be triggered by one event being fired and sometimes this can lead to infinity loops within the event cascade. It is not trivial to find out if an event cascade is actually infinite or only very long. If any event within a cascade is fired a second time with exactly the same state of the model, we can assume that the cascade would be infinite (I am not sure if this is actually true due to the branching that can happen in the cascade) and COPASI will stop evaluating the events and interrupt the simulation with an error message. COPASI will also stop to evaluate event if the number of events in the event cascade has exceeded a certain limit (10000). 
</para>
<para>
-->
<!--
Do we execute events depth first or breadth first? This might make a difference!
-->
<!--
</para>
</sect1>
-->
<sect1 id="annotation" xreflabel="annotation">
<title>Annotating models and model elements</title>
<para>
Sometimes it would be beneficial to include additional information in a model that describes the model creation process or that gives biological information about the individual model elements. Especially when you get a model from someone or load some published model from the authors webpage or some model repository, this information sometimes comes in handy.
</para>
<para>
In order to standardize the process of model annotation, the <ulink url="http://www.ebi.ac.uk/miriam/">MIRIAM (Minimal Information Requested in the Annotation of biochemical Models)</ulink> guidelines have been developed at the EBI in Hingston. These guidelines specify what information is needed to create properly annotated models that are suitable for publication.
</para>
<para>
Current versions of COPASI allow the user to annotate the model and all model elements according to the MIRIAM guidelines.
For this, the model widget, as well as the widgets for the compartment, the species, the reaction and the global quantities have two additional tabs at the top of the widgets. One tab is called <guibutton>Annotation</guibutton> the other tab is called <guibutton>RDF Browser</guibutton>. 
</para>
<screenshot>
<screeninfo>Produced with COPASI 4.4 (Build 29) on Leopard on 12/15/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/MIRIAM_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Widget showing the annotation to model 123 from the biomodels database.</phrase>
 </textobject>
 <caption>
  <para>Annotation widget with annotation from model 123 from biomodels</para>
 </caption> 
</mediaobject>
</screenshot>
<para>
Before you use the annotation feature for the first time, you have to update the MIRIAM annotation that COPASI uses to create the list of ressources that can be associated with an element. You update the list by pressing the the <guibutton>update MIRIAM</guibutton> button in the toolbar. Pressing this button triggers the download of the MIRIAM ressources from the internet, so this will only work if you are connected to the internet (once this is done, you should restart COPASI).
</para>
<para>
COPASI (as well as SBML) use RDF (Ressource Description Framework) to store the annotation in the model file. To view the resulting RDF tree, you can select the <guibutton>RDF Browser</guibutton> tab. This is purely for displaying and not for editing. You will probably not look at this information very often.
</para>
<para>
If you select the <guibutton>Annotation</guibutton> tab, the same annotation is presented in a more user friendly way. There are different pieces of information that can be  given for a certain model element, e.g. the author you added the element or created the model or for species some biological information to the identity of the species.
</para>
<para>
Each piece of information is stored as a triplet that is composed of the relationship, the ressource for that relationship and the corresponding id. The relationship can be chosen from a limited set of relationships. The same goes for the ressource. E.g. if you want to specify that species A in the model corresponds to ATP, the relationship would be set to <emphasis>is</emphasis> and the ressource could for example be the <ulink url="http://www.ebi.ac.uk/chebi/">ChEBI (Chemical Entities of Biological Interest)</ulink> dictionary. The id would then be the ChEBI identifier for ATP, which is <ulink url="http://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI%3A15422">CHEBI:A15422</ulink>.
</para>
<para>
The COPASI GUI allows the user to store more information than the MIRIAM guidelines for SBML allow, so if you export your model to SBML after annotating it, some information might not be available for other SBML tools.
</para>
<para>
There is also a <ulink url="http://www.copasi.org/tiki-index.php?page_ref_id=155">webpage</ulink> on the COPASI webserver that has some more technical details about the way annotations are stored in COPASI.
</para>
</sect1>

<sect1 id="parameterView" xreflabel="Parameter View">
<title>Parameter View</title>
<para>
The parameter view widget can be displayed by selecting the leaf
called <guilabel>Parameter Overview</guilabel> on the <guibutton>Model-&gt;Biochemical</guibutton> branch (see below).
<!--which is located right underneath the <guilabel>Global
Quantities</guilabel> leaf. --> This widget allows you to view and edit
all parameters of the model in one place. This saves you from moving
around the model tree if you e.g. first have to edit the initial
concentrations for some species and afterward parameters of one or
more reactions. The view shows you the initial concentrations for the
species at the top followed by the initial time and the volumes of
all the compartments and at the bottom the kinetic parameters of all
reactions. 
</para>
<para>
In order to change a value, you double click on it which
lets you input a new value. On hitting the return key or clicking
somewhere else, the new value is not written to the object directly,
but a '*' character appears in front of the name of the changed
parameter. If you now leave this widget or press the <guibutton>Commit</guibutton> button at
the bottom of the dialog, the new value is written to the
corresponding object in the model. 
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Parameters_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Parameter View</phrase>
 </textobject>
 <caption>
  <para>Parameter View</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
</sect1>

<sect1 id="addingFunctions" xreflabel="User Defined Functions">
<title>User Defined Functions</title>
<para>
COPASI already defines a large set of commonly used kinetic functions
to choose from. The list of defined functions is located at the last branch in the object tree. 
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/18/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Functions_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Function table with predefined functions</phrase>
 </textobject>
 <caption>
  <para>Function table</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
Nevertheless sometimes you need to define your own kinetic function to solve a specific problem. COPASI enables you to add a new function either by double clicking on an empty table row or by clicking on the <guibutton>New</guibutton> button on the bottom of the screen. 
In the function definition dialog, you give your function a name in the <guilabel>Function Name</guilabel> field. 
This name has to be unique within the list of defined functions. Next, you
have to specify a formula that defines the reaction rate of your
kinetic function in the <guilabel>Formula</guilabel> field. The
function string only covers the right side of the rate function. 
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 03/07/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Functions_02.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog for the definition of functions</phrase>
 </textobject>
 <caption>
  <para>Function definition dialog</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
So for Michaelis-Menten which is defined as <!-- <phrase -->
<!-- role="math">v=(V*E*S)/(Km+S)</phrase> --> 
  <inlineequation><mml:math>
    <mml:mrow>
      <mml:mi>v</mml:mi>
      <mml:mo>=</mml:mo>
      <mml:mrow>
        <mml:mi>V</mml:mi>
        <mml:mo>*</mml:mo>
        <mml:mrow>
          <mml:mo>(</mml:mo>
            <mml:mrow>
             <mml:mi>S</mml:mi>
             <mml:mo>/</mml:mo> 
              <mml:mrow>
                <mml:mo>(</mml:mo>
                  <mml:mrow>
                    <mml:msub>
                      <mml:mi>K</mml:mi>
                      <mml:mi>m</mml:mi>
                    </mml:msub>
                    <mml:mo>+</mml:mo>
                    <mml:mi>S</mml:mi>
                  </mml:mrow>    
                <mml:mo>)</mml:mo>    
              </mml:mrow>
            </mml:mrow>      
          <mml:mo>)</mml:mo>
        </mml:mrow>
      </mml:mrow>
    </mml:mrow>
  </mml:math></inlineequation>
 you would enter <!-- <phrase role="math">(V*E*S)/(Km+S)</phrase> -->
  <inlineequation><mml:math>
    <mml:mrow>
      <mml:mi>v</mml:mi>
      <mml:mo>=</mml:mo>
      <mml:mrow>
        <mml:mi>V</mml:mi>
        <mml:mo>*</mml:mo>
        <mml:mrow>
          <mml:mo>(</mml:mo>
            <mml:mrow>
             <mml:mi>S</mml:mi>
             <mml:mo>/</mml:mo> 
              <mml:mrow>
                <mml:mo>(</mml:mo>
                  <mml:mrow>
                    <mml:msub>
                      <mml:mi>K</mml:mi>
                      <mml:mi>m</mml:mi>
                    </mml:msub>
                    <mml:mo>+</mml:mo>
                    <mml:mi>S</mml:mi>
                  </mml:mrow>    
                <mml:mo>)</mml:mo>    
              </mml:mrow>
            </mml:mrow>      
          <mml:mo>)</mml:mo>
        </mml:mrow>
      </mml:mrow>
    </mml:mrow>
  </mml:math></inlineequation>
into the <guilabel>Formula</guilabel> field. While you are typing the
formula, COPASI already tries to parse the equation and extract the
parameters. All parameters that COPASI finds are listed in the
<guilabel>Parameters</guilabel> table. 
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 03/07/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Functions_03.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Function definition dialog with committed function</phrase>
 </textobject>
 <caption>
  <para>Function definition dialog with graphical display of the function</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
In COPASI parameters can have
arbitrary names, there are only a few rules that one has to be aware
of. If a parameter starts with a letter or underscore character and
contains only letters, digits and underscore characters all is well,
if however the parameter name contains other characters, the whole
parameter name has to be enclosed in double quotes. If the parameter
name contains double quotes or backslashes those have to be escaped by
a backslash. 
</para>
<para>
<!-- Per default all variables found are defined as being
<emphasis>Parameters</emphasis>. You have to specify the correct type of variables by selecting one from the drop down list called <guilabel>Description</guilabel>. -->
<!-- You have to specify which of them
really are parameters and which are substrates, products,
modifiers, time or volume by selecting one from the dropdown list called <guilabel>Description</guilabel>. -->
As all variables found are defined, per default, as
<emphasis>Parameters</emphasis>, you should specify their correct types by selecting one from the drop down list <guilabel>Description</guilabel>.
<!-- This mapping of variable names to a specific function
within the equation also defines the type of reactions this function
can be used for. -->
However, the specific type of variables <!-- within the formula equation --> will affect to the type of reactions the function can be used for.
E.g, if you define the function to contain two
substrates and a modifier, you can later only use it for reactions
that really do have two substrates.
<note><para>The restrictions on
the number of modifiers is not strict since substrates and
reactants could act as modifiers. So the above mentioned rate law
could be used on reactions that do not explicitly specify a
modifier.</para></note> You can also see this in the
<guilabel>Application restrictions</guilabel> table below the
<guilabel>Parameters</guilabel> table. Let's say you define the
function <!-- <phrase role="math">A*B</phrase> --> 
  <inlineequation><mml:math>
    <mml:mrow>
      <mml:mi>A</mml:mi>
      <mml:mo>*</mml:mo>
      <mml:mi>B</mml:mi>
    </mml:mrow>
  </mml:math></inlineequation>  
and define <emphasis>A</emphasis> and <emphasis>B</emphasis> to be
substrates, you will see that the <guilabel>Application
restrictions</guilabel> say that there must be exactly two substrates
in the reaction for that kinetics to be applicable. After defining
this function, you will be able to use it for all chemical reaction
that have exactly two substrates. Last but not least, you have to
define whether this function can be applied to reversible,
irreversible or both reaction types by selecting the
<guilabel>reversible</guilabel>, <guilabel>irreversible</guilabel> or
<guilabel>General</guilabel> radio button respectively. You can also
call other functions from function definitions. There are four things
you have to watch out for when you call a function within another
function. 
<orderedlist>
<listitem>
<para>
Recursive function calls are not permitted. That is a function may not
call itself, neither directly nor by calling another function that
might call the first function again further along the line. 
</para>
</listitem>
<listitem>
<para>
You have to specify the correct number of arguments to the function called.
</para>
</listitem>
<listitem>
<para>
You have to specify the correct argument types to the function
call. I.e. if you call "Henry-Michaelis-Menten (irreversible)" from
within another function, you have to make sure that the first call
argument has a usage of <emphasis>Substrate</emphasis> and the other two have the usage <emphasis>Parameter</emphasis>. 
</para>
</listitem>
<listitem>
<para>
Which brings me to the last point. The built in function names in
COPASI often use characters like "-" or even spaces, so if you want to
call one of those functions, you have to quote this function name. So
calling "Henry-Michaelis-Menten (irreversible)" from another function
would look like this: 
<equation id="eq.HenryMichaelisMenten"><mml:math display="block">
    <mml:mrow>
      <mml:mi>"Henry-Michaelis-Menten (irreversible)"</mml:mi>
      <mml:mo> &ApplyFunction; </mml:mo>
      <mml:mo> ( </mml:mo>
      <mml:mi>S</mml:mi>
      <mml:mo> , </mml:mo>
      <mml:mi>Km</mml:mi>
      <mml:mo> , </mml:mo>
      <mml:mi>V</mml:mi>
      <mml:mo> ) </mml:mo>
    </mml:mrow>
  </mml:math></equation>
</para>
</listitem>
</orderedlist>
After you commit the function, you can use it for the definition of
reactions.
</para>
<para>
The operators and functions that COPASI knows and therefore can be
used to create user defined functions are the following: 

<table id="tbl.StandardOperators" frame="all"><title>Standard Operators</title>
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colwidth="1*" />
<colspec colwidth="2*" />
<thead>
 <row>
   <entry>Operator/Function</entry>
   <entry>Description</entry>
 </row>
</thead>
<tbody>
 <row>
   <entry>+</entry>
   <entry>plus operator</entry>
 </row>
 <row>
   <entry>-</entry>
   <entry>minus operator</entry>
 </row>
 <row>
   <entry>/</entry>
   <entry>division operator</entry>
 </row>
 <row>
   <entry>*</entry>
   <entry>multiplication operator</entry>
 </row>
 <row>
   <entry>%</entry>
   <entry>modulus operator</entry>
 </row>
 <row>
   <entry>^</entry>
   <entry>power operator</entry>
 </row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table id="tbl.MiscellaneousFunctions" frame="all"><title>Miscellaneous Functions</title>
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colwidth="1*" />
<colspec colwidth="2*" />
<thead>
 <row>
   <entry>Operator/Function</entry>
   <entry>Description</entry>
 </row>
</thead>
<tbody>
 <row>
   <entry>abs / ABS</entry>
   <entry>absolute value</entry>
 </row>
 <row>
   <entry>floor / FLOOR</entry>
   <entry>floor value</entry>
 </row>
 <row>
   <entry>ceil / CEIL</entry>
   <entry>next highest integer</entry>
 </row>
 <row>
   <entry>factorial / FACTORIAL</entry>
   <entry>factorial function</entry>
 </row>
 <row>
   <entry>log / LOG</entry>
   <entry>natural logarithm</entry>
 </row>
 <row>
   <entry>log10 / LOG10</entry>
   <entry>logarithm for base 10</entry>
 </row>
 <row>
   <entry>exp / EXP</entry>
   <entry>exponent function</entry>
 </row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table id="tbl.TrigonometricFunctions" frame="all"><title>Trigonometric Functions</title>
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colwidth="1*" />
<colspec colwidth="2*" />
<thead>
 <row>
   <entry>Operator/Function</entry>
   <entry>Description</entry>
 </row>
</thead>
<tbody>
 <row>
   <entry>sin / SIN</entry>
   <entry>sine function</entry>
 </row>
 <row>
   <entry>cos / COS</entry>
   <entry>cosine function</entry>
 </row>
 <row>
   <entry>tan / TAN</entry>
   <entry>tangent function</entry>
 </row>
 <row>
   <entry>sec / SEC</entry>
   <entry>secand function</entry>
 </row>
 <row>
   <entry>csc / CSC</entry>
   <entry>cosecand function</entry>
 </row>
 <row>
   <entry>cot / COT</entry>
   <entry>cotangent function</entry>
 </row>
 <row>
   <entry>sinh / SINH</entry>
   <entry>hyperbolic sine function</entry>
 </row>
 <row>
   <entry>cosh / COSH</entry>
   <entry>hyperbolic cosine function</entry>
 </row>
 <row>
   <entry>tanh / TANH</entry>
   <entry>hyperbolic tangent function</entry>
 </row>
 <row>
   <entry>sech / SECH</entry>
   <entry>hyperbolic secand function</entry>
 </row>
 <row>
   <entry>csch / CSCH</entry>
   <entry>hyperbolic cosecand function</entry>
 </row>
 <row>
   <entry>coth / COTH</entry>
   <entry>hyperbolic cotangent function</entry>
 </row>
 <row>
   <entry>asin / ASIN</entry>
   <entry>arcsine function</entry>
 </row>
 <row>
   <entry>acos / ACOS</entry>
   <entry>arccosine function</entry>
 </row>
 <row>
   <entry>atan / ATAN</entry>
   <entry>arctangent function</entry>
 </row>
 <row>
   <entry>arcsec / ARCSEC</entry>
   <entry>arcsecand function</entry>
 </row>
 <row>
   <entry>arccsc / ARCCSC</entry>
   <entry>arccosecand function</entry>
 </row>
 <row>
   <entry>arccot / ARCCOT</entry>
   <entry>arccotangent function</entry>
 </row>
 <row>
   <entry>arcsinh / ARCSINH</entry>
   <entry>hyperbolic arcsine function</entry>
 </row>
 <row>
   <entry>arccosh / ARCCOSH</entry>
   <entry>hyperbolic arccosine function</entry>
 </row>
 <row>
   <entry>arctanh / ARCTANH</entry>
   <entry>hyperbolic arctangent function</entry>
 </row>
 <row>
   <entry>arcsech / ARCSECH</entry>
   <entry>hyperbolic arcsecand function</entry>
 </row>
 <row>
   <entry>arccsch / ARCCSCH</entry>
   <entry>hyperbolic arccosecand function</entry>
 </row>
 <row>
   <entry>arccoth / ARCCOTH</entry>
   <entry>hyperbolic arccotangent function</entry>
 </row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table id="tbl.LogicalFunctions" frame="all"><title>Logical Functions</title>
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colwidth="1*" />
<colspec colwidth="2*" />
<thead>
 <row>
   <entry>Operator/Function</entry>
   <entry>Description</entry>
 </row>
</thead>
<tbody>
 <row>
   <entry>and / AND</entry>
   <entry>logical and (&amp;)</entry>
 </row>
 <row>
   <entry>or / OR</entry>
   <entry>logical or (|)</entry>
 </row>
 <row>
   <entry>xor / XOR</entry>
   <entry>logical xor</entry>
 </row>
 <row>
   <entry>not / NOT</entry>
   <entry>logical negation</entry>
 </row>
 <row>
   <entry>le / LE</entry>
   <entry>smaller or equal (&lt;=)</entry>
 </row>
 <row>
   <entry>lt / LT</entry>
   <entry>smaller (&lt;)</entry>
 </row>
 <row>
   <entry>ge / GE</entry>
   <entry>greater or equal (&gt;=)</entry>
 </row>
 <row>
   <entry>gt / GT</entry>
   <entry>greater (&gt;)</entry>
 </row>
 <row>
   <entry>ne / NE</entry>
   <entry>not equal (!=)</entry>
 </row>
 <row>
   <entry>eq / EQ</entry>
   <entry>equal (=)</entry>
 </row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table id="tbl.Miscellaneous" frame="all"><title>Miscellaneous</title>
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colwidth="1*" />
<colspec colwidth="2*" />
<thead>
 <row>
   <entry>Operator/Function</entry>
   <entry>Description</entry>
 </row>
</thead>
<tbody>
 <row>
   <entry>if / IF</entry>
   <entry>if statement for the construction of piecewise defined functions etc.</entry>
 </row>
 <row>
   <entry>()</entry>
   <entry>parenthesis for grouping of elements</entry>
 </row>
</tbody>
</tgroup>
</table>

</para>
<para>
The functions name can be written with either all lowercase letters
or all letters uppercase. Mixing of upper and lowercase letters is not
allowed and will lead to errors. 
</para>
<caution>
<para>
Although COPASI allows the usage of discontinuous functions (ceil,
floor, factorial, etc) all integration is done by LSODA which
officially can not handle discontinuous functions. Nevertheless in
most cases this will lead to correct results, however you should be
aware of the fact that the usage of discontinuous functions in COPASI
can lead to errors. Later versions of COPASI will use different
integration methods that will be able to deal with discontinuous
functions.   
</para>
</caution>
<para>
In addition to the function above, COPASI knows some predefined constant names:
<table id="tbl.BuiltinConstants" frame="all"><title>Built-in Constants</title>
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colwidth="1*" />
<colspec colwidth="2*" />
<thead>
 <row>
   <entry>Name</entry>
   <entry>Description</entry>
 </row>
</thead>
<tbody>
 <row>
   <entry>pi / PI</entry>
   <entry> quotient of a circles circumference and its diameter ( 3.14159...) </entry>
 </row>
 <row>
   <entry>exponentiale / EXPONENTIALE</entry>
   <entry> Euler's number ( 2.7183... ) </entry>
 </row>
 <row>
   <entry>true / TRUE</entry>
   <entry>boolean true value for conditional expressions</entry>
 </row>
 <row>
   <entry>false / FALSE</entry>
   <entry> boolean false value for conditional expressions</entry>
 </row>
 <row>
   <entry>infinity / INFINITY</entry>
   <entry> positive infinity </entry>
 </row>
</tbody>
</tgroup>
</table>
</para>
<para>
Again, built-in constant names can be written with either all
lowercase letters or all letters uppercase. Mixing of upper and
lowercase letters is not allowed and will lead to errors. 
</para>
<para>
In addition to defining "normal" functions, COPASI allows the
definition of piecewise defined functions. Piecewise defined functions
are constructed with the IF statement. The IF statement in COPASI is
used like a function with three arguments. The first argument is a
conditional expression that evaluates to either TRUE or FALSE, the
second argument is an expression that is evaluated if the condition
evaluates to TRUE otherwise the third argument, which can also be an
expression, determines the value of the function. The second and third
argument to the IF statement must evaluate to a double value, that
means it can not be a conditional expression like the first
argument. On the other hand, the second and third arguments themselves
can be IF statements. So in order to make this a little more clear, we
will look at how one would implement the Heaviside step function in
COPASI: 
 <equation id="eq.Heaviside"><mml:math display="block">
    <mml:mrow>
      <mml:mi>if</mml:mi>
      <mml:mo>(</mml:mo>
      <mml:mrow>
        <mml:mi>x</mml:mi>
        <mml:mo>&ensp;lt&ensp;</mml:mo>
        <mml:mn>0.0</mml:mn>
      </mml:mrow>
      <mml:mo>,&ensp;</mml:mo>
      <mml:mn>0.0</mml:mn>
      <mml:mo>,&ensp;</mml:mo>
      <mml:mi>if</mml:mi>
      <mml:mo>(</mml:mo>
      <mml:mrow>
         <mml:mi>x</mml:mi>
         <mml:mo>&ensp;gt&ensp;</mml:mo>
         <mml:mn>0.0</mml:mn>
      </mml:mrow>
      <mml:mo>,&ensp;</mml:mo>
      <mml:mn>1.0</mml:mn>
      <mml:mo>,&ensp;</mml:mo>
      <mml:mn>0.5</mml:mn>
      <mml:mo>)</mml:mo>
      <mml:mo>)</mml:mo>
    </mml:mrow>
  </mml:math></equation>
</para>
</sect1>

<sect1 id="usingSliders" xreflabel="Sliders">
<title>Sliders</title>
<para>
Sliders are user interface elements that let the user change model
values without having to go to the corresponding dialog first. This
way the user can change certain model values and immediately see the
result this has on e.g. a time course simulation. The use of sliders
is not limited to the <guibutton>Time Course</guibutton> task, but they can also be used for
the <guibutton>Steady-State</guibutton> task and the <guibutton>Metabolic Control Analysis</guibutton>.
</para>
<para>
Per default the slider dialog is hidden, if you want it to be
displayed, you have to activate it by toggling the corresponding menu
entry in the <guimenu>Tools</guimenu> menu or through the <guibutton>slider</guibutton>
button in the tool-bar. Depending on what element is selected in the
object tree, the dialog will be disabled and a text will be displayed
within the dialog that tells you so. If you select a task (or an
element below the task) that supports sliders, the sliders dialog will
be enabled.
</para>
<!-- Could not reproduce that with the current version
<caution><para>
On Mac OS X the slider dialog interferes with file dialogs and other -->
<!-- similar dialogs. So before opening a file dialog for loading or -->
<!-- saving or similar, either move the slider dialog out of the way, -->
<!-- or hide it altogether. If you forget to do so, the slider dialog -->
<!-- will probably block the other dialog and you will not be able to -->
<!-- make any input.
</para></caution>-->
<para>
Once the slider dialog has been activated, you can add new sliders
with the <guibutton>new slider</guibutton> button at the top of the
slider dialog. To edit the parameters of an already defined slider,
just click on the <guibutton>edit</guibutton> button, which is located
on the right side of the slider towards the bottom. If you no longer
need a slider you have defined, you can close it by clicking on the
<guibutton>remove</guibutton> button which is the top button on the
right side of the slider. Alternatively you can add or modify the
existing sliders via a context menu. The context menu can be activated
with the right mouse button (CTRL + Mouse button for single button
mice on Macs!). If you right click on an existing slider, the menu
will offer the possibilities to <guisubmenu>remove</guisubmenu> this
slider or to <guisubmenu>edit</guisubmenu> it. If you right click into
the dialog window where there is no slider, you will be offered the
possibility to define a new slider.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/19/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Sliders_01.png" format="PNG" scale="30" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Linux screenshot that shows COPASI with a plot window and the slider dialog</phrase>
 </textobject>
 <caption>
  <para>COPASI with plot window and sliders</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
Once you are in the dialog for the definition of a new slider (see above), you
have to choose an object to manipulate via the slider. This object can
be selected from the selection dialog that pops up when you click on
the <guibutton>choose object</guibutton> button. The selection tree is
the same as the ones you get when <link
linkend="plotDefinitions">selecting objects for a report
definition</link>. The selection dialog also offers an expert mode in
case the object you want to manipulate with the slider is not present
in the simplified tree. Usually the objects that you want to modify in
the time course simulation are one or several of the reaction
parameters. This way you can interactively see how the behavior of
your model changes when you change a specific parameter. In
combination with plots this is a very powerful way to examine the
behavior of your model.
</para>
<para>
After selecting an object, you can set the parameters for the
slider. You specify the range the slider has to cover in the
<guilabel>Minimum Value</guilabel> and <guilabel>Maximum
Value</guilabel> fields. Additionally you can specify if the slider
shall have a logarithmic or a linear scale<!-- and if the slider -->
<!-- should be used for all tasks that support sliders or only for the -->
<!-- task the slider was defined in-->. Per default sliders have a
linear scale<!-- and are only defined for the task in which the you -->
<!-- create them-->. Normally a slider will be available for all tasks
that support sliders. An exception to this are slider for objects that
are directly associated with a specific task, e.g. the number of steps
in a time series, if you choose such an object for a slider, the
slider will only be available for this task.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/19/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Sliders_02.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Basic dialog for the definition of a slider</phrase>
 </textobject>
 <caption>
  <para>Basic slider definition dialog</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
At the bottom of the dialog there is a button labeled
<guilabel>Advanced</guilabel>. If you click on this button more
options that influence the sliders behavior will show up (see above). Clicking the
button a second time will hide these options again. The advanced
options contain mostly fields that let you modify how many steps the
slider has (see explanation below). The <guilabel>Object
Value</guilabel> field determines the current value of the object that
is associated with the slider. In the <guilabel>Number of Minor
Ticks</guilabel> field you specify how many minor ticks your slider
will have. And in the <guilabel>Tick size factor</guilabel> field you
specify how many minor ticks make a major tick. Major ticks can be
used to coarsely go through the range of the slider whereas minor
ticks allow you to step through the range in a more fine grained
fashion. Instead of specifying the number of minor ticks, you can
specify the size of a minor tick. If you change either of those two
values, the other one will be adjusted accordingly. The formula is
<!-- <phrase role="math">(Maximum Value - Minimum Value) / number of -->
<!-- minor ticks = minor tick size</phrase> --> 
  <inlineequation><mml:math>
    <mml:mrow>
      <mml:mi>minor tick size</mml:mi>
      <mml:mo>=</mml:mo>
      <mml:mrow>
        <mml:mo>(</mml:mo>
          <mml:mrow>
            <mml:mi>Maximum Value</mml:mi>
            <mml:mo>-</mml:mo>
            <mml:mi>Minimum Value</mml:mi>
          </mml:mrow>      
        <mml:mo>)</mml:mo>
        <mml:mo>/</mml:mo>
        <mml:mi>number of minor ticks</mml:mi>
      </mml:mrow>
    </mml:mrow>
  </mml:math></inlineequation>.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/19/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Sliders_03.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Extended dialog for the definition of a slider</phrase>
 </textobject>
 <caption>
  <para>Extended slider definition dialog</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
Once you have made all the settings, you confirm the slider definition
with the <guibutton>OK</guibutton> button. A new slider will appear in
the slider dialog. 
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/19/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Sliders_04.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Slider dialog with three sliders</phrase>
 </textobject>
 <caption>
  <para>Slider dialog with three sliders</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
Each slider shows the name of the object, the current value and the
range in its label (see above). If the current value of the slider is outside of
the defined range, a corresponding warning will be shown. The slider
dialog has a check box called <guilabel>update
automatically</guilabel> if this box is checked, COPASI will run the
corresponding task each time you release a slider handle after moving
it. If you don't want COPASI to automatically run the task each time
you change a sliders value, you can uncheck this box and run the task
manually by clicking on the <guibutton>run task</guibutton> button.
</para>
<para>
If the value of an object for which a slider has been defined changes
when a task is run, the slider will automatically show the new
value. If the check box called <guilabel>update ranges</guilabel> is
checked, the sliders will automatically adjust their range if the
value falls outside of the defined range. If the new value is larger
than the old maximum value, the new maximum will be set to twice the
new value. Likewise if the new value falls below the old minimum
value, the new minimum will be set to half the current value.
</para>
<para>
Modifying a slider is essentially the same as defining a slider. The
only difference being that you can not change the object the slider is
connected to. In order to do that, you have to delete the slider and
define a new slider for the new object. 
</para>
<para>
Most people will probably use the sliders in combination with the
mouse, dragging the sliders pointer to the desired new value. Since
this way of using a slider is rather coarse, especially if the slider
contains a large number of steps, you can also use the keyboard to
change a sliders value. In order to do this, the slider you want to
manipulate needs to have the keyboard focus. To give the keyboard
focus, you have to hit the TAB key several times until the slider is
surrounded by a small frame. Once the slider has this frame, you can
increment and decrement the sliders value via the cursor and the page
up/down keys on the keyboard. The cursor keys are used to change the
value in small steps, the page up/down keys can be used to change the
value in larger steps (see the explanation for major and minor keys
above).  
</para>
</sect1>

<sect1 id="tutorialWizard" xreflabel="Tutorial Wizard">
<title>Tutorial Wizard</title>
<para>
COPASI also includes a short tutorial on how you create a model and
run a time course simulation with plotting. You can start the wizard
from the <guimenu>help</guimenu> menu. The corresponding menu entry is
called <guimenuitem>Simple Wizard</guimenuitem>.
</para>
<para>
On the left side of the wizard there are six buttons that correspond
to the six steps. When you first open the wizard, step one is selected
and the widget on the right shows some documentation that you should
read and possibly repeat the steps explained. Once you are finished
with step 1, you can either click directly on the button that
corresponds to step 2, or you can click the
<guibutton>forward</guibutton> button which will always bring you to
the next step. If you would like to reread something from an earlier
step, you can move to the specific step with the buttons or use the
<guibutton>forward&gt;&gt;</guibutton> and <guibutton>&lt;&lt;back</guibutton>
buttons to navigate. 
</para>
<para>
The wizard leads you in six steps from creating a model to doing a
time course simulation of the model and plotting the results of the
time course.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Wizard_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Tutorial wizard dialog screenshot</phrase>
 </textobject>
 <caption>
  <para>Tutorial wizard</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
</sect1>
</chapter>

<chapter id="outputGeneration" xreflabel="Output">
<title>Output</title>
<!--<sect1 id="outputIntroduction" xreflabel="Output Introduction">-->
<!--<title>Introduction</title>-->
<para>
After you have <link linkend="addingReactions">defined all
reactions</link> that make up your model, you could go ahead and do
some calculations with your model. For some of the task this is fine
since they show you the results in a separate results dialog and it
might not be necessary to store those results into a file. For other
tasks, like e.g. a time course, it is very likely that you want to
store the resulting trajectory in a file or plot the result for visual
inspection. So if you want COPASI to store the results or do a plot of
them, you have to define either a report and associate it with a file
or define a plot. (In the <xref linkend="calculatingTrajectory" />
section we will also offer an alternative, albeit less flexible, way
for storing the results of a time course simulation.) 
</para>
<para>
COPASI already has a list of predefined reports suitable for some of
the calculation task. These are described in the next paragraph.  If
you want to create your own plots or reports you can either use the
output assistant (the easy way) or you can define the output manually
(the flexible way), as described in the <xref
linkend="manualOutputDefinitions" /> section. 
</para>

<sect1 id="predefinedReports" xreflabel="Predefined Reports">
<title>Predefined Reports</title>
<para>
For some of the calculation tasks predefined reports exist in
COPASI. They are automatically created when COPASI is started or when
a file is loaded that does not already contain them. These reports
have the same name as the task they are suitable for. E.g. the
predefined report for Steady-State calculations is <emphasis>Steady-State</emphasis>. 
The predefined reports print a description of the settings you provided
for the calculation, usually (if it applies for the specific
calculation) a table with intermediate results, and in the end a
detailed report of the result. The report definitions can be changed
or deleted using the mechanism described in the <xref
linkend="manualOutputDefinitions" /> section. If you changed one of
the predefined reports and want to go back to the original, just
delete the report definition and save the file. When you load it again
the current missing default report will be generated automatically. 
</para>
<para>
If you want to use the predefined reports you have to make sure that
the report is selected for a task and that a filename is associated
with the report. For this you can use the <guibutton>Report</guibutton> button as 
described in the sections about the specific calculation tasks below. 
</para>
</sect1>
	
<sect1 id="outputAssistant" xreflabel="Output Assistant">
<title>Output Assistant</title>
<para>
The output assistant presents the easiest way to generate your own
output definitions which you can later adapt to your wishes using the
techniques described in <xref linkend="manualOutputDefinitions"
/>. Almost all task dialogs in COPASI have a button at the lower right
that is labeled <guilabel>Output Assistant</guilabel>. If you click
on this button, a new dialog will open with a list
of predefined output definitions on the left. If you select one of the
output definitions from the list, you will get a short description of
what the output does on the right side of the dialog. Above the
description is the title of the output definition. This title can be
changed in order to be able to identify the different output
definitions in case you are planning on creating more than one output
definition of a certain type. Using this dialog both plots and reports
can be created. 
</para>
<para>
Creating an instance of the selected output objects is as easy as
clicking on <guibutton>Create!</guibutton> at the bottom of the
dialog. Once you clicked this button, a new report or plot, depending
on what you selected in the dialog, will appear in the corresponding
branch of the <guibutton>Output</guibutton> section of the model
tree. The <guibutton>Output</guibutton> branch is the second to last branch 
in the tree on
the left. The name of the output definitions will be the title of the
object which you selected from the list. If another output definition
in this section already has the same name, a postfix will be appended
to the name. The so created output can now be edited or deleted. If
the newly created output is a report it will automatically be selected
as the active report for the current task. You then still have to
select a filename for the output using the <guibutton>Report</guibutton> button. 
This is
described in the sections about the specific calculation tasks
below. How output definitions are created, edit and deleted manually
is the topic of the next sections. 
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/OutputAssistant_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Output Assistant Window</phrase>
 </textobject>
 <caption>
  <para>Output assistant selection dialog</para>
 </caption> 
</mediaobject>
</screenshot>
</para>

</sect1>
<sect1 id="manualOutputDefinitions" xreflabel="Manual Definition">
<title>Manual Definition</title>
<sect2 id="reportDefinitions" xreflabel="Reports">
<title>Reports</title>
<para>
This section describes how to create or edit a report definition. Keep
in mind that you still have to select this report for the specific
calculation task you want to perform. You can do this (and also choose
a filename to write to) using the <guibutton>Report</guibutton> button as described below
in the sections about the different tasks. 
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Reports_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Report table with default reports</phrase>
 </textobject>
 <caption>
  <para>Report Table with default Reports</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
The dialog for defining report definitions is located under the
<guibutton>Output-&gt;Reports</guibutton> branch in the object
tree. Double clicking on an empty row in the table creates a new
report object and opens the dialog for modifying the report
definition. In this dialog, you can specify a name for the report in
the <guilabel>Name</guilabel> field. From the
<guilabel>Task</guilabel> drop down list, you can choose for which
kind of task this report should be written. So if you want to store
the result of a time course, you should choose
<emphasis>Time-Course</emphasis> here. The report usually stores the
results of its task as a table; the standard separator character for
elements in this table is the tab character (\t). If you want to have
another character as the separator field, you have to uncheck the
<guilabel>&lt;tab&gt;</guilabel> check box and specify the separator
character or string you want in the <guilabel>Separator</guilabel> field.
</para>
<para>
Beside the <guilabel>&lt;tab&gt;</guilabel> check box there is another
input field labeled <guilabel>Precision</guilabel>. With this field you
can specify how many significant digits are used for numerical
output. The default value is 6. 
</para>
<para>
If you want to, you can also add a comment for the report, e.g. you
could state what this report is supposed to represent. 
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Reports_02.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Simple selection dialog</phrase>
 </textobject>
 <caption>
  <para>Simple selection dialog</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
Next you have to define the objects that you want to appear in the
report. There are two modes to define a report definition. Per
default, the report is laid out as a table. For example, the report for a time
course simulation will write one line per time step and each line will
typically contain the time followed by one or more species
concentrations. In the advanced mode activated by clicking on
the button labeled <guibutton>Advanced</guibutton>, the report is
split up into three sections, a header, a body and a footer. You can
define the output for each of the sections separately by clicking on
the corresponding tab. In order to get back to the standard table
layout, you have to click on the <guibutton>Advanced</guibutton>
again. COPASI will warn you that you might loose some information by
converting from the advanced report definition format to the table
format. 
</para>
<para>
Le us discuss how to define a report definition with table layout
first since you will probably use this most of the time. To add a new
object to the report definition, you have to click on the button
labeled <guibutton>Item</guibutton>. This will open the object browser
dialog.
</para>  
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Reports_03.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Object browser dialog expert mode</phrase>
 </textobject>
 <caption>
  <para>Object browser dialog expert mode</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
The selection dialog shows a tree that contains what we think are the
objects that would be most commonly used in generating report, plots,
sliders etc. You select objects by clicking on the corresponding leave
in the selection dialogs tree view. For plots and report, the simple
selection dialog will allow you to select several objects at once. To
select a continuous range of objects, you select the first object of
the range, then you press and hold the SHIFT button and select the
last object in the range. You can also make non-continuous selection
by holding down the CTRL key while clicking on the object to
select/deselect. Also selecting a whole branch in the selection dialog
will select all the leaves under that branch. 
</para>
<!-- multi selection on the Mac !!! -->
<para>
If this simple selection dialog does not contain the object that you
want to include in your report, you can activate an extended selection
tree by activating the <guilabel>expert mode</guilabel> check box. 
The tree you now see contains all objects COPASI knows about. In
this tree, the objects belonging to your model are located in the
branch that corresponds to the name of your model. The position of
that branch varies since the branches are sorted alphabetically. The
selection that you have already made in the simple selection
tree should be preserved, and vice versa. Any selection you make in the
full tree is preserved when you switch back to the simple tree. Each
branch of the full tree has a check box up front which can assume
three states. The unchecked state means that no objects in this
subtree are selected. A check mark on a black background means that
the whole subtree is selected, i.e. all objects in this subtree are
selected. A check mark on a gray background means that part of the
subtree is selected.
</para>
<para>
Due to the model structure, most objects appear more than once in the
tree. 
<!-- So if you select some object, you should not be surprised, if
more than the selected object suddenly change their selection
state. E.g. if you select the whole -->
So do not be surprised if you select some objects you may be see that
not only the selected objects will suddenly change their selection
state. E.g. if you select the whole
<guibutton>Compartments</guibutton> subtree of your model, all the
species which are part of the compartments get selected as well,
which means that on selecting the <guibutton>Compartments</guibutton>
branch, the whole <guibutton>Species</guibutton> branch changes
its state to be selected.
</para>
<para>
Let us assume you want to define the report for a trajectory task in 
expert mode. In this case, you will probably want the time and some or 
all of the transient concentrations of the species in your report. 
The time for the time course is the last item in the 
<guibutton>Model</guibutton> branch, you select
it by clicking on the check box in front of the name. If you want to
add the concentrations of all species, you open the
<guibutton>Species</guibutton> sub-branch in the
<guibutton>Model</guibutton> branch and open the <guibutton>Select by
attribute</guibutton> branch. There you can select the
<guibutton>Concentration</guibutton> attribute. Selecting the
<guibutton>Concentration</guibutton> attribute will select the
concentrations for all species. If you only want to have some of
the species in your report, you open the sub-branches of the
wanted species in the <guibutton>Species</guibutton> branch
and select the <guibutton>Concentration</guibutton> attribute only for
those species. If your model contains many species and you
want to have all except one species in your report, it is often easier to first
select all concentrations via the <guibutton>Select by
attribute</guibutton> branch and then deselect the one you don't
want, rather then selecting the individual concentrations you
want. Once you are finished with selecting the objects for your
report, you confirm the selection by clicking the
<guibutton>OK</guibutton> button in the selection dialog. The objects
you selected will now appear in the list box of the report definition
dialog.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Reports_04.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Report definition dialog</phrase>
 </textobject>
 <caption>
  <para>Report definition dialog</para>
 </caption> 
</mediaobject>
</screenshot></para>
<para>
They will appear in the report in the same order as they appear in
this list. To reorder the entries in the list, you can select
individual entries and move them up and down in the list with the
corresponding buttons on the left of the list. For example it might be a
good idea to move the time object to the top of the list so that it
will appear as the first table column in the file since this is the
way most programs would expect it. Also in order to delete unnecessary
items, you just select them and click on the
<guibutton>Delete</guibutton> button. The only thing that is now left
is to connect this report to a file. This has to be done in the dialog
for the specific task and we will cover this when we explain how to
run the individual tasks. 
</para>
<para>
The report we just defined will be written in the form of a table. So
if this is a report for a time course simulation, the final output
would have one line per time step of the simulation and in each line,
each object that is in the list would be written once separated by
whatever you defined as your separator character (Normally this would
be the &lt;tab&gt; character). 
</para>
<para>
Per default, the check box labeled <guilabel>Title Row</guilabel> is
activated, which means that COPASI will write a header line before the
table with the names of the objects that make up the individual
columns. If you don't want such a header in the output you have to
deactivate this check box. 
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Reports_05.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Advanced report definition dialog</phrase>
 </textobject>
 <caption>
  <para>Advanced report definition</para>
 </caption> 
</mediaobject>
</screenshot></para>
<para>
As stated above, the advanced report definition allows you to define
the output for the three parts of the report separately. The <emphasis>header</emphasis>
part of the report is written once before the corresponding task, the
output of the <emphasis>body</emphasis> elements occurs once per step of the corresponding
task, e.g. for the time course once every time step, and the <emphasis>footer</emphasis> is
written once after the task has finished. In this sense, the standard
table report definition is nothing but an advanced report definition
with a title header and a body that consists of the time and some
species concentrations separated by separator items. The footer is
empty. If you write your own advanced report definition, you are
responsible to add separator tags where appropriate. An advantage to
the advanced report definition is that you can add arbitrary text to
any of the three sections. Everything else works as described for the
standard report definition, you can add and delete items by selecting
them from the object browser dialog. You can also move these items up and down 
by selecting them and clicking on the <guibutton>Up</guibutton> or
<guibutton>Down</guibutton> button. Separator items can be added by
clicking on the <guibutton>Separator</guibutton> button. The symbol or
text that makes up the separator item is again defined by the check box 
and the adjacent input field towards the top of the report
definition dialog. 
</para>
</sect2>

<sect2 id="plotDefinitions" xreflabel="Plots">
<title>Plots</title>
<para>
Plotting is another form of output that COPASI can do. Most of the
time, you probably want to plot some or all of the species
concentrations during a time course simulation and, as described above,
this is easiest done by choosing that predefined plot template from
the <link linkend="outputAssistant">Output Assistant</link>. But since
the output assistant can not cover all possible plots sometimes you
will have to define your own plots.
</para>
<para>
Currently, COPASI only supports two dimensional plotting. To define a
plot, you open the plot definition dialog by selecting
the <guibutton>Output-&gt;Plots</guibutton> branch in the object
tree. A plot in COPASI is made up of a number of curve or histogram
objects. In order to add a new curve object you click on the
<guibutton>New curve...</guibutton> button. 
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Plots_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Empty plot widget</phrase>
 </textobject>
 <caption>
  <para>Empty plot widget</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
A selection dialog similar to the one described for the <link
linkend="reportDefinitions">creation of reports</link> will
appear. The major difference is that you now have two tree views side
by side instead of only one. The left tree is
a single selection dialog that lets you specify the object 
to be drawn along the x-axis. For a plot of concentration against time
this would be the simulation time. The right tree is, again, a
multi-selection tree that lets you specify what would be drawn along
the y-axis. In case of plotting concentrations against time, this would
be one or more concentrations of species. Just as described for
the report definitions, you can switch between a simple tree and the
full tree, but for most plots the simple tree will be enough.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Plots_03.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Selection dialog with some items selected</phrase>
 </textobject>
 <caption>
  <para>Simple selection dialog with selected items</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Plots_04.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Expert selection dialog for curve objects</phrase>
 </textobject>
 <caption>
  <para>Selection dialog in expert mode</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
Once you have finished your selection, you click on the
<guibutton>OK</guibutton> button which will take you back to the curve
definition dialog. For each object selected in the right tree, you
will now see one tab which represent the corresponding curve object
for the plot. To remove one of the curves, select the tab
that corresponds to the curve you want to remove and then click on the
<guibutton>Delete curve</guibutton> button. The next time you do a
<link linkend="calculatingTrajectory">time course simulation</link>,
each plot that is marked as active will be plotted automatically. How
you define a plot as being active will be explained below.
</para>
<para>
Each curve object has a title, and the information what will be drawn
on the x- and y-axis. Additionally you can specify whether the curve
should be drawn as a line, as points or as symbols. This has to be
specified for each curve separately. You can also specify if the plot
should be drawn with a logarithmic scale for one or both of the
axis. <!-- What is this Capture Data thing? !!! -->
</para>
<!-- 
<caution><para>
On Mac OS X, the tab widget does not handle very wide tabs or many
tabs well. This problem will be dealt with in upcoming versions of
COPASI.
</para></caution> 
-->
<para>
In the plot definition dialog, in addition to adding and removing
curve objects, you can give a name for the plot definition and 
specify whether the plot should be active or not with the
<guilabel>active</guilabel> check box. (Only plots that are active are
drawn when a <link linkend="calculatingTrajectory">time course
simulation</link> is run!)
</para>
<para>
Another way to specify whether a plot is active or not is in the plot
table where all the plots are listed. Each row in the table contains a
column named <guilabel>active</guilabel> that contains a check box
with which you can toggle the state of a plot. If you changed the
state of one or more plots, you have to commit these changes either by
clicking the <guibutton>Commit</guibutton> button or any other action
that is equivalent to pressing the <guibutton>Commit</guibutton>
button (see <xref linkend="addingCompartments" /> section).
</para>
<para>
In addition to curves, you can also tell COPASI to draw a histogram of
the data generated during a time course simulation (see <xref
linkend="calculatingTrajectory" />) or a parameter scan (see <xref
linkend="parameterScan" />). A histogram draws a bar graph that shows
how often the parameter took a certain value. To define a histogram
instead of a curve, you click on the <guibutton>New
histogram...</guibutton> button in the plot definition dialog. For the
new histogram you can specify a title, the variable for which the
histogram should be drawn, and the increment of the value. The
increment parameter tells COPASI how wide the individual bars of the
histogram are going to be. Let's say the value of the parameter was in
the range of 3 to 8 and you set the increment to 0.1, COPASI will draw
a histogram with 50 bars, each bar representing a value range of 0.1
units. Curves and histograms can be combined in a single plot.
</para>
</sect2>
</sect1>
</chapter>

<chapter id="simpleTasks" xreflabel="Simple Tasks">
<title>Simple Tasks</title>
 
<sect1 id="steadyStateAnalysis" xreflabel="Steady-State Analysis">
<title>Steady-State Analysis</title>
<para>
In order to run a Steady-State analysis, you have to navigate to the
<guibutton>Task-&gt;Steady-State</guibutton> branch in the object
tree.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 03/07/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/SteadyStateTask_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog for doing calculating a stability analysis</phrase>
 </textobject>
 <caption>
  <para>Steady-State task dialog</para>
 </caption> 
</mediaobject>
</screenshot></para>
<para>
In the dialog that appears there, you can make several settings that
influence the way the Steady-State analysis is calculated. First of
all, you can decide whether COPASI should calculate the Jacobian
matrix and/or do a stability analysis as well by checking the
corresponding check box. The <guilabel>executable</guilabel> check box
is used to instruct the commandline version CopasiSE to do this task
if running on the corresponding file. In the <guilabel>Method Parameter</guilabel> 
table you can also make several settings that influence the method for calculating 
the Steady-State. For a detailed description of those parameters see the corresponding 
<!-- <xref linkend=" -->methods<!-- " /> -->
part of this documentation.  To finally run the Steady-State
calculation, click on the <guibutton>Run</guibutton> button at the
bottom of the screen. After the calculation, COPASI will jump to the
<guilabel>Result</guilabel> widget.
</para>
<para>
The <guilabel>Result</guilabel> widget for the Steady-State calculation 
contains several tabs for the individual results. 
<!-- 
The first and the second tab contain
the concentrations and the particle number at the Steady-State
respectively. The third tab contains the fluxes for the reactions at
the Steady-State. It contains concentration fluxes as well as particle
fluxes. The fourth and fifth tab only contain results if you told
COPASI to calculate the Jacobian matrix. The fourth tab then shows the
Jacobian for the full system and the fifth tab contains the Jacobian
matrix for the reduced system. For both Jacobian matrices also the
eigenvalues are shown. The sixth tab contains the results for the
stability analysis if a stability analysis was requested. The seventh
and last tab shows a log that lists the calculation steps COPASI took
while trying to find a Steady-State.
-->
The first tab contains information about the species at the Steady-State
condition as well as the compartments at the second tab. The third tab
shows the model quantities whereas the reactions and their fluxes are 
displayed at the fourth one. The display between the concentration fluxes
and the particle one is depending on what you have selected on the drop down 
list at the tab menu. As mentioned at the very beginning this documentation,
you are able to easily change the display at any time.
</para>
<para>
The fifth and the sixth tab only contain results if you told
COPASI to calculate the Jacobian matrix. The fifth tab then shows the
Jacobian matrix for the full system and the sixth one contains that 
for the reduced system. For both Jacobian matrices, the
eigenvalues are also shown. The seventh tab contains the results for the
stability analysis if a stability analysis was requested. The last tab 
shows protocol that lists the calculation steps COPASI took
while trying to find a Steady-State.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/SteadyStateTask_02.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog that displays the results of the stability analysis</phrase>
 </textobject>
 <caption>
  <para>Results of the stability analysis</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
In order to have an output from the Steady-State Task, you have to
create an output definition as described in the <xref
linkend="outputGeneration" /> section or you use the default report
named <emphasis>Steady-State</emphasis>. The default report prints a message telling
whether a Steady-State was found. It also reports the concentration,
concentration rate, particle number, particle number rate, and
transition time of all species as well as the flux for all
reactions. If they have been requested, the Jacobian matrix and the eigenvalues are 
also reported. The easiest way to get a customized output is probably to
use the output assistant activated via the <guibutton>Output
Assistant</guibutton> button. This is described in the <xref
linkend="outputAssistant" /> section. All that is left to do in order
to write the output to a specific file is to connect output
definition with a file. This can be achieved by clicking on the
<guibutton>Report</guibutton> button. This opens a dialog that lets
you connect the report of a specific task to a file on your hard
disk. First we choose a report that is suitable for the Steady-State
task from the drop down list at the top of the dialog. Next, we
specify a file that will be used to store the report by clicking on
the <guibutton>browse</guibutton> button and selecting the destination
in the file dialog that opens. Per default, COPASI creates a new file
or overwrites an existing file with the same name. Alternatively, you
can tell COPASI to append the report to the end of an existing file by
selecting the corresponding check box labeled
<guilabel>Append</guilabel> at the bottom of the dialog. Once you are
finished, you click on the <guilabel>Confirm</guilabel> button. If you
now run the task, COPASI will write the output to the file you
specified.
</para>
</sect1>

<sect1 id="stoichiometryStateAnalysis"
xreflabel="Stoichiometric State Analysis">
<title>Stoichiometric State Analysis</title>
<sect2 id="elementaryModes" xreflabel="Elementary Flux Modes">
<title>Elementary Flux Modes</title>
<para>
Letting COPASI calculate the elementary flux modes for the system is
very easy. Select the
<guibutton>Tasks-&gt;Stoichiometry-&gt;Elementary Modes</guibutton> in
the object tree and click on the <guibutton>Run</guibutton> button in
the dialog that appears.   
</para>
<para>
The elementary modes found will be displayed directly in this
dialog. Each elementary mode lists the reactions it consists of
together with their chemical equations. 
</para>
<para>
If you want to have output from the Elementary Mode calculation, you
have to create an output definition as described in the <xref
linkend="manualOutputDefinitions" /> section. The easiest way is
probably to use the output assistant which activated via the
<guibutton>Output Assistant</guibutton> button. This is described in
the <xref linkend="outputAssistant" /> section. All that is left to do
in order to write the output to a specific file is to connect an
output definition  with a file. This can be achieved by clicking on
the <guibutton>Report</guibutton> button. This opens a dialog that
lets you connect the report of a specific task to a file on your hard
disk. First we choose a report that is suitable for the Elementary Flux
Modes analysis task from the drop down list at the top of the
dialog. Next, we specify a file that will be used to store the report
by clicking on the <guibutton>browse</guibutton> button and selection
the destination in the file dialog that opens. Per default, COPASI
creates a new file, if the file does not exist, or overwrites an existing
file with the same name. Alternatively, you can tell COPASI to
append the report to the end of an existing file by selecting the
corresponding check box labeled <guilabel>Append</guilabel> at the
bottom of the dialog. Once you are finished, you click on the
<guilabel>Confirm</guilabel> button. If you now run the task, COPASI
will write the output to the file you specified. 
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/ElementaryModesTask_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog showing the calculated elementary modes for a model</phrase>
 </textobject>
 <caption>
  <para>Elementary flux modes analysis dialog with results</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
</sect2>

<sect2 id="massConservation" xreflabel="Mass Conservations">
<title>Mass Conservations</title>
<para>
Calculating mass conservations in COPASI is also very easy. Navigate
to the <guibutton>Tasks-&gt;Stoichiometry-&gt;Mass
Conservation</guibutton> branch in the object tree and click on the
<guibutton>Run</guibutton> button as with every other task.
</para>  
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/MassConservationTask_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog showing the results of a mass conservation calculation</phrase>
 </textobject>
 <caption>
  <para>Mass conservation task dialog with results</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
  Moieties are the result of stoichiometric analysis. The result of this analysis is not unique it depends on the algorithm chosen. COPASI uses the Householder reduction method described in <citation>Vallabhajosyula06</citation>. To make matters worse it even depends on the implementation of the Householder reduction for which COPASI relies on platform specific libraries for performance reasons, i.e., the result may differ on Windows and MacOS X. These differences are not crucial as the moieties build a basis of the linear dependent subspace of the solution and the choice of such a base system is obviously not unique. 
</para>
<para>
  However, often people like to know the total preserved amount of a moiety. Since the moiety calculation is not unique COPASI provides a convenience method to create a global quantity of type assignment to calculate this value. This method is accessible through the <guibutton>tool</guibutton> button. The result of this assignment is now independent from the algorithm chosen to calculate the moieties and thus may even be exported to SBML.
</para>
</sect2>
</sect1>

<sect1 id="calculatingTrajectory" xreflabel="Time Course Simulation">
<title>Time Course Simulation</title>
<para>
In order to do a time course simulation, you have to navigate to the
corresponding task branch in the object tree which is located at
<guibutton>Tasks-&gt;Time Course</guibutton>.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/TimeCourseTask_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog for calculating a trajectory</phrase>
 </textobject>
 <caption>
  <para>Trajectory task dialog</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
In the <emphasis>Time Course</emphasis> widget you can change several parameters for the
time course, e.g. the duration of the simulation and the number of
intervals that are being calculated in the time range. Alternatively
to setting the number of intervals, you can also set the size of the
interval. If you set either one, the other will be updated
accordingly. Because if you change the duration, the number of intervals
will stay the same, which means that the interval size will be
adjusted. The check box labeled <guilabel>Save Result in
Memory</guilabel> tells COPASI to keep the result of the time series
calculation in memory in order to display it in a result dialog. Since
this can be a large amount of data depending on the size of your model
and/or on the number of intervals you want COPASI to calculate, you
should disable this if you think the result might not fit into
memory. The consequence of disabling this check box is that you need
to <link linkend="reportDefinitions">define a report</link> in order
to store the results of the time course simulation.
</para>
<para>
Another thing that you can adjust in this dialog is the time at which
COPASI starts to record the output. Normally COPASI will store all
output and display it in the plot and reports, if there are any, or in
the results dialog, if that feature was not disabled. With
the <guilabel>delayed</guilabel> check box and input field of 
<guilabel>Start Output Time</guilabel>, you can specify that COPASI shall 
drop all results prior to a certain time point. For example, you could decide 
that you want to run a time course simulation for 100 seconds but only interested in
the last 50 seconds of the simulation. In this case you would activate
the <guilabel>delayed</guilabel> check box and specify a
delay of, lets say, 50. This delay will be used for all kinds of output.
</para>
<para>The time course simulation does not necessarily start with 
<inlineequation><mml:math>
  <mml:msub>
    <mml:mi>t</mml:mi>
    <mml:mn>0</mml:mn>
  </mml:msub>
  <mml:mo>=</mml:mo>
  <mml:mn>0</mml:mn>
</mml:math></inlineequation>
. The start time of the time course simulation depends on the initial
model time which can be specified in the <link
linkend="generalSettings">general model settings dialog</link>.
</para>
<para>
COPASI supports six different methods for calculating time course
simulations. COPASI can use the <emphasis>LSODA</emphasis> solver, or 
its variant called <emphasis>LSODAR</emphasis>, 
to calculate the time course deterministically. COPASI is able
to calculate the time course stochastically by means of one of two stochastic 
solvers: the <emphasis>Gibson and Bruck</emphasis> method or 
the <emphasis>Tau-Leap</emphasis> one. Depending on the solver you
have chosen, you can set several parameters in the <guilabel>Parameter
value</guilabel> table that influence the way the method works. A
detailed explanation of those parameters will follow in the 
<!-- <xref linkend=" -->methods<!-- " /> --> 
part of this document.
</para>
<para>
In addition to purely deterministic or purely stochastic time course
simulations, COPASI can also use a so called hybrid method to
calculate a trajectory. This hybrid method splits the model in two
segments according to the number of particles participating in a
reaction. Reactions with many particles are simulated
deterministically and those reactions with only a few particles are
simulated stochastically. The boundaries of what is considered as to many or
few particles can be set by the user. Depending on the nature of the
model, the hybrid simulation can lead to significant simulation
speedup compared to purely stochastic simulation while still being
more accurate than purely deterministic simulation for small particle
numbers. However, the method should still be considered
experimental. For a more detailed description of the method and the
attributes that you can set see the
<!-- <link linkend=""> --> 
methods section
<!-- </link> -->.
</para>
<para>
The hybrid solver comes in two flavors. One uses LSODA for
deterministic simulation and is called <emphasis>Hybrid
(LSODA)</emphasis>, the other uses Runge-Kutta fourth order and is
called <emphasis>Hybrid (Runge-Kutta)</emphasis>.
</para>
<para>
If you haven't created a report definition yet, you can use the output
assistant to easily create one by clicking on the corresponding button
at the bottom of the time course dialog. Once you have <link
linkend="reportDefinitions">created a report definition</link>, you
have to associate this report definition with a file for COPASI to be
able to write the results to that file. To do that, you click on the
<guibutton>Report</guibutton> button.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/TimeCourseTask_02.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog to associate a report with a file</phrase>
 </textobject>
 <caption>
  <para>File association dialog for a time course report</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
The dialog that pops up will let you choose the report you want to use
(in case you created more than one) and lets you browse for a file to
store the report to. Additionally, you can choose if you want to
append the report to an already existing file. The default is to
create a new file, or to overwrite an existing file. If you want to
append to the selected file, you have to check the
<guilabel>Append</guilabel> check box.
</para>
<para>
Once you made all the desired changes to the parameters, you can start
the time course simulation by clicking on the <guibutton>Run</guibutton> button. 
COPASI will show a progress bar while running the simulation, which might take
some time depending on several factors, like the hardware you are
using, the simulation method you chose, and/or the size of your
model. Once COPASI finishes the calculation, the results will be displayed
in the report file you defined and/or in a separate result dialog, if
you told COPASI to keep the results in memory.
</para>
<para>
The <guilabel>Result</guilabel> dialog is located directly below the 
<guibutton>Time Course</guibutton> branch in
the object tree. In this widget you can choose whether you want the
results to be displayed as concentrations or as particle numbers, and
you have the possibility to store the results to a file. The advantage that
a report has rather than writing a file in the <guilabel>Result</guilabel>
widget is that you can choose exactly which species concentrations you want 
to store whereas the <guilabel>Result</guilabel> dialog always stores all species
concentrations. You also can't change the order in which the
species concentrations are written, if you store the result from this dialog.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/TimeCourseTask_03.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog that shows the results of the trajectory task</phrase>
 </textobject>
 <caption>
  <para>Trajectory results</para>
 </caption> 
</mediaobject>
</screenshot>
</para>

<sect2 id="workingWithPlots" xreflabel="Working with Plots">
<title>Working with Plots</title>
<para>
If you have defined an active plot before calculating a trajectory,
COPASI will draw the plot. The plot window has three elements. A tool
bar at the top, that lets you print the plot or save the data into a
file; the legend, which is interactive such that the drawing of certain 
curves can be toggled by clicking on the corresponding legend entry;
and the actual plot.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/PlotWindow_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog window showing a plot</phrase>
 </textobject>
 <caption>
  <para>COPASI plot window</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
During moving the mouse cursor inside a plot widget, the mouse
coordinates with respect to the coordinate system of the plot 
are displayed beside the mouse cursor.
</para>
<para>
In order to zoom further into a plot, you can select a rectangular
area on the plot by clicking somewhere in the plot and dragging the
pointer. The plot will now zoom into the area you just selected. To go
back to the original plot, right click on the plot area.
</para>
<note><para>
Macintosh users with single button mice should use CTRL-click.
</para></note>
<caution><para>
The qwt plot widget has some problems under Mac OS X. Especially
zooming often leads to strange artifacts. Also the mouse coordinates
that are normally drawn with the cursor are unreadable on COPASI for
Mac OS X
</para></caution>
</sect2>
</sect1>

<sect1 id="calculatingMCA" xreflabel="Metabolic Control Analysis">
<title>Metabolic Control Analysis (MCA)</title>
<para>
COPASI can also do a <emphasis>Metabolic Control Analysis (MCA)</emphasis> 
for your model. The MCA task is located under <guibutton>Tasks-&gt;Metabolic
Control Analysis</guibutton>.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/MCATask_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog for running a metabolic control analysis</phrase>
 </textobject>
 <caption>
  <para>MCA task dialog</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
In order to do a full MCA (elasticities and control coefficients),
COPASI needs to look for a Steady-State first, otherwise COPASI can
only calculate the elasticities. If you did not already <link
linkend="steadyStateAnalysis">do a Steady-State calculation</link>
right before so that the system already is in the Steady-State, if one
was found, you should enable the check box that tells COPASI to do a
Steady-State calculation before calculating the MCA. Depending on
whether COPASI needs to do a Steady-State analysis or not, you can
change one or more parameters that influence the way the MCA and the
Steady-State are calculated. The parameters for the Steady-State
calculation or that for the Steady-State widget explained in
the <xref linkend="steadyStateAnalysis" /> section.
<!-- 
For a detailed description of the parameters, I have to refer to the
corresponding sections in the methods chapter of this document. (<xref
linkend="methodSteadyState" />, <xref linkend="methodMCA" />)
-->
</para>
<para>
To start the calculation, you click the <guibutton>Run</guibutton>
button. After the calculation is finished, COPASI will automatically
switch to the <guilabel>Result</guilabel> dialog. The dialog shows 
three tabs that contain the results of the <emphasis>Elasticities</emphasis>, 
<emphasis>Flux Control Coefficients</emphasis> and <emphasis>Concentration 
Control Coefficients</emphasis>.
</para>
<para>
Depending on whether a steady state condition was found or not, only the
<emphasis>Elasticities</emphasis> tab might be enabled. COPASI will 
state the status of finding a steady state in a label right above the tabs. 
For all of the results, you can choose if you want COPASI to display them 
scaled or unscaled.
</para>
<para>
In order to have an output from the MCA, you have to create a report
as described in the <xref linkend="outputGeneration" /> section or you
decide to use the default report. The default report will output all
matrices that are calculated as well as the Steady-State, if steady
state calculation is requested.  All that is left to do in order to
write the output to a specific file is to connect output definition
with a file. This can be achieved by clicking on the
<guibutton>Report</guibutton> button. This opens a dialog that lets
you connect the report of a specific task to a file on your hard
disk. First we choose a report that is suitable for the MCA task from
the drop down list at the top of the dialog. The default report for
MCA is called <emphasis>Metabolic Control Analysis</emphasis>. Next, 
we specify a file that will be used to store the report by clicking on the
<guibutton>browse</guibutton> button and selecting the destination in
the file dialog that opens. Per default, COPASI creates a new file or
overwrites an existing file with the same name. Alternatively, you can
tell COPASI to append the report to the end of an existing file by
selecting the corresponding check box labeled
<guilabel>Append</guilabel> at the bottom of the dialog. Once you are
finished, you click on the <guilabel>Confirm</guilabel> button. If you
now run the task, COPASI will write the output to the file you
specified.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/MCATask_02.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog showing the results of the metabolic control analysis</phrase>
 </textobject>
 <caption>
  <para>MCA results</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 03/07/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/MCATask_03.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog showing the results of the MCA after no Steady-State was found</phrase>
 </textobject>
 <caption>
  <para>MCA results at none Steady-State</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
</sect1>

<sect1 id="lyapunovExponents" xreflabel="Lyapunov Exponents">
<title>Lyapunov Exponents</title>
<para>
The widget to calculate Lyapunov exponents in COPASI is located in the
<guibutton>Task</guibutton> branch of COPASI's tree view. If you
select the <guibutton>Lyapunov Exponents</guibutton> item in the tree,
the corresponding widget will be displayed. The first input field in
the widget labeled <guilabel>Number of Exponents</guilabel> lets you
specify how many Lyapunov exponents are to be calculated. This number
should be between one and the number of independent variables in the
system (that is the number of species that are not constant minus
the number of mass conservation relations). If you specify a number
that is higher than the number of independent variables in the system,
COPASI will issue a warning telling you to lower the number and 
will also tell what the maximal number should be. During the
calculation of the Lyapunov exponents, a time course simulation is
carried out. If your model shows a long transient, you might want to
exclude the beginning of the trajectory from the calculation of the
Lyapunov exponents. For this, COPASI lets you specify at which time
point the averaging for the Lyapunov exponents should start. You can
specify this delay in the field labeled <guilabel>start averaging
after t= "</guilabel>. 
<!--
If you check the <guibutton>Use result as new
initial state</guibutton> check box, COPASI will use the state of the
model after the simulation as the new initial state for all following
calculation. Please note that all old model values are replaced.
-->
</para>
<para>
With the check box labeled <guilabel>calculate Divergence</guilabel>,
you can activate the calculation of the average divergence. The
divergence is calculated as the average over the trace of the Jacobian
(see
<!-- <link linkend=""> -->
Lyapunov calculation method
<!-- </link> -->
).  
</para>
<para>
<!--
So far there is only one method available to calculate Lyapunov
Exponents and this method is called <emphasis>Wolf
Method</emphasis>. For a more detailed description of the method and
-->
The method behind of calculating Lyapunov exponents is called <emphasis>Wolf
Method</emphasis>. For a more detailed description of the method and
its parameters please see the
<!-- <link linkend=""> -->
corresponding methods
<!-- </link> --> 
section.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Lyapunov_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Lyapunov task widget</phrase>
 </textobject>
 <caption>
  <para>Lyapunov task widget</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
After clicking the <guibutton>Run</guibutton> button, COPASI will
start the time course simulation in order to calculate the Lyapunov
exponents. Once the calculation is finished, COPASI will jump to the
<guilabel>Result</guilabel> window. The window shows the calculated Lyapunov
exponents in a table and beneath the table it shows the sum of the
calculated exponents. If you told COPASI to calculate the divergence
as well, this will be shown underneath the <guilabel>Sum of Lyapunov 
Exponents</guilabel> display. If you
told COPASI to calculate all Lyapunov exponents (as many as there are
independent variables in the model), the sum of the exponents and the
divergence should be equal; if it isn't COPASI will display a
warning. Since the warning only makes sense if all exponents have been
calculated, it will not be displayed otherwise. It is expected
that the divergence and the sum differ in those cases.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Lyapunov_02.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Results window for the Lyapunov Exponent calculation.</phrase>
 </textobject>
 <caption>
  <para>Results from a Lyapunov Exponent calculation.</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para></para>
</sect1>

<sect1 id="parameterScan" xreflabel="Parameter Scan">
<title>Parameter Scan</title>
<para>
The leaf for <guibutton>Parameter Scan</guibutton> in the object tree is 
located under <guibutton>Multiple Tasks</guibutton>. At the top,
the dialog displays a box called <guilabel>New scan item</guilabel>
together with a <guibutton>...Create!</guibutton> button. When the dialog
is opened for the first time, the only item in the widget below is a
green box called <guilabel>Task</guilabel>. This widget contains a
drop down list with all the tasks that can be used in a
scan. Additionally there are a check box called <guilabel>always use
initial conditions</guilabel> and a check box called <guilabel>output
from subtask</guilabel>.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/ParameterScan_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog showing scan task dialog when first opened</phrase>
 </textobject>
 <caption>
  <para>Initial scan task dialog</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
The tasks for which scans can be conducted are <emphasis>Steady-State</emphasis>, 
<emphasis>Time Course</emphasis>, <emphasis>Metabolic Control Analysis</emphasis>, 
and <emphasis>Lyapunov Exponents</emphasis>. So if you want to do a scan for a 
time course calculation, you should choose <emphasis>Time Course</emphasis> from 
the drop down list in the <guilabel>Task</guilabel> widget. We will ignore the 
two check boxes for the time being and take a look at the drop down list at the top of
the <guilabel>Scan Task</guilabel> dialog. This drop down list
contains three entries named <emphasis>Parameter Scan</emphasis>, 
<emphasis>Repeat</emphasis> and <emphasis>Random distribution</emphasis>. 
Those are additional elements that can be added to the
main widget below to form complex tasks. 
</para>
<para>
Let us look at one after the other and start with the <emphasis>Parameter 
Scan</emphasis>. As it is right now, the scan task does not do anything since 
we have not told it yet which parameter we want to scan. To define a parameter 
for the scan, you choose <emphasis>Parameter Scan</emphasis> from the drop down 
list at the top and press the <guibutton>...Create!</guibutton> button. COPASI 
will add a new widget to the dialog that is called <guilabel>Scan</guilabel>. 
The <guilabel>Scan</guilabel> widget contains some empty line edit fields and 
a button labeled <guibutton>...</guibutton> and a check box labeled
<guilabel>logarithmic</guilabel>.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/ParameterScan_02.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog showing scan task dialog with a Parameter Scan item</phrase>
 </textobject>
 <caption>
  <para>Scan task dialog with scan item</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
The first thing you have to do is to select the parameter for the
scan. You do this by clicking on the <guibutton>...</guibutton> button
and selecting a parameter from the selection dialog that
appears. Once you are finished with your selection and pressed the
<guibutton>OK</guibutton> button, the name of the object you chose
will appear in the line edit field beside the
<guibutton>...</guibutton> button. In the line edit fields below you
can now specify the minimal value the parameter will have during the
scan as well as the maximal value. After choosing the object, these
values will be set to half the objects value for the minimum and
double the objects value for the maximum. In the
<guilabel>Intervals</guilabel>, you can specify how many intervals
COPASI uses during the scan to raise the value from minimum to
maximum. Last but not least, the <guilabel>logarithmic</guilabel>
check box determines whether the value is raised in linear steps if
the box is unchecked or in logarithmic steps if the box is checked.
Now you are set to run your first simple scan by clicking on the
<guibutton>Run</guibutton> at the bottom of the dialog. In order to
actually see some result, you have to have some kind of output
defined. The scan task can generate reports and, if a plot is defined,
the scan task will do plotting while running the scan. If you did not
change the number of intervals from the default, the scan task will
run 10 time course simulations each with a different value for the
chosen parameter and in turn you will see 10 plots overlaid in one
plot window.
</para>
<para>
If you want to have output from the parameter scan, you have to create
an output definition as described in the <xref
linkend="outputGeneration" /> section. The easiest way is probably to
use the output assistant which you activate via the <guibutton>Output
Assistant</guibutton> button. This is described in the <xref
linkend="outputAssistant" /> section. All that is left to do in order
to write the output to a specific file is to connect an output
definition with a file. This can be achieved by clicking on the
<guibutton>Report</guibutton> button. This opens a dialog that lets
you connect the report of a specific task to a file on your hard
disk. First we choose a report that is suitable for the parameter scan
task from the drop down list at the top of the dialog. Next, we
specify a file that will be used to store the report by clicking on
the <guibutton>browse</guibutton> button and selecting the destination
in the file dialog that opens. Per default, COPASI creates a new file
or overwrites an existing file with the same name. Alternatively, you
can tell COPASI to append the report to the end of an existing file by
selecting the corresponding check box labeled
<guilabel>Append</guilabel> at the bottom of the dialog. Once you are
finished, you click on the <guilabel>Confirm</guilabel> button. If you
now run the task, COPASI will write the output to the file you
specified.
</para>
<para>
So far we have only scratched the surface of the scan dialog. E.g. if
you want to do a two-dimensional scan, i.e. a scan where two
parameters are independently scanned, you can add a second
<guilabel>Scan</guilabel> widget by adding it to the main dialog just
like you did for the first parameter. You select <emphasis>Parameter 
Scan</emphasis> in the drop down list and push the <guibutton>...Create!</guibutton>
button.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/ParameterScan_03.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog showing scan task dialog with two Parameter Scan items</phrase>
 </textobject>
 <caption>
  <para>Scan task dialog with two scan items</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/ParameterScan_04.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog showing scan task dialog with a Random distribution item</phrase>
 </textobject>
 <caption>
  <para>Scan task dialog with random distribution item</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
After adjusting the minimum and maximum as well as the number of
intervals, you can run the scan task again. COPASI will now do a scan
for the first parameter while holding the second parameter constant at
the minimum. Next, COPASI will raise the second parameter and do
another scan from minimum to maximum for the first parameter. This way
a full scan for the first parameter is done for every value of the
second parameter. You have to be careful because assuming that you
chose 10 intervals for both parameters, COPASI will run 100 time
course simulations during this two-dimensional scan which can take a
long time.
</para>
<para>
The <emphasis>Random distribution</emphasis> item is similar to the 
<emphasis>Parameter Scan</emphasis> item. With the random distribution,
a parameter can be given a random value. After adding a <guilabel>Random 
distribution</guilabel> widget to the main dialog,
you first have to choose a parameter for which a random value will be
set. You can then choose from three distribution types to generate the
random value. The three distributions are <emphasis>Uniform 
distribution</emphasis>, <emphasis>Normal distribution</emphasis> and 
<emphasis>Poisson distribution</emphasis>. Additionally, you
have to set the bounds within which the random value will be set
(uniform distribution) or the mean and average values (normal
distribution) or just the mean value (Poisson distribution). If all has 
been set and you press the <guibutton>Run</guibutton>, COPASI will set 
the parameter value to a random value from the chosen distribution and 
run one time course simulation.
</para>
<para>
The <emphasis>Repeat</emphasis> item can be used to repeat a certain 
action several times. For example, if you add a <guilabel>Repeat</guilabel> 
widget above a <guilabel>Random distribution</guilabel> one, the parameter 
will be given a random value as many times as specified in the 
<guilabel>Repeat</guilabel> widget and time course simulation, or one of the 
other tasks specified in the <guilabel>Task</guilabel> one at the bottom 
of the main widget, is run with this value.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/ParameterScan_05.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog showing scan task dialog with a Random distribution and Repeat item</phrase>
 </textobject>
 <caption>
  <para>Scan task dialog with random distribution and repeat item</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
Different items can be combined in many ways to achieve certain
goals. For instance, you could run 10 parameter scans for a certain value,
each with a different random value for another parameter, by combining a
<guilabel>Scan</guilabel> widget with a <guibutton>Random distribution</guibutton>
and a <guilabel>Repeat</guilabel> ones.
</para>
<para>
With the buttons on the left of each item, except the
<guilabel>Task</guilabel> at the bottom, you can move the items up or
down in the list or close an item you no longer need. The order of the
items in the main widgets determines in which order COPASI will handle
the actions. A widget is controlled by the widget above it. Thus, it 
can be rather important, if a <guilabel>Repeat</guilabel> acts on 
the widget directly below it. 
</para>
<para>
Consider you have added a <guilabel>Repeat</guilabel> widget and 
a <guilabel>Random distribution</guilabel> one to the main widget. 
Now the <guilabel>Repeat</guilabel> widget can be either above the
<guilabel>Random distribution</guilabel> widget or below it, and the
results you get after pushing the <guibutton>Run</guibutton> button 
are very different. 
</para>
<para>
Lets first look at the case where the <guilabel>Repeat</guilabel> widget 
is above the <guilabel>Random distribution</guilabel> widget. If you push
the <guibutton>Run</guibutton> button, COPASI will run the task as many 
times as you have specified in the <guilabel>Repeat</guilabel> widget, 
each time with a different random value for the parameter you have chosen 
in the <guilabel>Random distribution</guilabel> widget. Now lets assume the
<guilabel>Repeat</guilabel> is below the <guilabel>Random
distribution</guilabel>. If you push the <guibutton>Run</guibutton> button 
now, COPASI will also run the task as many times as you specified in the
<guilabel>Repeat</guilabel> widget. The difference is that this time,
the parameter value gets a random value before the repeat takes
effect, i.e. all runs are done with the same random value for the
chosen parameter. If you do this for a deterministic time course
simulation and a concentration plot is defined, the difference becomes
obvious because in the first case, you will probably get X different
curves, whereas in the second case you may get X times the same curve.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/28/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/ParameterScan_06.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog showing scan task dialog with a more complex combination of actions</phrase>
 </textobject>
 <caption>
  <para>Scan task dialog with combination of actions</para>
 </caption> 
</mediaobject>
</screenshot>
</para>

<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/29/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/ParameterScan_07.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog showing scan task dialog with a repeated random distribution</phrase>
 </textobject>
 <caption>
  <para>Scan task dialog with repeated random distribution</para>
 </caption> 
</mediaobject>
</screenshot>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/29/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/ParameterScan_08.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Plot with 10 different curves</phrase>
 </textobject>
 <caption>
  <para>Plot with 10 different curves</para>
 </caption> 
</mediaobject>
</screenshot>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/29/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/ParameterScan_09.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Dialog showing scan task dialog with a random distribution where the time course task is repeated</phrase>
 </textobject>
 <caption>
  <para>Scan task dialog with with random distribution where time course task is repeated</para>
 </caption> 
</mediaobject>
</screenshot>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/29/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/ParameterScan_10.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Plot with 10 times the same curve</phrase>
 </textobject>
 <caption>
  <para>Plot with 10 identical curves</para>
 </caption> 
</mediaobject>
</screenshot>
</para>
<para>
What we have left out so far are the two check boxes at the bottom of
the <guilabel>Task</guilabel> widget. The first check box is labeled
<guilabel>always use initial conditions</guilabel>. If this check box
is checked, each task that is run runs with the same initial
conditions. If the check box is not checked, only the first task that
runs uses the initial conditions from the model, each subsequent task
uses the conditions as they are after the preceding task has
finished. 
</para>
<para>
The second check box is labeled <guilabel>output from
subtask</guilabel>. If it is checked, COPASI will plot or write the
complete time series result each time a time series task
runs. Correspondingly it will output intermediate results for the
other tasks. So if during your scan, 10 time series are calculated,
all ten are overloaded in the same window. If the check box is
unchecked, COPASI will only plot the end result, i.e. the
concentrations after the last step, of each time series. This applies
to reports correspondingly. This feature is useful if you want to plot
some calculation results as a function of the parameter that is
scanned. So e.g. you could plot the end result of a Steady-State
calculation on the y-Axis versus a kinetic parameter on the x-Axis.
</para>
</sect1>

<sect1 id="optimization" xreflabel="Optimization">
<title>Optimization</title>

<para>
The optimization task lets you minimize a given objective function by
scanning one or more parameters over a given range. This probably
sounds rather cryptic, therefore, lets try to illustrate this with a
simple example.
</para>
<para>
We assume you have a model that consists of several reactions and two
of those reactions fluxes (R1, R2) depend on a certain parameter k
(either directly or indirectly). Now you are interested in finding the
optimal value of k so that the ratio of R1/R2 will be maximal. So lets
see how you would do this in COPASI. 
</para>

<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/29/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Optimization_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>MacOS screenshot that shows COPASI optimization dialog</phrase>
 </textobject>
 <caption>
  <para>Optimization Dialog</para>
 </caption> 
</mediaobject>
</screenshot>
</para>

<para>
If you go to the optimization dialog which you can find in the tree
under <guilabel>Multiple
Task</guilabel>-><guilabel>Optimization</guilabel>, you will get a
screen similar to the one above. At the top of the dialog, you can
find an edit line called Expression where you have to input your
objective function, that is the expression that COPASI will try to
minimize during the optimization. In our case, we want to find the
value of k where the ratio of R1 and R2 is maximal. At the beginning
of this section, I stated that COPASI will minimize a given objective
function, but we would like to maximize the objective function
R1/R2. So how do we generate a function to be minimized out of the
function R1/R2? This can be achieved in two ways, either we inverse
the ratio in order to minimize R2/R1, or we add a "-" sign to our
ratio R1/R2. (For the sake of simplicity, I will assume here that the
fluxes R1 and R2 will always be positive.) For this example I will use
the second possibility and therefore the objective function for COPASI
to minimize will be -(R1/R2). Now you can't just enter this expression
into the line edit field since COPASI does not associate the names R1
and R2 with the fluxes through your reactions. In order to build this
expression, you have to start typing "-(" into the line edit
field. Now, you have to press the button to the right of the line edit
field which opens the object browser. In this object browser, you
select the flux (particle or concentration) which belongs to R1 and
press the <guibutton>OK</guibutton> button. Now you will get a string
that corresponds to this flux object right after the part of the
expression you already typed. You can now go on by typing "/" followed
by the selection of the flux for R2. You end the expression by typing
")". Please be aware that you are allowed to edit the expression, but
only those parts of the expression that do not belong to object
representation strings. That means everything that has been inserted
via selection from the object browser may not be modified. You may
however delete complete identifier expressions.
</para>
<para>
You can run an optimization task with several different methods which
can be selected via the drop down list below the input field for the
objective function. Each of those methods has a number of parameters
which are documented in the methods chapter.
</para>
<para>
The optimization task can also be run on either the "Time Course" or
the "Steady-state" subtask. Which one is used for the optimization run
can be selected via the correspondingly named check boxes. So for our
example we would choose the "Time Course" subtask. 
</para>
<para>
The only thing we have not done yet is to tell COPASI which
parameter(s) it should scan in order to minimize the objective
function. In the middle of the widget, there is another line edit
field right after <guilabel>Object</guilabel> where you can specify
which parameter is to be scanned. The selection is again done via
clicking on the button to the right of the edit field and selecting
the correct parameter from the object browser. Please note that is
possible to create multiple parameters at once. Below the Object you
can specify the upper and lower 
bounds for the parameter during the optimization. Those bounds can also be
expressions depending on other parameters. Per default, the check boxes
for -Infinity and +Infinity are selected as the boundaries. Since a
computer can't handle infinitely small or large numbers, 
the search will effectively proceed from the lowest possible to the
largest possible double precision number. If you want to specify your
own range, you first have to deselect the <guilabel>+Inf</guilabel> or
<guilabel>-Inf</guilabel> check box and then you can set your own
bounds. As a matter of convenience you may enter -X% or +X% as the
lower and upper limits. This instructs COPASI to calculate the limits
based on the start value.
The start value is the initial parameter
value used by COPASI in any fitting attempt. Per default COPASI
selects the current model value of the parameter to be estimated as
the starting value. You may manually override this default or use the
<guibutton>...</guibutton> to reset it to model values, randomize it, or
set it to the last estimated values. Please note, if the start value of a parameter is outside the boundaries specified, COPASI will force it to the nearest boundary during th optimization.
If you want to delete a parameter from the scan list, you just
select it and click on the <guilabel>delete</guilabel> button which
you find at the right side. If you want to scan more than one
parameter, you just add more by clicking on the
<guibutton>new</guibutton> button and add as many parameters as you
need. Please note, you may select multiple parameters and edit them
simultaneously. You can
also change the order in which the parameters are scanned by moving
them up or down in the list with the corresponding buttons at the
right side of the widget. This has only an effect if the parameter
boundaries of one parameter depend on another parameter. COPASI does
not currently determine such a dependency and it is left to the user
to order the parameters appropriately. 
</para>

<para>
In addition to parameters COPASI knows also about
constraints. Constraints are applied to the solution. i.e., they are
evaluated after the simulation which can currently be either a time
course or a Steady-State calculation. A possible constraint could be
that the Steady-State concentration of a species has to be within a
certain range that can b specified by the user. The widget for
specifying these constraints can be found under the tab called
<guilabel>Constraints</guilabel> and the constraints are specified in
the same way as the parameters to be scanned. Each constrained
consists of an object that is to be constrained and an upper and lower
bound that define the constraint for the object. Just like for the
parameters, several constraints can be specified. 
</para>

<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/29/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Optimization_02.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>MacOS screenshot that shows the progress dialog during an optimization task run </phrase>
 </textobject>
 <caption>
  <para>Optimization Progress Dialog</para>
 </caption> 
</mediaobject>
</screenshot>
</para>

<para>
Once you have set up all the parameters, you are ready to run the
optimization task by clicking on <guibutton>Run</guibutton>. COPASI
will now display a progress dialog which informs you about the
progress of the calculation and about the best (smallest) value found
for the objective function up to this step. Since this progress dialog
will close once the optimization task has run, you probably also want
to define a report to be written during the calculation. In many cases
using the default report name "Optimization" is sufficient. The
default report outputs a description of all the settings you provided
for the optimization run. It prints intermediate results during the
calculation every time the target value has improved. In the end it
prints a summary of the result. The easiest way to define a customized
report is to use the <link linkend="outputAssistant">output
assistant</link>. Alternatively, you can create a report manually as
described in the <xref linkend="outputGeneration" /> section. Once you
have created a report definition for the optimization task, you click
on the <guibutton>report</guibutton> button at the bottom of the
dialog. In the dialog that opens, you select the report you just
created from the drop down list labeled <guilabel>Report
Definitions</guilabel> and then you select a filename where the report
is to be stored in the field labeled <guilabel>Target</guilabel>. You
can either type a filename manually, or you can select one by clicking
on the <guibutton>browse</guibutton> button. When you are finished,
you click the <guibutton>Confirm</guibutton> button. Now the next time
you run the optimization, a report will be stored in the location you
specified. 
</para>

</sect1>

 <sect1 id="parameterEstimation" xreflabel="Parameter Estimation">
<title>Parameter Estimation</title>
<para>
Parameter estimation is the process of trying to calculate model
parameters based on a dataset. This dataset can be the result of
time course or steady-state experiments or both. COPASI reads a
dataset, which may be comprised of several files each including
possibly multiple experiments. After the load of the dataset COPASI
tries to fit one or more parameters that are specified by the user to
that dataset. The methods COPASI uses to estimate good parameter
values are the same as in the optimization task. For a description of
the different methods, you should read the methods section of this
document.
</para>
<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/29/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/ParameterEstimation_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>MacOS screenshot that shows COPASI Parameter Estimation dialog</phrase>
 </textobject>
 <caption>
  <para>Parameter Estimation Dialog</para>
 </caption> 
</mediaobject>
</screenshot>
</para>

<para>
The dialog for the parameter estimation task can be activated by
selecting the branch called <guilabel>Parameter Estimation</guilabel>
under the <guilabel>Multiple Tasks</guilabel> branch of the tree view
on the left side of the user interface. 
First you can define which parameters COPASI shall try to fit. Each
parameter to be fitted can be added like in the Optimization. To do
this, click on the button beside the line edit labeled
<guilabel>Object</guilabel>, this will open a selection dialog where
you can choose the parameter. Additionally you can specify an upper
and a lower bound for the parameter. COPASI will only try to fit the
parameter within those bounds. Per default, the upper and lower bound
are + Infinity and - Infinity respectively. 
If you want to set your own bounds, disable the check boxes and enter
your own value in the edit field. The value for the lower bound goes
into the correspondingly labeled edit field, likewise for the upper
bound. As a matter of convenience you may enter -X% or +X% as the
lower and upper limits. This instructs COPASI to calculate the limits
based on the start value.  
You can also specify other objects from the model as bounds for the
parameter. To choose the value of another object as a bound for the
parameter, click on the button beside the edit field and choose the
object from the tree.  The start value is the initial parameter
value used by COPASI in any fitting attempt. Per default COPASI
selects the current model value of the parameter to be estimated as
the starting value. You may manually override this default or use the
<guibutton>...</guibutton> to reset it to model values, randomize it, or
set it to the last estimated values. Please note, if the start value of a parameter is outside the boundaries specified, COPASI will force it to the nearest boundary during th parameter estimation. Additionally, you can restrict
the effect of a parameter to a subset of the experiments you are
attempting to fit. To do this select the <guibutton>...</guibutton> to
the right of <guilabel>Affected Experiments</guilabel>. A possible
application is to fit different initial values for each time course
experiment. To help you in such a case the <guibutton>Duplicate for
each Experiment</guibutton> button will create a copy of the current
parameter for each specified experiment. 
</para>

<sect2 id="experimentalData" xreflabel="Experimental Data">
<title>Experimental Data</title>

<para>
Before you can execute a parameter estimation task you need to specify
the dataset which COPASI will use to fit the parameters you have
specified. Each experiment of your dataset contributes to the objective
function with the following weighted sum of squares: 
<equation id="eq.SumOfSquares"><mml:math display="block">
  <mml:mrow>
   <mml:mrow>
    <mml:mi>E</mml:mi>
    <mml:mrow>
     <mml:mo>(</mml:mo>
     <mml:mi>P</mml:mi>
     <mml:mo>)</mml:mo>
    </mml:mrow>
    <mml:mo>=</mml:mo>
    <mml:msub>
     <mml:mo>&Sigma;</mml:mo>
     <mml:mrow>
      <mml:mi>i</mml:mi>
      <mml:mi>,</mml:mi>
      <mml:mi>j</mml:mi>
     </mml:mrow>
    </mml:msub>
   </mml:mrow>
   <mml:msub>
    <mml:mo>&omega;</mml:mo>
    <mml:mi>j</mml:mi>
   </mml:msub>
   <mml:msup>
    <mml:mrow>
     <mml:mo>(</mml:mo>
     <mml:mrow>
      <mml:mrow>
       <mml:msub>
        <mml:mi>x</mml:mi>
        <mml:mrow>
         <mml:mi>i</mml:mi>
         <mml:mi>,</mml:mi>
         <mml:mi>j</mml:mi>
        </mml:mrow>
       </mml:msub>
       <mml:mo>-</mml:mo>
       <mml:msub>
        <mml:mi>y</mml:mi>
        <mml:mrow>
         <mml:mi>i</mml:mi>
         <mml:mi>,</mml:mi>
         <mml:mi>j</mml:mi>
        </mml:mrow>
       </mml:msub>
      </mml:mrow>
      <mml:mrow>
       <mml:mo>(</mml:mo>
       <mml:mi>P</mml:mi>
       <mml:mo>)</mml:mo>
      </mml:mrow>
     </mml:mrow>
     <mml:mo>)</mml:mo>
    </mml:mrow>
    <mml:mn>2</mml:mn>
   </mml:msup>
  </mml:mrow>
</mml:math></equation>
Where
<inlineequation><mml:math><mml:mi>P</mml:mi></mml:math></inlineequation>
is the currently tested parameter set,
<inlineequation><mml:math>
 <mml:msub>
  <mml:mi>x</mml:mi>
  <mml:mrow>
   <mml:mi>i</mml:mi>
   <mml:mi>,</mml:mi>
   <mml:mi>j</mml:mi>
  </mml:mrow>
 </mml:msub>
</mml:math></inlineequation>
is a point in the dataset, and
<inlineequation><mml:math>
 <mml:msub>
  <mml:mi>y</mml:mi>
  <mml:mrow>
   <mml:mi>i</mml:mi>
   <mml:mi>,</mml:mi>
   <mml:mi>j</mml:mi>
  </mml:mrow>
 </mml:msub>
 <mml:mrow>
  <mml:mo>(</mml:mo>
  <mml:mi>P</mml:mi>
  <mml:mo>)</mml:mo>
  </mml:mrow>
</mml:math></inlineequation> the corresponding simulated value. The indices
<inlineequation><mml:math><mml:mi>i</mml:mi></mml:math></inlineequation> and
<inlineequation><mml:math><mml:mi>j</mml:mi></mml:math></inlineequation>
denote rows and columns in the dataset.
The weight for each data column is given by
<inlineequation><mml:math>
 <mml:msub>
  <mml:mo>&omega;</mml:mo>
  <mml:mi>j</mml:mi>
 </mml:msub>
</mml:math></inlineequation>. COPASI provides 3 methods shown in the
table below to calculate the weights for you. After applying the
method chosen COPASI scales the weights so that for each
experiment the maximal occurring weight is 1. In case that the weights
calculated are not satisfactory you are able to manually override them
individually. 
</para>
<para>
<table id="tbl.WeightCalculationMethods" frame="all"><title>Weight Calculation Methods</title>
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colwidth="1*" />
<colspec colwidth="3*" />
<thead>
 <row>
   <entry>Name</entry>
   <entry>Formula</entry>
 </row>
</thead>
<tbody>
 <row>
  <entry>Mean</entry>
  <entry>
   <inlineequation><mml:math>
    <mml:mrow>
     <mml:msub>
      <mml:mo>&omega;</mml:mo>
      <mml:mi>j</mml:mi>
     </mml:msub>
     <mml:mo>=</mml:mo>
     <mml:mrow>
      <mml:mn>1</mml:mn>
      <mml:mo>/</mml:mo>
      <mml:mrow>
       <mml:mo>|</mml:mo>
       <mml:mo>&lt;</mml:mo>
       <mml:msub>
        <mml:mi>x</mml:mi>
        <mml:mi>j</mml:mi>
       </mml:msub>
       <mml:mo>&gt;</mml:mo>
       <mml:mo>|</mml:mo>
      </mml:mrow>
     </mml:mrow>
    </mml:mrow>
   </mml:math></inlineequation>
  </entry>
 </row>
 <row>
  <entry>Mean Square</entry>
  <entry>
  <inlineequation><mml:math>
   <mml:mrow>
    <mml:msub>
     <mml:mo>&omega;</mml:mo>
     <mml:mi>j</mml:mi>
    </mml:msub>
    <mml:mo>=</mml:mo>
    <mml:mrow>
     <mml:mn>1</mml:mn>
     <mml:mo>/</mml:mo>
     <mml:msqrt>
      <mml:mrow>
       <mml:mo>&lt;</mml:mo>
       <mml:msubsup>
        <mml:mi>x</mml:mi>
        <mml:mi>j</mml:mi>
        <mml:mn>2</mml:mn>
       </mml:msubsup>
       <mml:mo>&gt;</mml:mo>
      </mml:mrow>
     </mml:msqrt>
    </mml:mrow>
   </mml:mrow>
   </mml:math></inlineequation>
  </entry>
 </row>
 <row>
  <entry>Standard Deviation</entry>
  <entry>
   <inlineequation><mml:math>
    <mml:mrow>
     <mml:msub>
      <mml:mo>&omega;</mml:mo>
      <mml:mi>j</mml:mi>
     </mml:msub>
     <mml:mo>=</mml:mo>
     <mml:mrow>
      <mml:mn>1</mml:mn>
      <mml:mo>/</mml:mo>
      <mml:mrow>
       <mml:mo>(</mml:mo>
       <mml:mo>&lt;</mml:mo>
       <mml:msubsup>
        <mml:mi>x</mml:mi>
        <mml:mi>j</mml:mi>
        <mml:mn>2</mml:mn>
       </mml:msubsup>
       <mml:mo>&gt;</mml:mo>
       <mml:mo>-</mml:mo>
       <mml:mo>&lt;</mml:mo>
       <mml:msub>
        <mml:mi>x</mml:mi>
        <mml:mi>j</mml:mi>
       </mml:msub>
       <mml:mo>&gt;</mml:mo>
       <mml:mo>&lt;</mml:mo>
       <mml:msub>
        <mml:mi>x</mml:mi>
        <mml:mi>j</mml:mi>
       </mml:msub>
       <mml:mo>&gt;</mml:mo>
       <mml:mo>)</mml:mo>
      </mml:mrow>
     </mml:mrow>
    </mml:mrow>
   </mml:math></inlineequation>
  </entry>
 </row>
</tbody>
</tgroup>
</table>
</para>

<para>
To specify the experimental data you click on the <guibutton>Experimental
Data</guibutton> button at the top right of the parameter estimation
dialog. A new dialog opens that lets you enter experimental data.
</para>

<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/29/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/ParameterEstimation_02.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>MacOS screenshot that shows COPASI Experimental Data dialog</phrase>
 </textobject>
 <caption>
  <para>Experimental Data Dialog</para>
 </caption> 
</mediaobject>
</screenshot>
</para>

<para>
To read a data file,
click on the open button beside the label <guilabel>File</guilabel> at
the top of the dialog and choose a file that contains experimental
data from the file dialog. The data file should contain experimental
data grouped in experiments. To support automatic detection of
experiments these must be separated by one or more empty lines. But
manually definition of experiments is allowed. The data for an
experiment must be a table of values. The columns of the table are
separated by a user specifiable separation character. The default and
recommended character is the &lt;tab&gt;-character. The first line of
each experiment is treated as the row containing the column
headings. However, this is only a default and the header row can be
specified by the user. The header row may be anywhere in the file the
data is contained. The purpose of the header row is to ease the
interface to the data file and may be omitted. To tell COPASI that
no header row is included uncheck the box next to the header. Once
COPASI has read a file, you have to specify some information for each
experiment included in the file. To select an experiment you choose it
from the right selection box. The first thing you need to specify is
whether the data belongs to a Steady-State analysis or to a time
course simulation. You also have to associate the individual columns of
input data to elements of the model. For this, you click on the
<guibutton>...</guibutton> button in each row and select the
corresponding object in the selection dialog. It is mandatory that
COPASI knows about the meaning of each data column. The data in a
column can have four different types, which are: 
<variablelist>
 <varlistentry><term>ignored</term>
  <listitem><para>
Values in columns marked ignored are not taken into account during
parameter fitting. Columns of this type may not be associated with
elements of the model. 
  </para></listitem>
 </varlistentry>
 <varlistentry><term>independent</term>
  <listitem><para>
Independent data is data which needs to be set for the correct
simulation of the experiment row. Possible model elements are initial
concentrations or kinetic parameters. Note, for a time course
experiment only the independent data in the first data row is set
before the start of the simulation. Columns of this type must be
associated with elements of the model. 
  </para></listitem>
 </varlistentry>
 <varlistentry><term>dependent</term>
  <listitem><para>
The dependent data is the data, which COPASI tries to fit by
minimizing the sum of squares between the simulated data and the
experimental data. Columns of this type must be associated with
elements of the model. 
  </para></listitem>
 </varlistentry>
 <varlistentry><term>Time</term>
  <listitem><para>
This column type is only available for time course
experiments. Obviously only one column with this data type may
exist. COPASI attempts to automatically identify the column containing
the time by looking at the column headers. You may correct COPASI's
guess. This column may not be mapped to any model elements. 
  </para></listitem>
 </varlistentry>
</variablelist>
</para>
<para>
If you don't want COPASI to use the whole dataset of an experiment,
but only a subset, you can specify the start and end line for this
subset. You also may delete experiments completely. If you do so, you
may notice that the <guibutton>New Document</guibutton> will be
enabled. Pressing it will add the first not used experiment of the
currently active file. Since it is commonly the case that all
experimental data within one file has the same format, COPASI allows you
to copy information of experimental data from the previous to the
current or form the current to the
next experiment within a file by selecting <guibutton>from
previous</guibutton> and <guibutton>to next</guibutton>. If COPASI
detects that experimental data descriptions are identical it will
automatically set the <guibutton>from previous</guibutton> check box
and disable editing the current experiment. Should you want to modify
it you will have to unmark the check box first.
</para>
<para>
If you have more than one file, you can load additional data files and
process them in the same manner. Once you are finished defining your
datasets for the fitting, you close the data dialog with the
<guibutton>OK</guibutton> button. Before you can start the parameter
estimation process, you have to choose the method by which the fitting
will be done and maybe set some method parameters. Most of the time,
the default parameter values should do. The method choosing is done at
the bottom of the dialog by selecting the method from the drop down
list. For an explanation of the individual methods, please consult the
methods section. 
</para>
</sect2>

<sect2 id="parameterEstimationResult" xreflabel="parameter estimation result">
<title>Result</title>
<para>
If you want to have output from the parameter estimation task, you
have to create an output definition as described in the <xref
linkend="outputGeneration" /> section or you choose the default report
named "Parameter Fitting". The default reports prints a description of
the settings you provided for this parameter fitting run, intermediate
results every time the target function improves, and a detailed result
at the end.  The easiest way to get a customized output is probably to
use the output assistant which you activate via the <guibutton>Output
Assistant</guibutton> button. This is described in the <xref
linkend="outputAssistant" /> section. All that is left to do in order
to write the output to a specific file is to connect an output
definition  with a file. This can be achieved by clicking on the
<guibutton>Report</guibutton> button. This opens a dialog that lets
you connect the report for a specific task to a file on your hard
disk. First we choose a report that is suitable for the parameter
estimation task from the drop down list at the top of the
dialog. Next, we specify a file that will be used to store the report
by clicking on the <guibutton>browse</guibutton> button and selecting
the destination in the file dialog that opens. Per default, COPASI
creates a new file or overwrites an existing file with the same
name. Alternatively, you can tell COPASI to append the report to the
end of an existing file by selecting the corresponding check box
labeled <guilabel>Append</guilabel> at the bottom of the dialog. Once
you are finished, you click on the <guilabel>Confirm</guilabel>
button. If you now run the task, COPASI will write the output to the
file you specified.  
</para>

<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/29/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/ParameterEstimation_05.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>MacOS screenshot that shows COPASI Parameter Estimation Results</phrase>
 </textobject>
 <caption>
  <para>Parameter Estimation Results</para>
 </caption> 
</mediaobject>
</screenshot>
</para>

<para>
After running a Parameter Estimation task the result may be viewed by
selecting the <guilabel>Result</guilabel> widget. This result widget
contains multiple tabs. 
The overall fit and performance statistic are displayed in the
<guilabel>Main</guilabel> and detailed information about parameters,
experiments, and fitted values can be found under the corresponding
tabs. In addition, you may look at the correlation matrix of the
parameters or the Fisher information matrix. 
</para>
</sect2>
</sect1>

<sect1 id="sensitivities" xreflabel="Sensitivities">
<title>Sensitivity Analysis</title>
<para>
</para>

<para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/29/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Sensitivities_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>MacOS screenshot that shows the sensitivity analysis task</phrase>
 </textobject>
 <caption>
  <para>Sensitivity Analysis</para>
 </caption> 
</mediaobject>
</screenshot>
</para>

</sect1>

</chapter>

<chapter id="importExport" xreflabel="Import/Export">
<title>Importing and Exporting</title>
<para>
COPASI is one modeling and simulation tool among many and often people
use more than one tool to create, investigate and simulate their
models. In order to make it easier to exchange model files with other
programs, COPASI supports reading and writing of several model file
formats. Naturally COPASI can read and write it's own file format and
it can read Gepasi files just as well although it will not write
Gepasi files. 
</para>
<para>
In addition to those two file formats, COPASI can import SBML Level 1
and 2 files and it can export models as SBML Level 2 files as well as
C source code, XPPaut, or Berkeley Madonna files.
</para>
<sect1 id="sbmlImportExport" xreflabel="Importing and Exporting SBML files">
<title>Importing and Exporting SBML files</title>
<para>COPASI is able to import <ulink url="http://www.sbml.org">SBML</ulink> level 1 and level 2 files as well as export SBML level 2 files through the corresponding entries in the <guimenu>File</guimenu> menu. For the import and export the SBML Model is read with <ulink url="http://www.sbml.org/libsbml.html">libsbml</ulink> and converted to the COPASI model structure and vice versa.</para>
<para>On exporting, COPASI converts its native model structure to an SBML model that is again written out using libsbml. Since the SBML model structure is converted into the COPASI model structure upon import, some of the information in the SBML file gets lost because COPASI does not support the corresponding model elements. Examples of data that gets lost are certain rules and events.</para>
<para>
Notes and Annotations from the original SBML file should be preserved when you import and reexport an SBML file as long as you do not delete the objects that contain the annotation in COPASI. But still if you have important annotations or notes in your SBML file make a backup of the file before you open it in COPASI since we can not guarantee that they will survive an import/export cycle.
</para>
<para>Likewise, SBML does not support all of the elements of a COPASI model so some information from the COPASI model also gets lost when exporting an SBML file. For example tasks, reports and plot definitions are not exported to the SBML file.</para>
<para>This is normally not a big problem since the essential parts of a model normally get imported or exported. A consequence however one should keep in mind is that if you import an SBML file into COPASI and later export it again, it might have lost some of the original information. So if your SBML model depends on rules on species and compartments and events, it is not suitable for import into COPASI. This will change in future versions of COPASI.
</para>
<para>
We hope that we will be able to support even more different file
formats in the future.
</para>
<para>
Current versions of COPASI use libsbml version 3 which supports SBML files up to Level 2 Version 3. Libsbml 3 also has a lot of built-in tests to check the validity of a model. Upon import COPASI will display most of those errors to the user. Libsbml 3 also gives a lot of warnings, especially concerning units in SBML files, which should help the user in generating better, more consistent models. Even so this is a good thing, it can happen that the real errors are hidden by the large amount of warnings. COPASI now uses a new error message dialog that splits the messages in filtered and unfiltered messages. The unfiltered messages are what the user sees when the dialog comes up. In order the see the filtered messages the second tab in the message dialog has to be selected. If there are no filtered messages, this tab is disabled. In the labels of the individual tabs, COPASI also shows you the number of messages that for the corresponding tab.
</para>
<screenshot>
<screeninfo>Produced with COPASI 4.3 (Build 25) on Leopard on 02/29/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/MessageDialog_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Error Message Dialog after import of an SBML file</phrase>
 </textobject>
 <caption>
  <para>SBML Import Error Messages</para>
 </caption> 
</mediaobject>
</screenshot>
<para>
In the current version, the errors that are filtered are hard coded and they are all warnings that have to do with unit inconsistencies within the model. In future version of COPASI, we will have a mechanism that will let the user manage which error messages should be filtered.
</para>
<para>
Although COPASI now uses libsbml 3, not all features found in the different versions of SBML are currently supported. If an unsupported feature is encountered during import, COPASI will usually notify the user. Depending on which parts of the model have been ignored, ignored, the result of time course simulations and other tasks might not be what you expect.
</para>
<para>
This is still very rudimentary and we hope to improve this function recognition in the future so that also functions exported from other programs can be recognized.
</para>
</sect1>
<sect1 id="cExport" xreflabel="Exporting C Source files">
<title>Exporting C Source files</title>
<para>
Sometimes it is of advantage to have the differential equations that
make up your model in the form of source code for some programming
language. This allows you to integrate your model into some
experimental analysis software that you might have written, or some
analysis software that expect the input as C source code like <ulink
url="http://sourceforge.net/projects/auto2000/">Auto2000</ulink>. 
</para>
<para>
So far COPASI only supports the export of C source code, source code
for other programming languages might follow if there is need for it. 
</para>
<para>
The C source file COPASI exports is split into several smaller parts
which are encapsulated in #ifdef structures for the C
preprocessor. The file consists of ten such sections which can be
included in other files by defining the corresponding preprocessor
constants at the place of inclusion. Example:
</para> 
<para>
<programlisting>
#define SIZE_DEFINITIONS
#include "SOURCE FILE"
#undef SIZE_DEFINITIONS
</programlisting>
</para>
<para>
The file contains the following sections: 
</para>
<para>
<table id="tbl.PreprocessorDefines" frame="all"><title>Preprocessor Defines</title>
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colwidth="1*" />
<colspec colwidth="2*" />
<thead>
 <row>
   <entry>Name</entry>
   <entry>Description</entry>
 </row>
</thead>
<tbody>
 <row>
   <entry>SIZE_DEFINITIONS</entry>
   <entry>Contains size definitions for the individual model elements,
   e.g. N_COMPARTMENTS for the number of compartments or N_REACTIONS
   for the number of reactions. All definitions are declared with
   preprocessor #define statements.</entry> 
 </row>
 <row>
   <entry>SPECIES</entry>
   <entry>Contains assignments for the species initial
   concentrations. The assignments are of the form y[INDEX]=VALUE
   where INDEX is the index of the species and VALUE is the initial
   concentration. This assumes that the including code has generated
   an array of double values of size N_METABS called y. N_METABS is
   part of the SIZE_DEFINITIONS section (see SIZE_DEFINITIONS
   above).</entry> 
 </row>
 <row>
   <entry>INDEP_SPECIES</entry>
   <entry>Contains assignments for the independent species initial
   concentrations. The assignments are of the form x[INDEX]=VALUE
   where INDEX is the index of the independent species and VALUE is
   the initial concentration. This assumes that the including code has
   generated an array of double values of size N_INDEP_METABS called
   x. N_INDEP_METABS is part of the SIZE_DEFINITIONS section (see
   SIZE_DEFINITIONS above).</entry> 
 </row>
 <row>
   <entry>MOIETY</entry>
   <entry>Contains assignments for the moieties. The assignments are
   of the form y[INDEX]=RSIDE where INDEX is the index of the
   species and RSIDE is the calculated value for the moiety,
   e.g. 0.2 - y[INDEX2]. y is the vector of species (see
   SPECIES above).</entry> 
 </row>
 <row>
   <entry>COMPARTMENTS</entry>
   <entry>Contains assignments for the compartments initial
   volumes. The assignments are of the form c[INDEX]=VALUE where INDEX
   is the index of the compartment and VALUE is the initial
   volume. This assumes that the including code has generated an array
   of double values of size N_COMPARTMENTS called c. N_COMPARTMENTS is
   part of the SIZE_DEFINITIONS section (see SIZE_DEFINITIONS
   above).</entry> 
 </row>
 <row>
   <entry>GLOBAL_PARAMETERS</entry>
   <entry>Contains assignments for the values of global kinetic
   parameters. The assignments are of the form gk[INDEX]=VALUE where
   INDEX is the index of the global parameter and VALUE is the
   value. This assumes that the including code has generated an array
   of double values of size N_GLOBAL_PARAMS called k. N_GLOBALPARAMS
   is part of the SIZE_DEFINITIONS section (see SIZE_DEFINITIONS
   above).</entry> 
 </row>
 <row>
   <entry>KINETIC_PARAMETERS</entry>
   <entry>Contains assignments for the values of local kinetic
   parameters. The assignments are of the form k[INDEX]=VALUE where
   INDEX is the index of the local parameter and VALUE is the
   value. This assumes that the including code has generated an array
   of double values of size N_KIN_PARAMS called k. N_KIN_PARAMS is
   part of the SIZE_DEFINITIONS section (see SIZE_DEFINITIONS
   above).</entry> 
 </row>
 <row>
   <entry>KINETIC_FUNCTIONS_HEADER</entry>
   <entry>This section contains the declarations of function
   definitions. The section has to be included before the function
   definitions section itself and before the differential equations
   section is included.</entry> 
 </row>
 <row>
   <entry>KINETIC_FUNCTIONS</entry>
   <entry>This section contains the implementation of the function
   definitions.</entry> 
 </row>
 <row>
   <entry>DIFFERENTIAL_EQUATIONS</entry>
   <entry>This section contains the set of differential equations. The
   result of the right hand side of each differential equation is
   stored in a variable dxdt[INDEX]. This assumes that the including
   program has created an array of double values called dxdt of size
   N_INDEP_METABS. N_INDEP_METABS is part of the SIZE_DEFINITIONS
   section (see SIZE_DEFINITIONS above).</entry> 
 </row>
</tbody>
</tgroup>
</table>
</para>
<caution>
<para>
Some models may contains constants or functions that are not included
in the ANSI C standard. In order to be able to use exported C source
code files with those constants and functions, the user has to provide
them, e.g. by including a separate header file that defines those
constants and/or functions. Currently those are the constants for pi,
Euler's number, TRUE, FALSE and infinity as well as the functions
"asinh", "acosh", "atanh", "sec", "csc", "cot", "sech", "csch",
"coth", "arcsec", "arccsc",  "arccot", "asech", "acsch", "acoth",
"factorial" and logical "xor". 
</para>
</caution>
<para>
In order to export the set of differential equations to a C source
code file, you select the <guisubmenu>Export ODEs</guisubmenu> menu
entry from COPASI's <guimenu>File</guimenu> menu. In the save dialog
that shows up, you select <emphasis>C Files (*.c)</emphasis> from the
<guilabel>File type</guilabel> drop down and specify the name of the
file you want to write the ODEs to. After clicking on the
<guibutton>Save</guibutton> the ODEs will be saved to the specified
file.</para> 
</sect1>

<sect1 id="madonnaExport" xreflabel="Exporting Berkeley Madonna files">
<title>Exporting Berkeley Madonna<!--&trade;--> files</title>
<para>
<ulink url="http://www.berkeleymadonna.com/">Berkeley
Madonna<!--&trade;--></ulink> is a widely used commercial modeling and
simulation tool for the Windows<!--&trade;--> and Mac OS
X<!--&trade;--> operating systems. The input to Berkeley
Madonna<!--&trade;--> is a file that basically consists of a set of
parameters, initial values, function definitions and ordinary
differential equations. COPASI can generate these ordinary
differential equations from the reactions of the model and export them
together with the needed parameters in a format suitable to be read
into Berkeley Madonna<!--&trade;-->.
</para> 
<para>
Since the way ordinary differential equations are specified is similar
between different programs that take such input, it should be rather
easy to adjust the exported file for import in other programs as for
example the free <ulink
url="http://www.math.pitt.edu/~bard/xpp/xpp.html">XPPaut</ulink>
program or even <ulink
url="http://www.wolfram.com/">Mathematica<!--&trade;--></ulink>.
</para>
<!-- 
This doesn't seem to be true any more.
<para>
Names of model elements are replaced by generic names on export,
future version of COPASI will try to keep the element names if
possible. 
</para>
-->
<caution>
<para>
Berkeley Madonna does not support all mathematical functions available
in COPASI if such a function is used in a model, COPASI will write the
string "ILLEGAL FUNCTION" to the exported file instead of the name of
the function. Naturally this will lead to an error message when one
tries to load the file in Berkeley Madonna. Functions currently not
supported by Berkeley Madonna are: sec, csc, cot, sech, csch, coth,
arcsec, arccsc, arccot, arcsech, arccsch, arccoth, floor, ceil,
factorial, modulus and logical xor. 
</para>
<para>
The Constants for TRUE, FALSE, and Euler's number will be exported as
numerical values where FALSE will be exported as 0 and TRUE will be
exported as 1. Likewise infinity and "not a number" are exported as
the strings "inf" and "nan" respectively. 
</para>
<para>
COPASI adds comments to variables in the ODE by using the semicolon to
separate the comment from the actual code. Since this feature has been
added to Berkeley Madonna in Version 7.0 the exported code cannot be
used with older versions of Berkeley Madonna. 
</para>
</caution>
<para>
In order to export the set of differential equations to a Berkeley
Madonna<!--&trade;--> file, you select the <guisubmenu>Export
ODEs</guisubmenu> menu entry from COPASI's <guimenu>File</guimenu>
menu. In the save dialog that shows up, you select <emphasis>Berkeley
Madonna Files (*.mmd)</emphasis> from the <guilabel>File
type</guilabel> drop down and specify the name of the file you want to
write the ODEs to. After clicking on the <guibutton>Save</guibutton>
the ODEs will be saved to the specified file.
</para>
</sect1>
<sect1 id="xppExport" xreflabel="Exporting XPPAUT files">
<title>Exporting XPPAUT files</title>
<para>
<ulink
url="http://www.math.pitt.edu/~bard/xpp/xpp.html">XPPAUT</ulink> is a
program to to solve differential equations. It is freely available for
Windows, MacOS X, Linux/Unix and probably others. Its input format is
very similar to the one from Madonna and COPASI starting from Version
4.1 Build21 can export models as a set of differential equations for
use in XPPAUT.
</para>
<para>
In order to export the set of differential equations to an XPPAUT
file, you select the <guisubmenu>Export ODEs</guisubmenu> menu entry
from COPASI's <guimenu>File</guimenu> menu. In the save dialog that
shows up, you select <emphasis>XPPAUT (*.ode)</emphasis> from the
<guilabel>File type</guilabel> drop down and specify the name of the
file you want to write the ODEs to. After clicking on the
<guibutton>Save</guibutton> the ODEs will be saved to the specified
file.
</para>
<caution>
<para>
Just as in Berkeley Madonna, XPPAUT does not support all functions
supported by COPASI. Functions that are not supported are exported as
<emphasis>@</emphasis>. Among the unsupported functions are
<emphasis>sec</emphasis>, <emphasis>csc</emphasis>,
<emphasis>cot</emphasis>, <emphasis>sech</emphasis>,
<emphasis>csch</emphasis>, <emphasis>coth</emphasis>,
<emphasis>arcsec</emphasis>, <emphasis>arccsc</emphasis>,
<emphasis>arccot</emphasis>, <emphasis>arcsech</emphasis>,
<emphasis>arccsch</emphasis>, <emphasis>arccoth</emphasis>,
<emphasis>factorial</emphasis>, <emphasis>modulus</emphasis> and
<emphasis>logical xor</emphasis>.
</para>
<para>
The values of <emphasis>TRUE</emphasis> and <emphasis>FALSE</emphasis>
are converted to <emphasis>1</emphasis> and <emphasis>0</emphasis>
respectively upon export. <emphasis>INFINITY</emphasis> and
<emphasis>NAN</emphasis> are exported as <emphasis>INF</emphasis> and
<emphasis>NAN</emphasis>.  Since both <emphasis>INF</emphasis> and
<emphasis>NAN</emphasis> are not supported keywords in XPPAUT, those
files have to be modified before they can be used in XPPAUT.
</para>
<para>
We also noted that also <emphasis>ceil</emphasis> was mentioned in the
XPPAUT documentation, files containing this function could not be
loaded in XPPAUT.
</para>
</caution>
</sect1>
</chapter>  
<chapter id="diagrams" xreflabel="Diagrams">
<title>Diagrams</title>
<para>Starting with version 4.4.28, COPASI has the possibility to read and display layout information from COPASI and SBML files. An additional feature that comes with the diagram display is the possibility to display animations of time course data from simulations.</para>
<para>Currently there is no way to create new diagrams within COPASI, but we hope to change that in the future.</para>
<para>The layout information can either be obtained in the form of the SBML layout extension (see the <ulink url="http://otto.bioquant.uni-heidelberg.de/sbml/">SBML Layout Extension Specification</ulink> for further information) or from a COPASI file that includes layout information.</para>
<para>Since there is no way to create new diagrams in COPASI, the only way to come up with a COPASI file that includes layout information is to create an SBML file with layout information and convert it to a COPASI file. The layout in COPASI files is also stored in the form of the SBML layout extension. Only that the SBML object ids are replaced by the corresponding COPASI keys.</para>
<para>
There are several ways to create layout information for an SBML model. The <ulink url="http://sycamore.eml.org">Sycamore webapplication</ulink> allows you to load SBML files, create layout information for the model in the file and save the model with the layout information back to file. It provides different methods for generating the layout and the layout can be modified manually as well.
</para>
<para>
<ulink url="http://sabio.bioquant.uni-heidelberg.de/">SABIO-RK</ulink> is a reaction kinetics database that allows you to create SBML models from the entries in the database. The model can be saved as an SBML file and it can also create layout information for the model.
</para>
<para>
Another web application that allows the user to add layout information to an SBML file is Frank Bergmanns <ulink url="http://sbw.kgi.edu/Layout/">SBML Layout Viewer</ulink>. It allows the user to influence the layout creation by setting some parameters.
</para>
<para>
Franks Bermanns layout creation tool is also part of <ulink url="http://sbw.kgi.edu/">SBW</ulink> and since the latest Versions of COPASI do include some SBW support, it is possible to send a model from COPASI to the layout tool and get back a model with layout information. 
</para>
<para>If the model file you loaded contains layout information, the diagram table contains an entry for every layout that is contained in the file. In order to display a specific layout, you have to either click on the show button beside the layout or double click on the layout entry in the table.</para>
<screenshot>
<screeninfo>Produced with COPASI 4.4 (Build 29) on Leopard on 12/15/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Diagrams_01.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Diagram table with one diagram entry.</phrase>
 </textobject>
 <caption>
  <para>diagram table</para>
 </caption> 
</mediaobject>
</screenshot>
<para>
In the layout window that comes up, you can see some controls on the left side and on the right side you see the actual layout. When the layout is first openend, all species are displayed as rectangles.
</para>
<screenshot>
<screeninfo>Produced with COPASI 4.4 (Build 29) on Leopard on 12/15/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Diagrams_02.png" format="PNG" scale="50" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Diagram before loading simulation data. Some controls are disabled.</phrase>
 </textobject>
 <caption>
  <para>diagram window with some controls disabled due to missing simulation data</para>
 </caption> 
</mediaobject>
</screenshot>
<para>
Currently the menu bar at the top contains two control elements. The first one is a button that allows you to read time course data from COPASI if any has been calculated. If a time course has already been calculated when the laoyut window is openend, this time course data is imported automatically. Each time you rerun the time course simulation in COPASI, you have to reimport it to the layout if you want to display it.
</para>
<para>
Since the time course data is copied when it is imported to the layout, you have to take care that you  have enough memory in your machine if you either have very large simulations or if you want to animate the data in many different layout windows. In the future we will try to handle this more intelligently.
</para>
<para>
The second control element in the toolbar is for zooming in and out of the layout view.
</para>
<para>
If there is no time course data yet, many of the controls on the right side are disabled since they only make sense in the context of animating simulation data. Once simulation data has been loaded via the button in the toolbar, those controls are enabled.
</para>
<para>
If you don't need the controls, but just want to look at the diagram, the individual controls can be hidden via the <guimenu>View</guimenu> menu in the menu bar.
</para>
<para>
In order to animate your simulation data, you can use the player controls at the bottom of the screen. The controls look like the controls on a CD player and it should be easy to figure out what the individual buttons do. There are buttons to start and stop the animation, as well as buttons to forward and rewind or sngle step through the animation. You can also drag the slider beside the buttons to go to a certain time point within the animation.
</para>
<para>
During the animation, the species are displayed as colored balls. The speed of the animation can be controlled by the <guibutton>Frame rate</guibutton> element at the top of the controls.
</para>
<screenshot>
<screeninfo>Produced with COPASI 4.4 (Build 29) on Leopard on 12/15/2008</screeninfo>
<mediaobject>
 <imageobject>
  <imagedata fileref="images/Diagrams_03.png" format="PNG" scale="30" align="center" />
 </imageobject> 
 <textobject>
   <phrase>Diagram window with paused animation in size mode. Individual species are displayed as red balls, all controls are enabled.</phrase>
 </textobject>
 <caption>
  <para>diagram window with paused animation in size mode</para>
 </caption> 
</mediaobject>
</screenshot>
<para>
Depending on the <guibutton>Mapping mode</guibutton> that is controled by the radio button group with the same name, either the size of the balls or the color changes to reflect the concentration of the species at a given time point.
</para>
<para>
The radio button group above the <guibutton>Mapping</guibutton> group, called <guibutton>Scheduling Mode</guibutton> determines how the size or color of a species is determined during an animation. 
</para>
<para>
If the control is set to <emphasis>Individual Scaling</emphasis>, the size (or color) of a species is determined by the minimum and maximum value of that species. If the control is set to <emphasis>Global Scaling</emphasis>, the size or color is determined by the minimum and maximum values of all species in the model.
</para>
<para>
The last control element is the table with the names and concentrations of all species contained in the layout. The concentration displayed is the concentration of the species at the given time point of the simulation. All species that are checked vary their size or color during the animation, species tha are unchecked don't.
</para>
<para>
There is also the possibility to export the current layout as a bitmap. In order to do this, you select the <guisubmenu>Create Image</guisubmenu> menu item from the <guimenu>View</guimenu> menu.
Currently, this only allows you the create a bitmap of the layout as it is displayed. Parts that are not displayed because the window is to small are not written to the bitmap. So in order to make a bitmap from large layouts, you might have to hide the controls as described above, make the layout window as large as possible and change the zoom factor until the full layout is displayed in the layout window. We also hope to make this more convenient in the future.
</para>
<para>
Since this is an early version of the diagram display, there certainly are still many issues, but we hope that it might be helpful nevertheless. If you have suggestions or complaints, please tell us, preferably via the <ulink url="http://www.copasi.org/tiki-view_forum.php?forumId=1">COPASI user forum</ulink> or if you think it is a bug via our <ulink url="http://www.copasi.org/tracker/">issue tracking system</ulink>.
</para>
</chapter>