• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

materialsproject / pymatgen / 4075885785

pending completion
4075885785

push

github

Shyue Ping Ong
Merge branch 'master' of github.com:materialsproject/pymatgen

96 of 96 new or added lines in 27 files covered. (100.0%)

81013 of 102710 relevant lines covered (78.88%)

0.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.82
/pymatgen/io/qchem/tests/test_outputs.py
1
# Copyright (c) Pymatgen Development Team.
2
# Distributed under the terms of the MIT License.
3

4

5
from __future__ import annotations
1✔
6

7
import os
1✔
8
import unittest
1✔
9

10
from monty.serialization import dumpfn, loadfn
1✔
11

12
from pymatgen.core.structure import Molecule
1✔
13
from pymatgen.io.qchem.outputs import QCOutput, check_for_structure_changes
1✔
14
from pymatgen.util.testing import PymatgenTest
1✔
15

16
try:
1✔
17
    from openbabel import openbabel
1✔
18
except ImportError:
1✔
19
    openbabel = None
1✔
20

21
__author__ = "Samuel Blau, Brandon Wood, Shyam Dwaraknath, Evan Spotte-Smith, Ryan Kingsbury"
1✔
22
__copyright__ = "Copyright 2018-2022, The Materials Project"
1✔
23
__version__ = "0.1"
1✔
24
__maintainer__ = "Samuel Blau"
1✔
25
__email__ = "samblau1@gmail.com"
1✔
26

27
single_job_dict = loadfn(os.path.join(os.path.dirname(__file__), "single_job.json"))
1✔
28
multi_job_dict = loadfn(os.path.join(os.path.dirname(__file__), "multi_job.json"))
1✔
29

30
property_list = {
1✔
31
    "errors",
32
    "multiple_outputs",
33
    "completion",
34
    "unrestricted",
35
    "using_GEN_SCFMAN",
36
    "final_energy",
37
    "S2",
38
    "optimization",
39
    "energy_trajectory",
40
    "opt_constraint",
41
    "frequency_job",
42
    "charge",
43
    "multiplicity",
44
    "species",
45
    "initial_geometry",
46
    "initial_molecule",
47
    "SCF",
48
    "Mulliken",
49
    "optimized_geometry",
50
    "optimized_zmat",
51
    "molecule_from_optimized_geometry",
52
    "last_geometry",
53
    "molecule_from_last_geometry",
54
    "geometries",
55
    "gradients",
56
    "frequency_mode_vectors",
57
    "walltime",
58
    "cputime",
59
    "point_group",
60
    "frequencies",
61
    "IR_intens",
62
    "IR_active",
63
    "g_electrostatic",
64
    "g_cavitation",
65
    "g_dispersion",
66
    "g_repulsion",
67
    "total_contribution_pcm",
68
    "ZPE",
69
    "trans_enthalpy",
70
    "vib_enthalpy",
71
    "rot_enthalpy",
72
    "gas_constant",
73
    "trans_entropy",
74
    "vib_entropy",
75
    "rot_entropy",
76
    "total_entropy",
77
    "total_enthalpy",
78
    "warnings",
79
    "SCF_energy_in_the_final_basis_set",
80
    "Total_energy_in_the_final_basis_set",
81
    "solvent_method",
82
    "solvent_data",
83
    "using_dft_d3",
84
    "single_point_job",
85
    "force_job",
86
    "pcm_gradients",
87
    "CDS_gradients",
88
    "RESP",
89
    "trans_dip",
90
    "transition_state",
91
    "scan_job",
92
    "optimized_geometries",
93
    "molecules_from_optimized_geometries",
94
    "scan_energies",
95
    "scan_constraint_sets",
96
    "hf_scf_energy",
97
    "mp2_energy",
98
    "ccsd_correlation_energy",
99
    "ccsd_total_energy",
100
    "ccsd(t)_correlation_energy",
101
    "ccsd(t)_total_energy",
102
    "alpha_fock_matrix",
103
    "beta_fock_matrix",
104
    "alpha_eigenvalues",
105
    "beta_eigenvalues",
106
    "alpha_coeff_matrix",
107
    "beta_coeff_matrix",
108
    "final_soln_phase_e",
109
    "solute_internal_e",
110
    "total_solvation_free_e",
111
    "change_solute_internal_e",
112
    "reaction_field_free_e",
113
    "isosvp_dielectric",
114
    "dispersion_e",
115
    "exchange_e",
116
    "min_neg_field_e",
117
    "max_pos_field_e",
118
    "norm_of_stepsize",
119
    "version",
120
    "dipoles",
121
    "gap_info",
122
}
123

