# IODATA is an input and output module for quantum chemistry.# Copyright (C) 2011-2019 The IODATA Development Team## This file is part of IODATA.## IODATA is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License# as published by the Free Software Foundation; either version 3# of the License, or (at your option) any later version.## IODATA is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, see <http://www.gnu.org/licenses/># --"""Test iodata.formats.orcalog module."""fromimportlib.resourcesimportas_file,filesimportnumpyasnpfromnumpy.testingimportassert_allclose,assert_equalfrom..apiimportload_onefrom..utilsimportangstrom
[docs]deftest_load_water_number():withas_file(files("iodata.test.data").joinpath("water_orca.out"))asfn:mol=load_one(fn)# Test atomic numbers and number of atomsassertmol.natom==3assert_equal(mol.atnums,[8,1,1])# check bond lengthassert_allclose(np.linalg.norm(mol.atcoords[0]-mol.atcoords[1])/angstrom,0.9500,atol=1.0e-5)assert_allclose(np.linalg.norm(mol.atcoords[0]-mol.atcoords[2])/angstrom,0.9500,atol=1.0e-5)assert_allclose(np.linalg.norm(mol.atcoords[1]-mol.atcoords[2])/angstrom,1.5513,atol=1.0e-4)# check energies of scf cyclesenergies=np.array([-76.34739931,-76.34740001,-76.34740005,-76.34740029])assert_allclose(mol.extra["scf_energies"],energies)# check scf energyassert_allclose(mol.energy,-76.347791524303,atol=1e-8)# check dipole momentassert_allclose(mol.moments[(1,"c")],[0.76499,0.00000,0.54230])