Exemplo n.º 1
0
    def test_load_co_modes_from_qchem_log(self):
        """
        Uses a QChem log file for CO to test that its
        molecular degrees of freedom can be properly read.
        """
        log = QChemLog(
            os.path.join(os.path.dirname(__file__), 'data', 'co.out'))
        conformer, unscaled_frequencies = log.load_conformer()
        E0 = log.load_energy()

        self.assertTrue(
            len([
                mode for mode in conformer.modes
                if isinstance(mode, IdealGasTranslation)
            ]) == 1)
        self.assertTrue(
            len([
                mode for mode in conformer.modes
                if isinstance(mode, LinearRotor)
            ]) == 1)
        self.assertTrue(
            len([
                mode for mode in conformer.modes
                if isinstance(mode, NonlinearRotor)
            ]) == 0)
        self.assertTrue(
            len([
                mode for mode in conformer.modes
                if isinstance(mode, HarmonicOscillator)
            ]) == 1)
        self.assertTrue(
            len([
                mode for mode in conformer.modes
                if isinstance(mode, HinderedRotor)
            ]) == 0)
Exemplo n.º 2
0
    def testLoadNpropylModesFromQChemLog(self):
        """
        Uses a QChem log file for npropyl to test that its
        molecular modes can be properly read.
        """
        log = QChemLog(
            os.path.join(os.path.dirname(__file__), 'data', 'npropyl.out'))
        conformer, unscaled_frequencies = log.loadConformer()

        self.assertTrue(
            len([
                mode for mode in conformer.modes
                if isinstance(mode, IdealGasTranslation)
            ]) == 1)
        self.assertTrue(
            len([
                mode for mode in conformer.modes
                if isinstance(mode, NonlinearRotor)
            ]) == 1)
        self.assertTrue(
            len([
                mode for mode in conformer.modes
                if isinstance(mode, HarmonicOscillator)
            ]) == 1)
        self.assertTrue(
            len([
                mode for mode in conformer.modes
                if isinstance(mode, HinderedRotor)
            ]) == 0)
 def testNumberOfAtomsFromQChemLog(self):
     """
     Uses a QChem log files to test that
     number of atoms can be properly read.
     """
     log = QChemLog(os.path.join(os.path.dirname(__file__),'data','npropyl.out'))
     self.assertEqual(log.getNumberOfAtoms(), 10)
     log = QChemLog(os.path.join(os.path.dirname(__file__),'data','co.out'))
     self.assertEqual(log.getNumberOfAtoms(), 2) 
 def testSpinMultiplicityFromQChemLog(self):
     """
     Uses a QChem log file for npropyl to test that its
     molecular degrees of freedom can be properly read.
     """
     log = QChemLog(os.path.join(os.path.dirname(__file__),'data','npropyl.out'))
     conformer, unscaled_frequencies = log.loadConformer()
     self.assertEqual(conformer.spinMultiplicity, 2)
     log = QChemLog(os.path.join(os.path.dirname(__file__),'data','co.out'))
     conformer, unscaled_frequencies = log.loadConformer()
     self.assertEqual(conformer.spinMultiplicity, 1)
    def testLoadNpropylModesFromQChemLog(self):
        """
        Uses a QChem log file for npropyl to test that its
        molecular modes can be properly read.
        """
        log = QChemLog(os.path.join(os.path.dirname(__file__),'data','npropyl.out'))
        conformer, unscaled_frequencies = log.loadConformer()

        self.assertTrue(len([mode for mode in conformer.modes if isinstance(mode,IdealGasTranslation)]) == 1)
        self.assertTrue(len([mode for mode in conformer.modes if isinstance(mode,NonlinearRotor)]) == 1)
        self.assertTrue(len([mode for mode in conformer.modes if isinstance(mode,HarmonicOscillator)]) == 1)
        self.assertTrue(len([mode for mode in conformer.modes if isinstance(mode,HinderedRotor)]) == 0)
 def testLoadVibrationsFromQChemLog(self):
     """
     Uses a QChem log files to test that
     molecular energies can be properly read.
     """
     log = QChemLog(os.path.join(os.path.dirname(__file__),'data','npropyl.out'))
     conformer, unscaled_frequencies = log.loadConformer()
     self.assertEqual(len(conformer.modes[2]._frequencies.getValue()), 24)    
     self.assertEqual(conformer.modes[2]._frequencies.getValue()[5], 881.79)       
     log = QChemLog(os.path.join(os.path.dirname(__file__),'data','co.out'))
     conformer, unscaled_frequencies = log.loadConformer()
     self.assertEqual(len(conformer.modes[2]._frequencies.getValue()), 1)         
     self.assertEqual(conformer.modes[2]._frequencies.getValue(), 2253.16)    
Exemplo n.º 7
0
 def test_energy_from_qchem_log(self):
     """
     Uses a QChem log files to test that
     molecular energies can be properly read.
     """
     log = QChemLog(os.path.join(os.path.dirname(__file__), 'data', 'npropyl.out'))
     self.assertAlmostEqual(log.load_energy(), -310896203.5432524, delta=1e-5)
     log = QChemLog(os.path.join(os.path.dirname(__file__), 'data', 'co.out'))
     self.assertAlmostEqual(log.load_energy(), -297402545.0217114, delta=1e-5)
     log = QChemLog(os.path.join(os.path.dirname(__file__), 'data', 'CH4_sp_qchem.out'))
     self.assertAlmostEqual(log.load_energy(), -106356735.53661588, delta=1e-5)