124
if openbabel is not None:
1✔
125
    property_list.add("structure_change")
×
126

127
single_job_out_names = {
1✔
128
    "unable_to_determine_lambda_in_geom_opt.qcout",
129
    "thiophene_wfs_5_carboxyl.qcout",
130
    "hf.qcout",
131
    "hf_opt_failed.qcout",
132
    "no_reading.qcout",
133
    "exit_code_134.qcout",
134
    "negative_eigen.qcout",
135
    "insufficient_memory.qcout",
136
    "freq_seg_too_small.qcout",
137
    "crowd_gradient_number.qcout",
138
    "quinoxaline_anion.qcout",
139
    "tfsi_nbo.qcout",
140
    "crowd_nbo_charges.qcout",
141
    "h2o_aimd.qcout",
142
    "quinoxaline_anion.qcout",
143
    "crowd_gradient_number.qcout",
144
    "bsse.qcout",
145
    "thiophene_wfs_5_carboxyl.qcout",
146
    "time_nan_values.qcout",
147
    "pt_dft_180.0.qcout",
148
    "qchem_energies/hf-rimp2.qcout",
149
    "qchem_energies/hf_b3lyp.qcout",
150
    "qchem_energies/hf_ccsd(t).qcout",
151
    "qchem_energies/hf_cosmo.qcout",
152
    "qchem_energies/hf_hf.qcout",
153
    "qchem_energies/hf_lxygjos.qcout",
154
    "qchem_energies/hf_mosmp2.qcout",
155
    "qchem_energies/hf_mp2.qcout",
156
    "qchem_energies/hf_qcisd(t).qcout",
157
    "qchem_energies/hf_riccsd(t).qcout",
158
    "qchem_energies/hf_tpssh.qcout",
159
    "qchem_energies/hf_xyg3.qcout",
160
    "qchem_energies/hf_xygjos.qcout",
161
    "qchem_energies/hf_wb97xd_gen_scfman.qcout",
162
    "new_qchem_files/pt_n2_n_wb_180.0.qcout",
163
    "new_qchem_files/pt_n2_trip_wb_90.0.qcout",
164
    "new_qchem_files/pt_n2_gs_rimp2_pvqz_90.0.qcout",
165
    "new_qchem_files/VC_solv_eps10.2.qcout",
166
    "crazy_scf_values.qcout",
167
    "new_qchem_files/N2.qcout",
168
    "new_qchem_files/julian.qcout.gz",
169
    "new_qchem_files/Frequency_no_equal.qout",
170
    "new_qchem_files/gdm.qout",
171
    "new_qchem_files/DinfH.qout",
172
    "new_qchem_files/mpi_error.qout",
173
    "new_qchem_files/molecule_read_error.qout",
174
    "new_qchem_files/basis_not_supported.qout",
175
    "new_qchem_files/lebdevpts.qout",
176
    "new_qchem_files/Optimization_no_equal.qout",
177
    "new_qchem_files/2068.qout",
178
    "new_qchem_files/2620.qout",
179
    "new_qchem_files/1746.qout",
180
    "new_qchem_files/1570.qout",
181
    "new_qchem_files/1570_2.qout",
182
    "new_qchem_files/single_point.qout",
183
    "new_qchem_files/roothaan_diis_gdm.qout",
184
    "new_qchem_files/pes_scan_single_variable.qout",
185
    "new_qchem_files/pes_scan_double_variable.qout",
186
    "new_qchem_files/ts.out",
187
    "new_qchem_files/ccsd.qout",
188
    "new_qchem_files/ccsdt.qout",
189
    "extra_scf_print.qcout",
190
    "new_qchem_files/cmirs_benzene_single.qcout",
191
    "new_qchem_files/cmirs_dielst10_single.qcout",
192
    "new_qchem_files/cmirs_water_single.qcout",
193
    "new_qchem_files/isosvp_water_single.qcout",
194
    "new_qchem_files/isosvp_dielst10_single.qcout",
195
    "new_qchem_files/custom_gdm_gdmqls_opt.qout",
196
    "new_qchem_files/unable.qout",
197
    "new_qchem_files/unexpected_ts.out",
198
    "new_qchem_files/svd_failed.qout",
199
    "new_qchem_files/v6_old_driver.out",
200
    "new_qchem_files/gap.qout",
201
    "new_qchem_files/3C.qout",
202
    "new_qchem_files/hyper.qout",
203
    "new_qchem_files/os_gap.qout",
204
}
205

