Free energy of a system of hard spherocylinders serving as a simple model for liquid crystals