Molecular dynamics simulation of rigid molecules