206
multi_job_out_names = {
1✔
207
    "not_enough_total_memory.qcout",
208
    "new_qchem_files/VC_solv_eps10.qcout",
209
    "new_qchem_files/MECLi_solv_eps10.qcout",
210
    "pcm_solvent_deprecated.qcout",
211
    "qchem43_batch_job.qcout",
212
    "ferrocenium_1pos.qcout",
213
    "CdBr2.qcout",
214
    "killed.qcout",
215
    "aux_mpi_time_mol.qcout",
216
    "new_qchem_files/VCLi_solv_eps10.qcout",
217
    "new_qchem_files/cmirs_benzene.qcout",
218
    "new_qchem_files/cmirs_dielst10.qcout",
219
    "new_qchem_files/isosvp_water.qcout",
220
    "new_qchem_files/isosvp_dielst10.qcout",
221
}
222

223

224
class TestQCOutput(PymatgenTest):
1✔
225
    @staticmethod
1✔
226
    def generate_single_job_dict():
1✔
227
        """
228
        Used to generate test dictionary for single jobs.
229
        """
230
        single_job_dict = {}
×
231
        for file in single_job_out_names:
×
232
            single_job_dict[file] = QCOutput(os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", file)).data
×
233
        dumpfn(single_job_dict, "single_job.json")
×
234

235
    @staticmethod
1✔
236
    def generate_multi_job_dict():
1✔
237
        """
238
        Used to generate test dictionary for multiple jobs.
239
        """
240
        multi_job_dict = {}
×
241
        for file in multi_job_out_names:
×
242
            outputs = QCOutput.multiple_outputs_from_file(
×
243
                QCOutput, os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", file), keep_sub_files=False
244
            )
245
            data = []
×
246
            for sub_output in outputs:
×
247
                data.append(sub_output.data)
×
248
            multi_job_dict[file] = data
×
249
        dumpfn(multi_job_dict, "multi_job.json")
×
250

251
    def _test_property(self, key, single_outs, multi_outs):
1✔
252
        for name, outdata in single_outs.items():
×
253
            try:
×
254
                assert outdata.get(key) == single_job_dict[name].get(key)
×
255
            except ValueError:
×
256
                try:
×
257
                    self.assertArrayEqual(outdata.get(key), single_job_dict[name].get(key))
×
258
                except AssertionError:
×
259
                    raise RuntimeError("Issue with file: " + name + " Exiting...")
×
260
            except AssertionError:
×
261
                raise RuntimeError("Issue with file: " + name + " Exiting...")
×
262
        for name, outputs in multi_outs.items():
×
263
            for ii, sub_output in enumerate(outputs):
×
264
                try:
×
265
                    assert sub_output.data.get(key) == multi_job_dict[name][ii].get(key)
×
266
                except ValueError:
×
267
                    self.assertArrayEqual(sub_output.data.get(key), multi_job_dict[name][ii].get(key))
×
268

269
    @unittest.skipIf(openbabel is None, "OpenBabel not installed.")
1✔
270
    def test_all(self):
1✔
271
        self.maxDiff = None
×
272
        single_outs = {}
×
273
        for file in single_job_out_names:
×
274
            single_outs[file] = QCOutput(os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", file)).data
×
275

276
        multi_outs = {}
×
277
        for file in multi_job_out_names:
×
278
            multi_outs[file] = QCOutput.multiple_outputs_from_file(
×
279
                QCOutput, os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", file), keep_sub_files=False
280
            )
281

282
        for key in property_list:
×
283
            print("Testing ", key)
×
284
            self._test_property(key, single_outs, multi_outs)
×
285

286
    @unittest.skipIf((openbabel is None), "OpenBabel not installed.")
1✔
287
    def test_structural_change(self):
1✔
288
        t1 = Molecule.from_file(os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "structural_change", "t1.xyz"))
×
289
        t2 = Molecule.from_file(os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "structural_change", "t2.xyz"))
