#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jul 12 18:38:35 2022 https://janaf.nist.gov/tables/H-083.html #Database Symmetry Number: Table 10.1 and Appendix B of C. Cramer “Essentials of Computational Chemistry”, 2nd Ed. spin: 0 for molecules in which all electrons are paired, 0.5 for a free radical with a single unpaired electron, 1.0 for a triplet with two unpaired electrons, such as O_2. @author: qli """ import numpy as np from ase.io import read, write from ase.thermochemistry import IdealGasThermo from scipy import constants as con
atoms = read('./freq/POSCAR') sym = 3# symmetry number of NH3 spin = 0# spin of NH3. tem = 298.15# Temperature out = read('./OUTCAR', format='vasp-out') potentialenergy = out.get_potential_energy()
model = read('./freq/POSCAR') # model_positions = model.get_positions()
vib_energies = [] withopen('./freq/OUTCAR') as f_in: lines = f_in.readlines() for num, line inenumerate(lines): if'cm-1'in line: vib_e = float(line.rstrip().split()[-2]) vib_energies.append(vib_e)
vib_energies = np.array(vib_energies[:-6])/1000# For Gas, the last six are translation and rotation # zpe = sum(vib_energies)/2
qli@bigbro test_nh3 % ls CONTCAR INCAR OUTCAR freq/ H-083.txt KPOINTS POSCAR get_gas_entropy.py* qli@bigbro test_nh3 % python3 get_gas_entropy.py Entropy components at T = 298.15 K and P = 101325.0 Pa: ================================================= S T*S S_trans (1 bar) 0.0014947 eV/K 0.446 eV S_rot 0.0004981 eV/K 0.149 eV S_elec 0.0000000 eV/K 0.000 eV S_vib 0.0000047 eV/K 0.001 eV S (1 bar -> P) -0.0000011 eV/K -0.000 eV ------------------------------------------------- S 0.0019964 eV/K 0.595 eV ================================================= G -19.220631915628093 S 192.6230402411749 J/K/mol