Exemplo n.º 8
0
def determine_qm_software(fullpath):
    """
    Given a path to the log file of a QM software, determine whether it is Gaussian, Molpro, or QChem
    """
    with open(fullpath, 'r') as f:
        line = f.readline()
        software_log = None
        while line != '':
            if 'gaussian' in line.lower():
                f.close()
                software_log = GaussianLog(fullpath)
                break
            elif 'qchem' in line.lower():
                f.close()
                software_log = QChemLog(fullpath)
                break
            elif 'molpro' in line.lower():
                f.close()
                software_log = MolproLog(fullpath)
                break
            line = f.readline()
        else:
            raise InputError(
                'File at {0} could not be identified as a Gaussian, '
                'QChem or Molpro log file.'.format(fullpath))
    return software_log
Exemplo n.º 9
0
 def test_number_of_atoms_from_qchem_log(self):
     """
     Uses a QChem log files to test that
     number of atoms can be properly read.
     """
     log = QChemLog(os.path.join(os.path.dirname(__file__), 'data', 'npropyl.out'))
     self.assertEqual(log.get_number_of_atoms(), 10)
     log = QChemLog(os.path.join(os.path.dirname(__file__), 'data', 'co.out'))
     self.assertEqual(log.get_number_of_atoms(), 2)
Exemplo n.º 10
0
 def testEnergyFromQChemLog(self):
     """
     Uses a QChem log files to test that
     molecular energies can be properly read.
     """        
     log = QChemLog(os.path.join(os.path.dirname(__file__),'data','npropyl.out'))
     self.assertAlmostEqual(log.loadEnergy(), -310896203.5432524, 1e-5)
     log = QChemLog(os.path.join(os.path.dirname(__file__),'data','co.out'))
     self.assertAlmostEqual(log.loadEnergy(), -297402545.0217114, 1e-5)   
Exemplo n.º 11
0
 def testEnergyFromQChemLog(self):
     """
     Uses a QChem log files to test that
     molecular energies can be properly read.
     """        
     log = QChemLog(os.path.join(os.path.dirname(__file__),'data','npropyl.out'))
     self.assertAlmostEqual(log.loadEnergy(), -310896203.5432524, delta=1e-5)
     log = QChemLog(os.path.join(os.path.dirname(__file__),'data','co.out'))
     self.assertAlmostEqual(log.loadEnergy(), -297402545.0217114, delta=1e-5)
     log = QChemLog(os.path.join(os.path.dirname(__file__),'data','CH4_sp_qchem.out'))
     self.assertAlmostEqual(log.loadEnergy(), -106356735.53661588, delta=1e-5)
Exemplo n.º 12
0
 def test_spin_multiplicity_from_qchem_log(self):
     """
     Uses a QChem log file for npropyl to test that its
     molecular degrees of freedom can be properly read.
     """
     log = QChemLog(os.path.join(os.path.dirname(__file__), 'data', 'npropyl.out'))
     conformer, unscaled_frequencies = log.load_conformer()
     self.assertEqual(conformer.spin_multiplicity, 2)
     log = QChemLog(os.path.join(os.path.dirname(__file__), 'data', 'co.out'))
     conformer, unscaled_frequencies = log.load_conformer()
     self.assertEqual(conformer.spin_multiplicity, 1)
Exemplo n.º 13
0
 def test_load_vibrations_from_qchem_log(self):
     """
     Uses a QChem log files to test that
     molecular energies can be properly read.
     """
     log = QChemLog(os.path.join(os.path.dirname(__file__), 'data', 'npropyl.out'))
     conformer, unscaled_frequencies = log.load_conformer()
     self.assertEqual(len(conformer.modes[2]._frequencies.value), 24)
     self.assertEqual(conformer.modes[2]._frequencies.value[5], 881.79)
     log = QChemLog(os.path.join(os.path.dirname(__file__), 'data', 'co.out'))
     conformer, unscaled_frequencies = log.load_conformer()
     self.assertEqual(len(conformer.modes[2]._frequencies.value), 1)
     self.assertEqual(conformer.modes[2]._frequencies.value, 2253.16)
Exemplo n.º 14
0
 def testLoadVibrationsFromQChemLog(self):
     """
     Uses a QChem log files to test that
     molecular energies can be properly read.
     """
     log = QChemLog(os.path.join(os.path.dirname(__file__),'data','npropyl.out'))
     conformer, unscaled_frequencies = log.loadConformer(symfromlog=True)
     self.assertEqual(len(conformer.modes[2]._frequencies.getValue()), 24)    
     self.assertEqual(conformer.modes[2]._frequencies.getValue()[5], 881.79)       
     log = QChemLog(os.path.join(os.path.dirname(__file__),'data','co.out'))
     conformer, unscaled_frequencies = log.loadConformer(symfromlog=True)
     self.assertEqual(len(conformer.modes[2]._frequencies.getValue()), 1)         
     self.assertEqual(conformer.modes[2]._frequencies.getValue(), 2253.16)    
Exemplo n.º 15
0
 def test_rotor_symmetry_determination(self):
     """
     Test that the correct symmetry number is determined for rotor potential scans.
     """
     path1 = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data', 'NCC_NRotor.out')
     path2 = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data', 'NCC_CRotor.out')
     scan_log1 = QChemLog(path1)
     scan_log2 = QChemLog(path2)
     v_list1, angle = scan_log1.load_scan_energies()
     v_list2, angle = scan_log2.load_scan_energies()
     symmetry1 = determine_rotor_symmetry(energies=v_list1, label='NCC', pivots=[])
     symmetry2 = determine_rotor_symmetry(energies=v_list2, label='NCC', pivots=[])
     self.assertEqual(symmetry1, 1)
     self.assertEqual(symmetry2, 3)