×
290
        t3 = Molecule.from_file(os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "structural_change", "t3.xyz"))
×
291

292
        thio_1 = Molecule.from_file(
×
293
            os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "structural_change", "thiophene1.xyz")
294
        )
295
        thio_2 = Molecule.from_file(
×
296
            os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "structural_change", "thiophene2.xyz")
297
        )
298

299
        frag_1 = Molecule.from_file(
×
300
            os.path.join(
301
                PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "test_structure_change", "frag_1.xyz"
302
            )
303
        )
304
        frag_2 = Molecule.from_file(
×
305
            os.path.join(
306
                PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "test_structure_change", "frag_2.xyz"
307
            )
308
        )
309

310
        assert check_for_structure_changes(t1, t1) == "no_change"
×
311
        assert check_for_structure_changes(t2, t3) == "no_change"
×
312
        assert check_for_structure_changes(t1, t2) == "fewer_bonds"
×
313
        assert check_for_structure_changes(t2, t1) == "more_bonds"
×
314

315
        assert check_for_structure_changes(thio_1, thio_2) == "unconnected_fragments"
×
316

317
        assert check_for_structure_changes(frag_1, frag_2) == "bond_change"
×
318

319
    def test_NBO_parsing(self):
1✔
320
        data = QCOutput(os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "nbo.qout")).data
1✔
321
        assert len(data["nbo_data"]["natural_populations"]) == 3
1✔
322
        assert len(data["nbo_data"]["hybridization_character"]) == 6
1✔
323
        assert len(data["nbo_data"]["perturbation_energy"]) == 2
1✔
324
        assert data["nbo_data"]["natural_populations"][0]["Density"][5] == -0.08624
1✔
325
        assert data["nbo_data"]["hybridization_character"][4]["atom 2 pol coeff"][35] == "-0.7059"
1✔
326
        next_to_last = list(data["nbo_data"]["perturbation_energy"][-1]["fock matrix element"])[-2]
1✔
327
        assert data["nbo_data"]["perturbation_energy"][-1]["fock matrix element"][next_to_last] == 0.071
1✔
328
        assert data["nbo_data"]["perturbation_energy"][0]["acceptor type"][0] == "RY*"
1✔
329

330
    def test_NBO7_parsing(self):
1✔
331
        data = QCOutput(os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "nbo7_1.qout")).data
1✔
332
        assert data["nbo_data"]["perturbation_energy"][0]["perturbation energy"][9] == 15.73
1✔
333
        assert len(data["nbo_data"]["perturbation_energy"][0]["donor bond index"]) == 84
1✔
334
        assert len(data["nbo_data"]["perturbation_energy"][1]["donor bond index"]) == 29
1✔
335

336
        data = QCOutput(os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "nbo7_2.qout")).data
1✔
337
        assert data["nbo_data"]["perturbation_energy"][0]["perturbation energy"][13] == 32.93
1✔
338
        assert data["nbo_data"]["perturbation_energy"][0]["acceptor type"][13] == "LV"
1✔
339
        assert data["nbo_data"]["perturbation_energy"][0]["acceptor type"][12] == "RY"
1✔
340
        assert data["nbo_data"]["perturbation_energy"][0]["acceptor atom 1 symbol"][12] == "Mg"
1✔
341

342
        data = QCOutput(os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "nbo7_3.qout")).data
1✔
343
        assert data["nbo_data"]["perturbation_energy"][0]["perturbation energy"][13] == 34.54
1✔
344
        assert data["nbo_data"]["perturbation_energy"][0]["acceptor type"][13] == "BD*"
1✔
345
        assert data["nbo_data"]["perturbation_energy"][0]["acceptor atom 1 symbol"][13] == "B"
1✔
346
        assert data["nbo_data"]["perturbation_energy"][0]["acceptor atom 2 symbol"][13] == "Mg"
1✔
347
        assert data["nbo_data"]["perturbation_energy"][0]["acceptor atom 2 number"][13] == 3
1✔
348

349
    def test_NBO5_vs_NBO7_hybridization_character(self):
1✔
350
        data5 = QCOutput(os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "nbo5_1.qout")).data
1✔
351
        data7 = QCOutput(os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "nbo7_1.qout")).data
1✔
352
        assert len(data5["nbo_data"]["hybridization_character"]) == len(data7["nbo_data"]["hybridization_character"])
