# Read the last configuration in the output file configuration = nlread('armchair.nc', BulkConfiguration)[-1] # Read the last phonon DOS in the output file phonon_dos = nlread('armchair.nc', PhononDensityOfStates)[-1] # Calculate the total energy total_energy = TotalEnergy(configuration) e = total_energy.evaluate() # Define the temperature t = 300*Kelvin # Calculate the entropy s = phonon_dos.entropy(t) # Print results print 'Energy = ', e print 'Entropy = ', s print 'Free energy at 300K = ', e - t*s