1✔
353
        assert (
1✔
354
            data5["nbo_data"]["hybridization_character"][4]["atom 2 pol coeff"][9]
355
            == data7["nbo_data"]["hybridization_character"][4]["atom 2 pol coeff"][9]
356
        )
357
        assert (
1✔
358
            data5["nbo_data"]["hybridization_character"][0]["s"][0]
359
            == data7["nbo_data"]["hybridization_character"][0]["s"][0]
360
        )
361
        assert data5["nbo_data"]["hybridization_character"][1]["bond index"][7] == "149"
1✔
362
        assert data7["nbo_data"]["hybridization_character"][1]["bond index"][7] == "21"
1✔
363

364
    def test_NBO7_infinite_e2pert(self):
1✔
365
        data = QCOutput(os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "nbo7_inf.qout")).data
1✔
366
        assert data["nbo_data"]["perturbation_energy"][0]["perturbation energy"][0] == float("inf")
1✔
367

368
    def test_isosvp_water(self):
1✔
369
        data = QCOutput(
1✔
370
            os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "isosvp_water_single.qcout")
371
        ).data
372
        assert data["solvent_method"] == "ISOSVP"
1✔
373

374
        # ISOSVP parameters
375
        assert data["solvent_data"]["isosvp"]["isosvp_dielectric"] == 78.39
1✔
376
        assert data["solvent_data"]["isosvp"]["final_soln_phase_e"] == -40.4850599393
1✔
377
        assert data["solvent_data"]["isosvp"]["solute_internal_e"] == -40.4846329762
1✔
378
        assert data["solvent_data"]["isosvp"]["change_solute_internal_e"] == 0.0000121967
1✔
379
        assert data["solvent_data"]["isosvp"]["reaction_field_free_e"] == -0.0004269631
1✔
380
        assert data["solvent_data"]["isosvp"]["total_solvation_free_e"] == -0.0004147664
1✔
381

382
        # CMIRS parameters
383
        assert data["solvent_data"]["cmirs"]["CMIRS_enabled"] is False
1✔
384

385
    def test_isosvp_dielst10(self):
1✔
386
        data = QCOutput(
1✔
387
            os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "isosvp_dielst10_single.qcout")
388
        ).data
389
        assert data["solvent_method"] == "ISOSVP"
1✔
390

391
        # ISOSVP parameters
392
        assert data["solvent_data"]["isosvp"]["isosvp_dielectric"] == 10
1✔
393
        assert data["solvent_data"]["isosvp"]["final_soln_phase_e"] == -40.4850012952
1✔
394
        assert data["solvent_data"]["isosvp"]["solute_internal_e"] == -40.4846362547
1✔
395
        assert data["solvent_data"]["isosvp"]["change_solute_internal_e"] == 0.0000089182
1✔
396
        assert data["solvent_data"]["isosvp"]["reaction_field_free_e"] == -0.0003650405
1✔
397
        assert data["solvent_data"]["isosvp"]["total_solvation_free_e"] == -0.0003561223
1✔
398

399
        # CMIRS parameters
400
        assert data["solvent_data"]["cmirs"]["CMIRS_enabled"] is False
1✔
401

402
    def test_cmirs_benzene(self):
1✔
403
        data = QCOutput(
1✔
404
            os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "cmirs_benzene_single.qcout")
405
        ).data
406
        assert data["solvent_method"] == "ISOSVP"
1✔
407
        assert data["solvent_data"]["isosvp"]["isosvp_dielectric"] == 2.28
1✔
408
        assert data["solvent_data"]["cmirs"]["CMIRS_enabled"] is True
1✔
409
        assert data["solvent_data"]["cmirs"]["dispersion_e"] == 0.6955542829
1✔
410
        assert data["solvent_data"]["cmirs"]["exchange_e"] == 0.2654553686
1✔
411
        assert data["solvent_data"]["cmirs"]["min_neg_field_e"] == 0.0006019665
1✔
412
        assert data["solvent_data"]["cmirs"]["max_pos_field_e"] == 0.0178177740
1✔
413

414
    def test_cmirs_dielst10(self):
1✔
415
        data = QCOutput(
1✔
416
            os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "cmirs_dielst10_single.qcout")
417
        ).data
418
        assert data["solvent_method"] == "ISOSVP"
1✔
419
        assert data["solvent_data"]["isosvp"]["isosvp_dielectric"] == 10
1✔
420
        assert data["solvent_data"]["cmirs"]["CMIRS_enabled"] is True
1✔
421
        assert data["solvent_data"]["cmirs"]["dispersion_e"] == 0.6955550107
1✔
422
        assert data["solvent_data"]["cmirs"]["exchange_e"] == 0.2652679507
1✔
423
        assert data["solvent_data"]["cmirs"]["min_neg_field_e"] == 0.0005235850
1✔
424
        assert data["solvent_data"]["cmirs"]["max_pos_field_e"] == 0.0179866718
1✔
425

426
    def test_cmirs_water(self):
1✔
427
        data = QCOutput(
1✔
428
            os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "cmirs_water_single.qcout")
429
        ).data
430
        assert data["solvent_method"] == "ISOSVP"
1✔
431

432
        # ISOSVP parameters
433
        assert data["solvent_data"]["isosvp"]["isosvp_dielectric"] == 78.39
1✔
434
        assert data["solvent_data"]["isosvp"]["final_soln_phase_e"] == -40.4752415075
1✔
435
        assert data["solvent_data"]["isosvp"]["solute_internal_e"] == -40.4748535587
1✔
436
        assert data["solvent_data"]["isosvp"]["change_solute_internal_e"] == 0.0000122982
1✔
437
        assert data["solvent_data"]["isosvp"]["reaction_field_free_e"] == -0.0003879488
1✔
438
        assert data["solvent_data"]["isosvp"]["total_solvation_free_e"] == 0.0037602703
1✔
439

440
        # CMIRS parameters
441
        assert data["solvent_data"]["cmirs"]["CMIRS_enabled"] is True
1✔
442
        assert data["solvent_data"]["cmirs"]["dispersion_e"] == 0.6722278965
1✔
443
        assert data["solvent_data"]["cmirs"]["exchange_e"] == 0.2652032616
1✔
444
        assert data["solvent_data"]["cmirs"]["min_neg_field_e"] == 0.0004967767
1✔
445
        assert data["solvent_data"]["cmirs"]["max_pos_field_e"] == 0.0180445935
1✔
446

447
    def test_NBO_hyperbonds(self):
1✔
448
        data = QCOutput(os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "hyper.qout")).data
1✔
449
        assert len(data["nbo_data"]["hyperbonds"][0]["hyperbond index"].keys()) == 2
1✔
450
        assert data["nbo_data"]["hyperbonds"][0]["BD(A-B)"][1] == 106
1✔
451
        assert data["nbo_data"]["hyperbonds"][0]["bond atom 2 symbol"][0] == "C"
1✔
452
        assert data["nbo_data"]["hyperbonds"][0]["occ"][1] == 3.0802
1✔
453

454
    def test_NBO_3C(self):
1✔
455
        data = QCOutput(os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules", "new_qchem_files", "3C.qout")).data
1✔
456
        assert len(data["nbo_data"]["hybridization_character"]) == 3
1✔
457
        assert data["nbo_data"]["hybridization_character"][2]["type"][0] == "3C"
1✔
458
        assert data["nbo_data"]["hybridization_character"][2]["type"][10] == "3Cn"
1✔
459
        assert data["nbo_data"]["hybridization_character"][2]["type"][20] == "3C*"
1✔
460
        assert data["nbo_data"]["hybridization_character"][2]["atom 3 pol coeff"][15] == "0.3643"
1✔
461
        assert data["nbo_data"]["hybridization_character"][2]["atom 3 polarization"][8] == "56.72"
1✔
462
        assert data["nbo_data"]["hybridization_character"][2]["atom 3 symbol"][3] == "B"
1✔
463
        assert data["nbo_data"]["perturbation_energy"][0]["donor atom 2 number"][2592] == 36
1✔
464
        assert data["nbo_data"]["perturbation_energy"][0]["donor atom 2 symbol"][2125] == "B12"
1✔
465
        assert data["nbo_data"]["perturbation_energy"][0]["donor atom 2 number"][2593] == "info_is_from_3C"
1✔
466
        assert data["nbo_data"]["perturbation_energy"][0]["acceptor type"][723] == "3C*"
1✔
467
        assert data["nbo_data"]["perturbation_energy"][0]["perturbation energy"][3209] == 3.94
1✔
468

469

470
if __name__ == "__main__":
1✔
471
    unittest.main()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc