tests package
Submodules
tests.conftest module
tests.test_GaussianGenECP module
- class tests.test_GaussianGenECP.TestGenECPReplacementInRoute[source]
Bases:
objectTest that gen/genecp replacement in route strings doesn’t affect other keywords.
- test_gen_replacement_does_not_affect_noeigentest()[source]
Test that ‘gen’ in ‘noeigentest’ is not replaced, and case mode behaves correctly.
- test_gen_to_genecp_replacement()[source]
Test replacing ‘gen’ with ‘genecp’ in route strings for both case modes.
- class tests.test_GaussianGenECP.TestGenGenECPBasisDetermination[source]
Bases:
objectTest automatic determination of gen vs genecp basis keywords based on elements present.
- test_determine_basis_keyword_mixed_elements()[source]
Test molecule with both gen and genecp elements uses genecp.
- test_determine_basis_keyword_no_heavy_elements()[source]
Test that molecules with no heavy elements use light elements basis.
- test_determine_basis_keyword_non_gen_basis()[source]
Test that non-gen/genecp basis keywords are returned unchanged.
tests.test_GaussianIO module
- class tests.test_GaussianIO.TestGaussian16Input[source]
Bases:
object- test_oniom_mm_parameters_empty_parts_and_groups()[source]
Cover empty groups/lines and non-float connectivity tokens.
- class tests.test_GaussianIO.TestGaussian16Output[source]
Bases:
object
- class tests.test_GaussianIO.TestGaussian16pKaOutput[source]
Bases:
objectTests for Gaussian16pKaOutput class for pKa thermochemistry calculations.
Reference values are from .dat files in tests/data/GaussianTests/outputs/ Generated at T=373.15K, c=1.0 mol/L, csg=100 cm^-1, ch=100 cm^-1
- 5PQ_Me_ts1_no_pd_opt.dat values (HA - protonated acid):
E = -345.741944 hartree ZPE = 0.133804 hartree H = -345.595097 hartree qh-H = -345.596472 hartree T.S = 0.053929 hartree T.qh-S = 0.052278 hartree G(T) = -345.649026 hartree qh-G(T) = -345.648751 hartree
- 5PQ_Me_ts1_b_no_pd_opt.dat values (A- - conjugate base):
E = -344.915399 hartree ZPE = 0.115987 hartree H = -344.786580 hartree qh-H = -344.787739 hartree T.S = 0.052926 hartree T.qh-S = 0.051766 hartree G(T) = -344.839506 hartree qh-G(T) = -344.839505 hartree
- A_E = -344.915399
- A_G = -344.839506
- A_H = -344.78658
- A_QH_G = -344.839505
- A_QH_H = -344.787739
- A_QH_TS = 0.051766
- A_TS = 0.052926
- A_ZPE = 0.115987
- HA_E = -345.741944
- HA_G = -345.649026
- HA_H = -345.595097
- HA_QH_G = -345.648751
- HA_QH_H = -345.596472
- HA_QH_TS = 0.052278
- HA_TS = 0.053929
- HA_ZPE = 0.133804
- PKA_COLLIDINE_REFERENCE = 6.75
- test_compute_pka(gaussian_pKa_HA_optimization_outputfile, gaussian_pKa_A_optimization_outputfile, gaussian_pKa_HB_optimization_outputfile, gaussian_pKa_B_optimization_outputfile, gaussian_pKa_HA_single_point_outputfile, gaussian_pKa_A_single_point_outputfile, gaussian_pKa_HB_single_point_outputfile, gaussian_pKa_B_single_point_outputfile)[source]
Test pKa calculation using Dual-level Proton Exchange scheme.
Uses 5PQ_Me_ts1 as target acid (HA/A-) and collidine as reference (HB/B-). Reference pKa of collidine = 6.75
The dual-level approach uses: 1. Gas-phase frequency calculations for thermal corrections (G_corr) 2. Solvent single-point calculations for E_solv 3. G_soln = E_solv + G_corr for solution free energy (in Hartree/au) 4. Proton exchange scheme: HA + B⁻ → A⁻ + HB
- test_compute_pka_direct_scheme(gaussian_pKa_HA_optimization_outputfile, gaussian_pKa_A_optimization_outputfile, gaussian_pKa_HA_single_point_outputfile, gaussian_pKa_A_single_point_outputfile)[source]
Test direct dissociation via unified compute_pka(scheme=’direct’).
- test_compute_pka_energy_values(gaussian_pKa_HA_optimization_outputfile, gaussian_pKa_A_optimization_outputfile, gaussian_pKa_HB_optimization_outputfile, gaussian_pKa_B_optimization_outputfile, gaussian_pKa_HA_single_point_outputfile, gaussian_pKa_A_single_point_outputfile, gaussian_pKa_HB_single_point_outputfile, gaussian_pKa_B_single_point_outputfile)[source]
Test that dual-level calculation uses correct energy values.
All energies are in Hartree (au) except ΔG_soln which is also provided in kcal/mol for the pKa formula.
Verifies: - E_solv values from solvent SP files (Hartree) - G_corr = qh-G(T) - E_gas from gas-phase files (Hartree) - G_soln = E_solv + G_corr (Hartree) - ΔG_soln in both au and kcal/mol
- test_compute_pka_thermochemistry_ha_and_a(gaussian_pKa_HA_optimization_outputfile, gaussian_pKa_A_optimization_outputfile)[source]
Test compute_pka_thermochemistry with exact reference values.
- test_compute_thermochemistry_ha(gaussian_pKa_HA_optimization_outputfile)[source]
Test compute_thermochemistry returns all values for HA.
- test_deprotonation_energy_difference(gaussian_pKa_HA_optimization_outputfile, gaussian_pKa_A_optimization_outputfile)[source]
Test that deprotonation energy difference is calculated correctly.
ΔE = E(A-) - E(HA) should be positive (deprotonation is endothermic) Δqh-G = qh-G(A-) - qh-G(HA) should also be positive
- test_electronic_energy_a(gaussian_pKa_A_optimization_outputfile)[source]
Test electronic energy for A- matches reference value.
- test_electronic_energy_ha(gaussian_pKa_HA_optimization_outputfile)[source]
Test electronic energy for HA matches reference value.
- test_energy_units_conversion_kcal_mol(gaussian_pKa_HA_optimization_outputfile)[source]
Test energy conversion to kcal/mol.
- test_energy_units_conversion_kj_mol(gaussian_pKa_HA_optimization_outputfile)[source]
Test energy conversion to kJ/mol.
- test_enthalpy_ha(gaussian_pKa_HA_optimization_outputfile)[source]
Test enthalpy for HA matches reference value.
- test_gibbs_free_energy_ha(gaussian_pKa_HA_optimization_outputfile)[source]
Test G(T) for HA matches reference value.
- test_init_with_custom_settings(gaussian_pKa_HA_optimization_outputfile)[source]
Test initialization with custom thermochemistry settings.
- test_init_with_default_settings(gaussian_pKa_HA_optimization_outputfile)[source]
Test initialization with default thermochemistry settings.
- test_print_pka_summary(gaussian_pKa_HA_optimization_outputfile, gaussian_pKa_A_optimization_outputfile, gaussian_pKa_HB_optimization_outputfile, gaussian_pKa_B_optimization_outputfile, gaussian_pKa_HA_single_point_outputfile, gaussian_pKa_A_single_point_outputfile, gaussian_pKa_HB_single_point_outputfile, gaussian_pKa_B_single_point_outputfile, capsys)[source]
Test that print_pka_summary outputs correct format.
All energies should be displayed in Hartree (au) except ΔG_soln which is shown in both au and kcal/mol.
- test_print_pka_thermochemistry_summary(gaussian_pKa_HA_optimization_outputfile, gaussian_pKa_A_optimization_outputfile, capsys)[source]
Test thermochemistry output for pKa calculation shows correct values.
This test verifies that individual thermochemistry values can be extracted from the output objects for HA and A- species.
- test_qh_enthalpy_ha(gaussian_pKa_HA_optimization_outputfile)[source]
Test qh-H for HA matches reference value.
- test_qh_gibbs_free_energy_a(gaussian_pKa_A_optimization_outputfile)[source]
Test qh-G(T) for A- matches reference value.
- test_qh_gibbs_free_energy_ha(gaussian_pKa_HA_optimization_outputfile)[source]
Test qh-G(T) for HA matches reference value.
tests.test_GaussianSettings module
- class tests.test_GaussianSettings.TestGaussianJobFromComFile[source]
Bases:
object- test_cli_group_remove_solvent_overrides_project_settings(gaussian_yaml_settings_gas_solv_project_name)[source]
--remove-solventat the gaussian group level clears project solvent.This simulates:
gaussian --remove-solvent spwhen the project’s solvent-phase sp settings carry a solvent model.
- test_cli_group_solvent_options_propagate_to_opt(gaussian_yaml_settings_gas_solv_project_name)[source]
Solvent options given at the gaussian group level propagate to opt settings.
This simulates:
gaussian -sm smd -si water -so iterative optwhere the solvent options live on the group command and are merged into the subcommand settings viaGaussianJobSettings.merge().
- class tests.test_GaussianSettings.TestGaussianLinkJobSettingsGuess[source]
Bases:
objectTests for guess= formatting in GaussianLinkJobSettings route strings.
- test_multiple_guess_options_with_parentheses()[source]
Multiple comma-separated options must be wrapped: guess=(mix,always)
- test_pre_parenthesized_input_no_double_wrapping()[source]
Already-parenthesized input must not produce double parentheses.
- class tests.test_GaussianSettings.TestGaussianQMMMJobSettings[source]
Bases:
object- test_qmmm_additional_opt_options_in_route()[source]
Regression test: -o/additional_opt_options_in_route must be merged into the opt/ts/modred keyword in the QMMM route string. Previously this field was silently ignored.
- test_qmmm_additional_route_parameters()[source]
Regression test: -r/additional_route_parameters must appear in the QMMM route string. Previously _get_route_string_from_jobtype() in GaussianQMMMJobSettings never appended this field, so keywords like ‘scf=xqc’ were silently dropped.
- class tests.test_GaussianSettings.TestGaussianRoute[source]
Bases:
object- gas_route = 'opt=(ts,calcfc,noeigentest) freq m062x def2svp'
- gas_route2 = 'opt b3lyp 6-31G(d) empiricaldispersion=gd3bj'
- solv_route = 'mn15 def2svp scrf=(smd,solvent=DiChloroMethane)'
- solv_route2 = '# opt=(calcfc,ts,noeigentest,maxstep=5) freq\nscrf=(smd,solvent=chlorobenzene) nosymm scf=qc def2svp m06'
- class tests.test_GaussianSettings.TestGaussianpKaJobSettings[source]
Bases:
objectTests for GaussianpKaJobSettings and GaussianpKaJob classes.
- test_conjugate_base_job_property(single_molecule_xyz_file, gaussian_jobrunner_no_scratch)[source]
Test conjugate_base_job property.
- test_conjugate_base_molecule_method(single_molecule_xyz_file)[source]
Test the public conjugate_base_molecule method.
- test_conjugate_base_molecule_property(single_molecule_xyz_file, gaussian_jobrunner_no_scratch)[source]
Test conjugate_base_molecule method on settings.
- test_conjugate_pair_job_settings_method(single_molecule_xyz_file)[source]
Test the public conjugate_pair_job_settings method returns gas phase settings.
- test_conjugate_pair_molecules_method(single_molecule_xyz_file)[source]
Test the public conjugate_pair_molecules method.
- test_create_conjugate_base_molecule(single_molecule_xyz_file)[source]
Test creating conjugate base molecule by removing a proton.
- test_create_conjugate_base_molecule_custom_charge(single_molecule_xyz_file)[source]
Test creating conjugate base with custom charge/multiplicity.
- test_create_conjugate_base_molecule_invalid_index(single_molecule_xyz_file)[source]
Test that error is raised for out-of-range proton index.
- test_create_conjugate_base_molecule_no_proton_index(single_molecule_xyz_file)[source]
Test that error is raised when proton_index is not specified.
- test_create_conjugate_base_molecule_not_hydrogen(single_molecule_xyz_file)[source]
Test that error is raised when index is not a hydrogen.
- test_create_job_settings(single_molecule_xyz_file)[source]
Test creating gas phase job settings for both forms.
- test_create_molecules(single_molecule_xyz_file)[source]
Test creating both protonated and conjugate base molecules.
- test_gas_phase_optimization_settings(single_molecule_xyz_file)[source]
Test that gas phase optimization has no solvent.
- test_get_reference_conjugate_base_molecule(single_molecule_xyz_file)[source]
Test creating reference conjugate base by removing proton.
- test_get_reference_molecule(single_molecule_xyz_file)[source]
Test loading reference molecule from file.
- test_init_invalid_settings_type(single_molecule_xyz_file, gaussian_jobrunner_no_scratch)[source]
Test that error is raised for non-pKa settings.
- test_init_no_proton_index(single_molecule_xyz_file, gaussian_jobrunner_no_scratch)[source]
Test that error is raised when proton_index is not specified.
- test_job_init_valid_settings(single_molecule_xyz_file, gaussian_jobrunner_no_scratch)[source]
Test initialization with valid pKa settings.
- test_job_labels(single_molecule_xyz_file, gaussian_jobrunner_no_scratch)[source]
Test that job labels are correctly generated.
- test_pka_jobs_property(single_molecule_xyz_file, gaussian_jobrunner_no_scratch)[source]
Test that pka_jobs returns both jobs.
- test_proton_exchange_with_reference_file(single_molecule_xyz_file)[source]
Test proton exchange cycle with reference acid file.
- test_proton_exchange_without_reference_file()[source]
Test proton exchange cycle without reference file.
- test_protonated_charge_multiplicity_properties()[source]
Test that protonated_charge/multiplicity are aliases for charge/multiplicity.
- test_protonated_job_property(single_molecule_xyz_file, gaussian_jobrunner_no_scratch)[source]
Test protonated_job property.
- test_protonated_molecule_property(single_molecule_xyz_file, gaussian_jobrunner_no_scratch)[source]
Test protonated_molecule method on settings.
- test_reference_gas_phase_job_settings(single_molecule_xyz_file)[source]
Test reference acid gas phase optimization settings.
- test_reference_solution_phase_sp_settings(single_molecule_xyz_file)[source]
Test reference acid solution phase SP settings.
- test_reference_validation(single_molecule_xyz_file)[source]
Test that reference settings validation works.
tests.test_GaussianWriter module
- class tests.test_GaussianWriter.TestGaussianInputWriter[source]
Bases:
object- test_append_mm_parameters_skips_plain_molecule()[source]
False branch: molecule is not a QMMMMolecule and has no params file.
- test_write_gaussian_input_from_pbc_logfile(tmpdir, gaussian_yaml_settings_gas_solv_project_name, gaussian_pbc_2d_outputfile, gaussian_jobrunner_no_scratch, gaussian_written_opt_from_graphite_2d_pbc_log)[source]
- test_write_modred_job(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_modred_file)[source]
- test_write_modred_with_custom_basis_for_all_elements_in_structure_using_api(tmpdir, gaussian_yaml_settings_gas_solv_project_name, modred_genecp_inputfile, gaussian_jobrunner_no_scratch, gaussian_modred_with_custom_basis_for_all_atoms_from_api)[source]
- test_write_opt_input_from_logfile(tmpdir, gaussian_yaml_settings_gas_solv_project_name, gaussian_singlet_opt_outfile, gaussian_jobrunner_no_scratch, gaussian_written_ts_from_nhc_singlet_log_file)[source]
Taking the Gaussian nhc_neutral_singlet.log output and write aldehyde_opt.com using the settings from the .log file.
- test_write_opt_job(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_opt_file)[source]
- test_write_opt_job_with_route(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_opt_file_with_route)[source]
- test_write_qmmm_amber_from_oniom_com_without_sidecar_files(tmpdir, gaussian_yaml_settings_qmmm_project_name, gaussian_jobrunner_no_scratch)[source]
- test_write_qmmm_amber_incomplete_mm_atom_info_raises(tmpdir, gaussian_jobrunner_no_scratch)[source]
- test_write_qmmm_amber_requires_mm_atom_info(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_qmmm_project_name, gaussian_jobrunner_no_scratch)[source]
- test_write_qmmm_amber_with_mm_atom_info(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_qmmm_project_name, gaussian_jobrunner_no_scratch)[source]
- test_write_qmmm_auto_assigns_link_atoms_for_cut_bonds(tmpdir, gaussian_jobrunner_no_scratch)[source]
Cut covalent bonds are assigned as link atoms when bonded_atoms is omitted.
- test_write_qmmm_genecp_follows_conventional_basis_path(tmpdir, gaussian_jobrunner_no_scratch)[source]
ONIOM gen/genecp uses the same shared basis path as non-QMMM jobs.
- test_write_qmmm_input_from_logfile(tmpdir, gaussian_yaml_settings_qmmm_project_name, gaussian_singlet_opt_outfile, gaussian_jobrunner_no_scratch, gaussian_written_qmmm_log_file)[source]
Taking the Gaussian nhc_neutral_singlet.log output and write qmmm .com
- test_write_qmmm_job(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_qmmm_project_name, gaussian_written_qmmm_file, gaussian_jobrunner_no_scratch)[source]
- test_write_qmmm_job_with_scale_factors(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_qmmm_project_name, gaussian_jobrunner_no_scratch)[source]
Both MM boundary atoms may link to the same high-layer atom.
- test_write_qmmm_missing_mm_parameters_file_raises(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_qmmm_project_name, gaussian_jobrunner_no_scratch)[source]
- test_write_qmmm_mm_parameters_file_overrides_molecule_params(tmpdir, gaussian_yaml_settings_qmmm_project_name, gaussian_jobrunner_no_scratch)[source]
- test_write_qmmm_pm6_skips_connectivity_section(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_qmmm_project_name, gaussian_jobrunner_no_scratch)[source]
- test_write_qmmm_rejects_multiple_link_atoms_on_same_atom(tmpdir, single_molecule_xyz_file, gaussian_jobrunner_no_scratch)[source]
Gaussian permits only one link-atom specification per atom.
- test_write_qmmm_uses_layers_from_oniom_com(tmpdir, gaussian_qmmm_inputfile_2layer, gaussian_yaml_settings_qmmm_project_name, gaussian_jobrunner_no_scratch)[source]
- test_write_scan_job_multiple_degrees_of_freedom(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_scan_multiple_degrees_of_freedom_file)[source]
- test_write_scan_job_multiple_degrees_of_freedom_with_constraints(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_scan_multiple_degrees_of_freedom_with_constraints_file)[source]
- test_write_scan_job_single_degree_of_freedom(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_scan_single_degree_of_freedom_file)[source]
- test_write_semiempirical_opt_job(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_pm6_opt_file)[source]
- test_write_sp_input_with_solvation_from_logfile(tmpdir, gaussian_yaml_settings_gas_solv_project_name, gaussian_singlet_opt_outfile, gaussian_jobrunner_no_scratch, gaussian_written_sp_from_nhc_singlet_log_with_solvent_file)[source]
Test writing simple .com input file using settings from .log file, including solvation.
- test_write_sp_with_custom_solvation_from_logfile(tmpdir, gaussian_yaml_settings_gas_solv_project_name, gaussian_singlet_opt_outfile, gaussian_jobrunner_no_scratch, smd_TBME_solvent_parameters_text_file, gaussian_written_sp_from_nhc_singlet_log_with_custom_solvent_file)[source]
Test writing input file from log file. Simply taking the Gaussian nhc_neutral_singlet.log output and write gaussian_sp_custom_solv.com using the settings from the .log file and including custom solvation parameters from file smd_TBME.
- test_write_ts_job(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_ts_file)[source]
tests.test_ORCAIO module
- class tests.test_ORCAIO.TestORCAInput[source]
Bases:
object
- class tests.test_ORCAIO.TestORCANEBInput[source]
Bases:
objectTest suite for ORCANEBInput class.
- test_neb_input_charge_and_multiplicity(orca_input_nebts_file)[source]
Test reading charge and multiplicity from NEB input.
- test_neb_input_ending_xyzfile(orca_input_nebts_file)[source]
Test reading ending XYZ file from NEB input.
- test_neb_input_inherits_from_orca_input(orca_input_nebts_file)[source]
Test that ORCANEBInput inherits from ORCAInput.
- test_neb_input_nimages(orca_input_nebts_file)[source]
Test reading number of images from NEB input.
- test_neb_input_pre_optimization_false(orca_input_nebts_file)[source]
Test reading pre-optimization flag (False) from NEB input.
- test_neb_input_restarting_allxyzfile_none(orca_input_nebts_file)[source]
Test that restarting_allxyzfile is None when not specified.
- test_neb_input_starting_xyzfile(orca_input_nebts_file)[source]
Test reading starting XYZ file from NEB input.
- class tests.test_ORCAIO.TestORCANEBJobSettings[source]
Bases:
objectTest suite for ORCANEBJobSettings class.
- test_equality_different_intermediate_xyzfile()[source]
Test that settings with different intermediate file are not equal.
- test_equality_different_joboption()[source]
Test that settings with different joboption are not equal.
- test_equality_different_parent_attributes()[source]
Test that settings with different parent class attributes are not equal.
- test_equality_different_preopt_ends()[source]
Test that settings with different preopt_ends are not equal.
- test_equality_different_restarting_xyzfile()[source]
Test that settings with different restart file are not equal.
- test_equality_different_semiempirical()[source]
Test that settings with different semiempirical method are not equal.
- class tests.test_ORCAIO.TestORCAOutput[source]
Bases:
object- test_fe2_quintet_orbital_properties(fe2_quintet_output)[source]
Test HOMO/LUMO/SOMO properties for Fe2 quintet state.
- test_fe2_singlet_orbital_properties(fe2_singlet_output)[source]
Test HOMO/LUMO properties for Fe2 singlet state.
- test_fe2_triplet_orbital_properties(fe2_triplet_output)[source]
Test HOMO/LUMO/SOMO properties for Fe2 triplet state.
- test_fe3_doublet_orbital_properties(fe3_doublet_output)[source]
Test HOMO/LUMO/SOMO properties for Fe3 doublet state.
- test_fe3_quartet_orbital_properties(fe3_quartet_output)[source]
Test HOMO/LUMO/SOMO properties for Fe3 quartet state.
- test_fe3_sextet_orbital_properties(fe3_sextet_output)[source]
Test HOMO/LUMO/SOMO properties for Fe3 sextet state.
- class tests.test_ORCAIO.TestORCAQMMMJobSettings[source]
Bases:
object- test_charge_and_multiplicity_population()[source]
ORCAQMMMJobSettings should populate .charge and .multiplicity from intermediate or high fields.
- test_partition_string_empty_and_none()[source]
Empty string or None should return empty partition block.
- test_partition_string_qm_and_qm2()[source]
When both high_level_atoms and medium_level_atoms provided, both lines should be returned.
- class tests.test_ORCAIO.TestORCApKaOutput[source]
Bases:
objectTests for ORCApKaOutput using ORCATests pKa fixtures from outputs/.
- EXPECTED_DG_AU = -0.02392099999997299
- EXPECTED_DG_KCAL = -15.010654129046468
- L2_A_E = -1101.075761
- L2_A_QH_G = -1100.815285
- L2_A_SP_E = -1101.157126
- L2_HA_E = -1101.598928
- L2_HA_QH_G = -1101.32487
- L2_HA_SP_E = -1101.625867
- PHENOL_B_E = -306.533586
- PHENOL_B_QH_G = -306.467527
- PHENOL_B_SP_E = -306.628244
- PHENOL_HB_E = -307.111134
- PHENOL_HB_QH_G = -307.031069
- PHENOL_HB_SP_E = -307.12133
tests.test_PyMOLJobs module
tests.test_YAMLIO module
tests.test_converter module
tests.test_groupers module
- class tests.test_groupers.TestConformerIdExtraction[source]
Bases:
objectTest conformer ID extraction from filenames.
- test_all_files_without_cxx_pattern()[source]
Test that a folder with no _cXX_ pattern files works correctly.
- test_conformer_id_fallback_to_filename()[source]
Test that filename is used as conformer ID when no _cXX_ pattern.
- test_conformer_ids_molecules_correspondence(ts_conformers_log_directory)[source]
Test that conformer_ids and molecules are strictly one-to-one corresponding.
This verifies that after sorting, each molecule’s energy matches the energy from its corresponding file (identified by conf_id).
- class tests.test_groupers.Test_BasicRMSD_grouper_and_basic_functionality[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={})]
- class tests.test_groupers.Test_EnergyGrouper[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={})]
- test_energy_extraction_from_ts_log_files(ts_conformers_log_directory)[source]
Test that energy is correctly extracted from TS log files as SCF Done energy.
- test_energy_grouper_for_crest_conformers(multiple_molecules_xyz_file)[source]
Test EnergyGrouper with molecules that have energy information.
- class tests.test_groupers.Test_HungarianRMSD_grouper[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={})]
- class tests.test_groupers.Test_IRMSD_grouper[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={}), Mark(name='skipif', args=(True,), kwargs={'reason': 'irmsd command not available'})]
- class tests.test_groupers.Test_PymolRMSD_grouper[source]
Bases:
object- NUM_PROCS = 1
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={})]
- class tests.test_groupers.Test_SpyRMSD_grouper[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={})]
- class tests.test_groupers.Test_Tanimoto_similarity_grouper[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={})]
- class tests.test_groupers.Test_TorsionFingerprint_grouper[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={})]
- class tests.test_groupers.Test_conformer_ids_functionality[source]
Bases:
objectTest conformer_ids parameter functionality.
- NUM_PROCS = 1
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={})]
- class tests.test_groupers.Test_edge_cases[source]
Bases:
objectTest edge cases and boundary conditions.
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={})]
- test_different_formulas_always_separate(methanol_and_ethanol)[source]
Test that molecules with different formulas are always in separate groups.
- test_num_groups_equals_num_molecules(methanol_molecules)[source]
Test requesting same number of groups as molecules.
- test_num_groups_exceeds_num_molecules(methanol_molecules)[source]
Test requesting more groups than molecules.
- test_rmsd_infinity_for_different_molecules(methanol_and_ethanol)[source]
Test that RMSD returns infinity for molecules with different atom counts.
- class tests.test_groupers.Test_energy_extraction_function[source]
Bases:
objectFramework tests for energy extraction by file type.
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={})]
- class tests.test_groupers.Test_grouper_complete_linkage[source]
Bases:
objectTest complete linkage clustering behavior.
- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={})]
- class tests.test_groupers.Test_grouper_utility_functions[source]
Bases:
objectTest utility functions and helper methods in groupers.
- NUM_PROCS = 1
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={})]
- test_grouping_result_caching(multiple_molecules_xyz_file)[source]
Test that grouping results are cached and reused.
- class tests.test_groupers.Test_label_and_append_label[source]
Bases:
objectTest -l (label) and -a (append_label) parameter functionality.
- NUM_PROCS = 1
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={})]
- test_different_labels_create_different_outputs(multiple_molecules_xyz_file)[source]
Test that different labels create separate output directories.
- test_label_in_group_xyz_files(multiple_molecules_xyz_file)[source]
Test that label parameter affects group XYZ file names.
- class tests.test_groupers.Test_other_groupers[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={})]
- class tests.test_groupers.Test_output_file_generation[source]
Bases:
objectTest that grouper generates correct output files.
- NUM_PROCS = 1
- pytestmark = [Mark(name='usefixtures', args=('temporary_working_dir',), kwargs={})]
- test_group_xyz_files_contain_energy_and_index_info(multiple_molecules_xyz_file)[source]
Test that group XYZ files contain energy and original index information.
tests.test_organizer module
tests.test_server module
- class tests.test_server.TestMissingProgramSectionFallback[source]
Bases:
objectTests that Executable.from_servername raises ValueError when the program block (e.g. XTB, CREST) is absent from the server YAML, and that programs which ARE present still parse correctly.
Covers users who installed CHEMSMART before xTB support was added.
- test_crest_missing_section_raises(legacy_server_yaml)[source]
CRESTExecutable.from_servername raises ValueError when CREST block absent.
- test_present_section_still_parsed_correctly(legacy_server_yaml)[source]
Programs that are present in the legacy YAML are still parsed.
tests.test_structures module
- class tests.test_structures.TestCDXFile[source]
Bases:
objectTests for ChemDraw file reading functionality.
- test_cdx_molecule_to_graph(single_molecule_cdxml_file_benzene)[source]
Test that molecules from CDXML can be converted to graph.
- test_cdx_molecule_to_rdkit_conversion(single_molecule_cdxml_file_benzene)[source]
Test that molecules from CDXML can be converted to RDKit.
- test_cdxfile_get_molecules_index(multi_molecule_cdxml_file)[source]
Test CDXFile.get_molecules with various index specifications.
- test_molecule_from_filepath_cdx(single_molecule_cdx_file_imidazole)[source]
Test Molecule.from_filepath with a binary ChemDraw .cdx file.
- test_molecule_from_filepath_cdxml(single_molecule_cdxml_file_benzene)[source]
Test Molecule.from_filepath with CDXML file.
- test_molecule_from_filepath_cdxml_multi_molecules(multi_molecule_cdxml_file)[source]
Test reading multiple molecules from CDXML using from_filepath.
- test_molecule_from_filepath_cdxml_pathlib(single_molecule_cdxml_file_benzene)[source]
Test Molecule.from_filepath with pathlib.Path.
- test_molecule_from_filepath_cdxml_return_list(single_molecule_cdxml_file_benzene)[source]
Test return_list parameter with single molecule CDXML file.
- test_read_complex_molecule_cdxml_file_(complex_molecule_cdxml_file)[source]
Test reading a single molecule from a CDXML file.
- test_read_metal_ligand_molecules_cdxml_file_(metal_ligand_molecules_cdxml_file)[source]
Test reading multiple organometallic molecules from a CDXML file with Cp and aromatic ligands.
- test_read_multi_molecule_cdxml_file(multi_molecule_cdxml_file)[source]
Test reading multiple molecules from a CDXML file.
- test_read_single_molecule_cdx_file_imidazole(single_molecule_cdx_file_imidazole)[source]
Test reading a single molecule from a CDXML file.
- class tests.test_structures.TestCXSMILES[source]
Bases:
objectTests for Molecule.cxsmiles property (RDKit backend).
- EXPECTED_NORMAL = '[H]C([H])([H])C([H])([H])op(=O)oC([H])([H])C([H])([H])[H] |(3.6969,1.9448,0.2049;3.0842,1.2373,-0.3608;3.7313,0.4472,-0.7559;2.652,1.7556,-1.2232;1.9939,0.6488,0.5088;1.3583,1.4601,0.8855;2.4534,0.1313,1.3605;1.2255,-0.2622,-0.2653;0.0003,-0.9988,0.5013;0.0051,-2.2423,-0.2655;-1.2252,-0.2619,-0.2663;-1.9972,0.645,0.509;-2.4576,0.1238,1.3579;-1.364,1.4563,0.8899;-3.0867,1.2342,-0.3613;-3.702,1.9386,0.2054;-2.6535,1.756,-1.221;-3.7312,0.4439,-0.7604)|'
- EXPECTED_R_ENANTIOMER = '[H]c1c([H])c([H])c(P(=O)(c2c([H])c([H])c([H])c([H])c2[H])C([H])([H])[C@@]2(C([H])([H])[H])c(=O)n(C([H])([H])[H])c3c([H])c([H])c([H])c([H])c32)c([H])c1[H] |(0.657587,4.92454,-1.29892;0.276843,3.96138,-0.951759;0.485742,2.81258,-1.71847;1.03401,2.87447,-2.66093;0.006912,1.57925,-1.27484;0.204594,0.685275,-1.87284;-0.6776,1.49046,-0.055628;-1.25801,-0.0518,0.702519;-1.3091,0.044461,2.20006;-2.88635,-0.380829,-0.012479;-3.12941,-0.354113,-1.39219;-2.32549,-0.092551,-2.08777;-4.40354,-0.645056,-1.87792;-4.59613,-0.624486,-2.95272;-5.43533,-0.955747,-0.986524;-6.43361,-1.18057,-1.36882;-5.19575,-0.974224,0.388852;-6.00568,-1.21169,1.08208;-3.92009,-0.687184,0.879324;-3.70148,-0.688059,1.9505;-0.227699,-1.40463,0.052757;-0.119079,-1.24802,-1.03485;-0.807656,-2.33494,0.17008;1.15351,-1.5942,0.72979;0.99867,-2.27426,2.08799;0.308383,-1.69441,2.71697;1.97119,-2.35931,2.59369;0.59233,-3.28598,1.93715;1.93427,-2.48285,-0.25179;1.70453,-3.64544,-0.504979;2.90906,-1.70492,-0.846562;3.81634,-2.19747,-1.84937;3.73917,-1.61247,-2.77951;3.54494,-3.24141,-2.05378;4.8593,-2.15693,-1.49649;2.95902,-0.433075,-0.262488;3.8266,0.615031,-0.550651;4.58376,0.527564,-1.3328;3.69973,1.78628,0.210751;4.36465,2.62845,0.005447;2.75405,1.88809,1.23239;2.68234,2.80776,1.81661;1.88531,0.820237,1.50649;1.12177,0.893949,2.28612;1.97673,-0.328846,0.734248;-0.882212,2.64496,0.711945;-1.38448,2.55034,1.67858;-0.411788,3.878,0.260678;-0.570718,4.77518,0.863087),wU:23.24|'
- EXPECTED_R_ROTAMER = '[H]c1n=c(-c2c(-os(=O)(=O)C(F)(F)F)c([H])c([H])c3c([H])c([H])c([H])c([H])c23)c2c([H])c([H])c([H])c([H])c2c1[H] |(-0.329609,2.38122,-3.61273;-0.026158,2.27146,-2.56743;0.336125,1.02648,-2.1812;0.702396,0.825008,-0.934002;1.01703,-0.590455,-0.562362;-0.007714,-1.51067,-0.532668;-1.30548,-1.10616,-0.852577;-2.1204,-0.164611,0.168256;-2.55417,1.01923,-0.515766;-1.46291,-0.151398,1.44906;-3.57423,-1.28562,0.320271;-4.16542,-1.41565,-0.847695;-3.16121,-2.46571,0.747804;-4.41207,-0.76474,1.19438;0.181508,-2.86971,-0.206966;-0.687662,-3.52873,-0.187174;1.44931,-3.31282,0.079351;1.62504,-4.36094,0.333044;2.55451,-2.41778,0.057183;3.87361,-2.86277,0.348232;4.02499,-3.91674,0.595343;4.93563,-1.98941,0.318758;5.94394,-2.3428,0.544269;4.72459,-0.626471,-0.008915;5.57315,0.060292,-0.037079;3.46034,-0.164367,-0.295324;3.30174,0.885311,-0.552026;2.34077,-1.04278,-0.266984;0.743402,1.86566,0.050067;1.11738,1.6475,1.4052;1.36594,0.635744,1.73181;1.14034,2.69619,2.29419;1.42424,2.52279,3.3341;0.783222,4.00428,1.87401;0.805052,4.82508,2.59435;0.401105,4.23926,0.574492;0.114218,5.24117,0.245832;0.370036,3.17459,-0.368519;-0.025328,3.3532,-1.71845;-0.329238,4.34162,-2.07033)|'
- EXPECTED_S_ENANTIOMER = '[H]c1c([H])c([H])c(P(=O)(c2c([H])c([H])c([H])c([H])c2[H])C([H])([H])[C@]2(C([H])([H])[H])c(=O)n(C([H])([H])[H])c3c([H])c([H])c([H])c([H])c32)c([H])c1[H] |(-4.10545,4.56874,0.709448;-3.52977,3.64265,0.645345;-3.31587,2.87242,1.79018;-3.72201,3.19528,2.7513;-2.57592,1.69184,1.70894;-2.37818,1.07929,2.59263;-2.05266,1.27517,0.478011;-1.13514,-0.28848,0.507738;-0.75977,-0.677078,1.90906;-2.21055,-1.523,-0.263839;-2.718,-1.39784,-1.56435;-2.48778,-0.513904,-2.16641;-3.52676,-2.40254,-2.09389;-3.92258,-2.30619,-3.10717;-3.83217,-3.53062,-1.32596;-4.46746,-4.31554,-1.7426;-3.3289,-3.6555,-0.02996;-3.56957,-4.53716,0.56812;-2.51594,-2.65283,0.503124;-2.10519,-2.72167,1.51378;0.246332,-0.126442,-0.664672;0.507903,-1.14931,-0.980531;-0.124177,0.404384,-1.55997;1.49769,0.604701,-0.148795;1.1654,1.86783,0.660908;0.549974,2.55301,0.05834;2.09382,2.38433,0.946933;0.621442,1.59517,1.57793;2.29809,1.06731,-1.37867;1.86402,1.731,-2.29803;3.58921,0.612819,-1.24748;4.63005,0.881221,-2.20479;5.4733,1.41251,-1.73622;4.19794,1.50997,-2.994;5.00869,-0.052287,-2.65075;3.72297,-0.193357,-0.108558;4.85777,-0.860668,0.337892;5.8052,-0.793848,-0.201106;4.73765,-1.62678,1.50603;5.61099,-2.16479,1.88194;3.52468,-1.71469,2.1904;3.45722,-2.32196,3.09528;2.38859,-1.03029,1.72864;1.4267,-1.09209,2.24455;2.49776,-0.268364,0.573364;-2.26183,2.05492,-0.668208;-1.83522,1.76286,-1.63193;-3.00036,3.23568,-0.582173;-3.1564,3.84433,-1.47533),wU:23.24|'
- EXPECTED_S_ROTAMER = '[H]c1n=c(-c2c(-os(=O)(=O)C(F)(F)F)c([H])c([H])c3c([H])c([H])c([H])c([H])c23)c2c([H])c([H])c([H])c([H])c2c1[H] |(-0.329441,-2.38184,-3.61277;-0.026136,-2.27183,-2.56745;0.33626,-1.0268,-2.18149;0.702361,-0.825125,-0.934248;1.01698,0.590384,-0.562766;-0.007759,1.51064,-0.533148;-1.3055,1.10597,-0.853096;-2.12019,0.16467,0.168019;-1.46257,0.151709,1.44877;-2.55422,-1.01919,-0.515773;-3.57381,1.28579,0.320452;-3.16032,2.46582,0.747959;-4.16523,1.41612,-0.847356;-4.41149,0.765061,1.19469;0.181532,2.86961,-0.207313;-0.687458,3.52887,-0.187547;1.44935,3.31259,0.07922;1.62509,4.36068,0.33303;2.55452,2.41752,0.057133;3.87361,2.86235,0.348425;4.02509,3.91629,0.595642;4.93552,1.98887,0.319058;5.94384,2.34212,0.544769;4.7244,0.625956,-0.008734;5.5729,-0.060885,-0.036781;3.46015,0.164008,-0.295385;3.30143,-0.885637,-0.552158;2.3407,1.04257,-0.26718;0.743183,-1.86557,0.050012;1.11714,-1.64713,1.40512;1.36576,-0.635314,1.7315;1.1399,-2.69559,2.29437;1.42376,-2.522,3.33425;0.782587,-4.00373,1.87448;0.804249,-4.82437,2.595;0.400478,-4.23897,0.575013;0.11344,-5.24092,0.246622;0.369622,-3.17453,-0.368276;-0.025656,-3.35336,-1.71819;-0.329772,-4.34179,-2.06987)|'
- test_enantiomers_differ(cxsmiles_r_enantiomer_file, cxsmiles_s_enantiomer_file)[source]
R and S enantiomers must produce different CXSMILES. The SMILES core itself differs (@@/@ chirality annotation).
- test_large_molecule_c2_cxsmiles(cxsmiles_large_molecule_c2_file, cxsmiles_expected_large_c2_file)[source]
CXSMILES for a large molecule (c2) should match the expected value.
- test_large_molecule_c3_cxsmiles(cxsmiles_large_molecule_c3_file, cxsmiles_expected_large_c3_file)[source]
CXSMILES for a large molecule (c3) should match the expected value.
- test_large_molecules_differ(cxsmiles_large_molecule_c2_file, cxsmiles_large_molecule_c3_file)[source]
Two different large molecules should produce different CXSMILES.
- test_r_enantiomer_cxsmiles(cxsmiles_r_enantiomer_file)[source]
CXSMILES for the R-enantiomer should match the expected value.
- test_r_rotamer_cxsmiles(cxsmiles_r_rotamer_file)[source]
CXSMILES for the R-rotamer should match the expected value.
- test_regression_cxsmiles(cxsmiles_normal_file)[source]
CXSMILES for a simple molecule should be deterministic across repeated calls.
- test_rotamers_differ(cxsmiles_r_rotamer_file, cxsmiles_s_rotamer_file)[source]
R and S rotamers must produce different CXSMILES. Rotamers share the same SMILES core (identical connectivity) but differ in the CX coordinate extension (3D geometry).
- class tests.test_structures.TestChemicalFeatures[source]
Bases:
object- test_more_stereochemistry_handling()[source]
Test preservation of stereochemical information with PubChem.
- test_resonance_handling(gaussian_ozone_opt_outfile, gaussian_acetone_opt_outfile, gaussian_benzene_opt_outfile)[source]
Test handling of resonance structures.
- test_stereochemistry_handling(methyl3hexane_molecule)[source]
Test preservation of stereochemical information.
- test_volume(gaussian_ozone_opt_outfile, gaussian_acetone_opt_outfile)[source]
Test volume calculation for molecules.
Tests various volume calculation methods: - voronoi_dirichlet_occupied_volume - crude_volume_by_vdw_radii - crude_volume_by_atomic_radii - vdw_volume - vdw_volume_from_rdkit - voronoi_dirichlet_polyhedra_occupied_volume
- class tests.test_structures.TestCoordinateBlock[source]
Bases:
object- test_coordinate_block_with_partitions_returns_qmmm_molecule()[source]
ONIOM coordinate block should return QMMMMolecule.
- class tests.test_structures.TestInChI[source]
Bases:
objectTests for Molecule.inchi and Molecule.inchikey properties (Open Babel backend).
- EXPECTED_INCHI_NORMAL = 'InChI=1S/C4H10O3P/c1-3-6-8(5)7-4-2/h3-4H2,1-2H3'
- EXPECTED_INCHI_R_ENANTIOMER = 'InChI=1S/C23H22NO2P/c1-23(20-15-9-10-16-21(20)24(2)22(23)25)17-27(26,18-11-5-3-6-12-18)19-13-7-4-8-14-19/h3-16H,17H2,1-2H3/t23-/m1/s1'
- EXPECTED_INCHI_S_ENANTIOMER = 'InChI=1S/C23H22NO2P/c1-23(20-15-9-10-16-21(20)24(2)22(23)25)17-27(26,18-11-5-3-6-12-18)19-13-7-4-8-14-19/h3-16H,17H2,1-2H3/t23-/m0/s1'
- EXPECTED_LARGE_C2 = 'KRPJGRYSEYYRSW-YWQHEUOTSA-M'
- EXPECTED_LARGE_C3 = 'WYLDIUSELJCHHK-MMELAICESA-M'
- EXPECTED_NORMAL = 'NNJYFTBCZFRDIO-UHFFFAOYSA-N'
- EXPECTED_R_ENANTIOMER = 'YDCAVENCOFCEDV-HSZRJFAPSA-N'
- EXPECTED_S_ENANTIOMER = 'YDCAVENCOFCEDV-QHCPKHFHSA-N'
R and S enantiomers share the same first (connectivity) layer of the InChI and InChIKey (identical constitution) but differ in the stereo layer, confirming that Open Babel correctly resolves the axial chirality.
- test_large_molecule_c2_inchikey(inchikey_large_molecule_c2_file)[source]
InChIKey for a large molecule (c2) should match the expected value.
- test_large_molecule_c3_inchikey(inchikey_large_molecule_c3_file)[source]
InChIKey for a large molecule (c3) should match the expected value.
- test_large_molecules_differ(inchikey_large_molecule_c3_file, inchikey_large_molecule_c2_file)[source]
Two different large molecules should produce different InChIKeys and InChI strings.
- test_r_enantiomer_inchikey(inchikey_r_enantiomer_file)[source]
InChIKey for the R-enantiomer should match the expected value.
- class tests.test_structures.TestInChIKey[source]
Bases:
objectTests for Molecule.inchikey property (Open Babel backend).
- class tests.test_structures.TestMoleculeAdvanced[source]
Bases:
object- test_charge_and_multiplicity_handling()[source]
Test preservation of charge and multiplicity states.
- test_convert_ase_atoms_with_constraints_to_molecule(constrained_atoms)[source]
Test conversion of ASE Atoms with constraints to Molecule.
- test_from_pdb_file_infers_uppercase_two_letter_elements_when_blank(tmpdir)[source]
Test blank PDB element columns fall back to uppercase atom-name inference.
- test_from_pdb_file_preserves_atom_and_residue_metadata(tmpdir)[source]
Test native PDB import preserves atom names and residue metadata.
- test_from_pdb_file_supports_model_index_selection(tmpdir)[source]
Test PDB MODEL/ENDMDL parsing and index selection.
- test_infer_pdb_element_from_uppercase_atom_names()[source]
Test uppercase PDB atom names can still infer two-letter elements.
- test_is_aromatic_non_aromatic_molecules()[source]
Regression test: non-aromatic molecules must not be reported as aromatic.
Bond-order heuristics can assign order 1.5 to bonds like O-H or Mg-I, which previously caused
is_aromaticto returnTruefor H2O and MgI2. The property must use ring membership to validate aromaticity.
- test_molecule_from_db_with_pbc_and_constraints(constrained_pbc_db_file)[source]
Test creation of Molecule from database with PBC and constraints.
- test_pdb_with_different_flavors(single_molecule_xyz_file)[source]
Test PDB conversion with different flavor options.
- test_pdb_with_no_bonds(single_molecule_xyz_file)[source]
Test PDB conversion without bond detection.
- test_to_ase_energy_unit_conversion()[source]
Test that to_ase() converts energy from Hartree to eV.
- test_to_ase_energy_with_none_forces()[source]
Test that to_ase() converts energy when forces are None.
- test_to_ase_forces_unit_conversion()[source]
Test that to_ase() converts forces from Hartree/Bohr to eV/Å.
- test_to_ase_none_energy_and_forces()[source]
Test that to_ase() preserves None for energy and forces.
- test_to_ase_none_energy_with_forces()[source]
Test that to_ase() converts forces when energy is None.
- test_to_pdb_conversion(single_molecule_xyz_file)[source]
Test conversion of Molecule to PDB format.
- test_to_pdb_strict_columns_and_final_end_record()[source]
Test strict PDB 3.3 atom-column formatting and final END line.
- test_to_pdb_uses_molecule_attributes_for_chain_and_residue_metadata()[source]
Test chain/residue metadata taken directly from Molecule attributes.
- class tests.test_structures.TestMoleculeAndStructureIdentifiers[source]
Bases:
objectTests for Molecule.canonical_geometry, Molecule.structure_id, Molecule.structure_label, Molecule.molecule_id, and Molecule.molecule_label.
- canonical_geometry: string encoding of the geometry invariant under
translation, rotation, and atom-index permutation.
structure_id: SHA-256 hex digest of (canonical_geometry, charge, multiplicity). structure_label: “str-{chemical_formula}-{structure_id[:12]}”. molecule_id: Unique chemical species identifier (InChIKey string).
Topology- and stereochemistry-based; geometry-independent.
molecule_label: “mol-{chemical_formula}-{molecule_id}”.
- test_atom_permutation_preserves_both_ids(canonical_3b_file, canonical_3b_permuted_file)[source]
Permuting atom input order must preserve both structure_id and molecule_id (invariance to atom-listing order).
- test_different_electronic_state_changes_structure_id_not_molecule_id(canonical_formaldehyde_file)[source]
The same geometry with different charge or multiplicity must produce a different structure_id (electronic state is part of the structure hash) but the same molecule_id (topology is unchanged).
- test_different_species_differ_in_both_ids(canonical_formaldehyde_file, canonical_methane_file)[source]
Two chemically distinct molecules must differ in both structure_id and molecule_id.
- test_enantiomers_differ_in_both_ids(canonical_r_bromochlorofluoromethane_file, canonical_s_bromochlorofluoromethane_file)[source]
R- and S-bromochlorofluoromethane are non-superimposable mirror images: both structure_id (different geometry) and molecule_id (InChIKey encodes stereochemistry) must differ. The first InChIKey block (connectivity layer) is shared; the stereo layer (second block) differs.
- test_geometry_distortion_changes_structure_id_not_molecule_id(canonical_methane_file, canonical_methane_distorted_file)[source]
Elongating one C-H bond by ~2e-3 Å must change structure_id (geometry changed) but leave molecule_id unchanged (same topology).
- test_ids_are_deterministic(canonical_formaldehyde_file)[source]
Loading the same file twice must give identical structure_id, structure_label, molecule_id, and molecule_label.
- test_molecule_label_format(canonical_formaldehyde_file)[source]
molecule_label must follow ‘mol-{chemical_formula}-{molecule_id}’.
- test_rigid_transform_preserves_both_ids_3b(canonical_3b_file, canonical_3b_trans_rot_file)[source]
Translating and rotating 3b (C17H17NOS, C1 symmetry, 37 atoms) must preserve both structure_id and molecule_id.
- test_rigid_transform_preserves_both_ids_formaldehyde(canonical_formaldehyde_file, canonical_formaldehyde_trans_rot_file)[source]
Translating and rotating formaldehyde (C2v) must preserve both structure_id and molecule_id.
- test_rigid_transform_preserves_both_ids_methane(canonical_methane_file, canonical_methane_trans_rot_file)[source]
Translating and rotating methane (Td, spherical top) should preserve both structure_id and molecule_id (xfail: canonicalization not guaranteed for degenerate inertia tensors).
- class tests.test_structures.TestQMMMMolecule[source]
Bases:
objectTests for QMMMMolecule partitioning and related functionality.
- test_auto_assigns_link_atoms_for_cut_covalent_bonds()[source]
Cut covalent bonds become link-atom pairs when bonded_atoms is omitted.
- test_qmmm_partition_out_of_range_raises()[source]
Specifying out-of-range atom indices should raise a ValueError.
- test_qmmm_partition_overlap_raises()[source]
Creating a QMMMMolecule with overlapping partitions should raise a ValueError.
- class tests.test_structures.TestQMMMinMolecule[source]
Bases:
object- test_atoms_in_levels_default_low_level(tmpdir, qmmm_written_xyz_file, qmmm_written_xyz_only_file, methyl3hexane_molecule)[source]
- class tests.test_structures.TestStructures[source]
Bases:
object- test_read_crestopt_log_as_xyz(crest_octane_outfolder)[source]
crestopt.log is XYZ with .log extension.
- class tests.test_structures.TestStructuresFromGaussianInput[source]
Bases:
object
- class tests.test_structures.TestpKaCDXFile[source]
Bases:
object- test_detect_proton_in_fragment_explicit_h(colored_proton_two_molecule_cdxml_file)[source]
_detect_proton_in_fragment finds explicit H in each fragment.
- test_detect_proton_in_fragment_uniform_color_raises(single_molecule_cdxml_file_benzene)[source]
_detect_proton_in_fragment raises when all atoms share a colour.
- test_fragment_colors_match_flat_colors(colored_proton_cdxml_file)[source]
Fragment colours concatenated should match the flat parse_cdxml_element_colors output.
- test_functional_group_proton_user_color_phenol(colored_implicit_proton_cdxml_file)[source]
User-specified colour for phenol implicit OH hydrogen.
- test_get_colored_proton_index_auto_detect(colored_proton_cdxml_file)[source]
Test auto-detection of uniquely coloured proton when that proton appears as an explicit node (default mode).
- test_get_colored_proton_index_invalid_color_code_raises(colored_implicit_proton_cdxml_file)[source]
Test that specifying a non-existent colour code raises.
- test_get_colored_proton_index_multiple_atoms_same_color_raises(complex_molecule_cdxml_file)[source]
Test that specifying a colour shared by non-H atoms raises.
- test_get_colored_proton_index_no_hydrogen_raises(complex_molecule_cdxml_file)[source]
Test that auto-detect raises when coloured atoms are not hydrogen.
- test_get_colored_proton_index_no_unique_color_raises(single_molecule_cdxml_file_benzene)[source]
Test that auto-detect raises when all atoms share the same colour.
- test_get_colored_proton_index_user_specified(colored_proton_cdxml_file)[source]
Test user-specified colour mode with phenol functional-group H.
Colour 4 is the implicit-H span colour in the phenol OH label.
- test_get_pka_molecule_explicit_proton_index(colored_proton_cdxml_file)[source]
Test that an explicit proton_index bypasses colour detection.
- test_get_pka_molecules_auto_implicit_h(colored_implicit_proton_cdxml_file)[source]
Auto-detection handles implicit/functional-group H (phenol OH).
- test_get_pka_molecules_auto_nested_fragment_groups(pka_scale_cdxml_file)[source]
Nested ChemDraw fragment groups resolve coloured acidic protons.
- test_get_pka_molecules_auto_single_fragment(colored_proton_cdxml_file)[source]
get_pka_molecules_auto returns one PKaMolecule for a single-fragment file.
- test_get_pka_molecules_auto_two_fragments(colored_proton_two_molecule_cdxml_file)[source]
get_pka_molecules_auto returns two PKaMolecules with independent proton detection.
- test_get_pka_molecules_delegates_to_auto(colored_proton_two_molecule_cdxml_file)[source]
get_pka_molecules() with index=’:’ and no proton args delegates to get_pka_molecules_auto().
- test_get_pka_molecules_with_explicit_proton_index(colored_proton_two_molecule_cdxml_file)[source]
get_pka_molecules with explicit proton_index applies the same index to all fragments.
- test_implicit_proton_removal_phenol(colored_implicit_proton_cdxml_file)[source]
End-to-end: detect phenol OH proton by colour, remove it.
Phenol (C6H6O, 13 atoms) → phenoxide (C6H5O, 12 atoms). The OH hydrogen is an implicit H on the O node, identified via the coloured “H” span in the label.
- test_parse_cdxml_atom_colors(colored_implicit_proton_cdxml_file)[source]
Test that atom colours are parsed correctly from phenol.cdxml.
Phenol has 7 CDXML atoms (6 C + 1 O). The O node carries the label
<s color="0">O</s><s color="4">H</s>– the “H” is rendered in colour 4 while the heavy atom keeps colour 0.parse_cdxml_atom_colorsmust record this inimplicit_h_color.
- test_parse_cdxml_atom_colors_benzene_no_color(single_molecule_cdxml_file_benzene)[source]
Test parsing benzene CDXML where all atoms have the same colour.
- test_parse_cdxml_fragment_colors_single_fragment(colored_proton_cdxml_file)[source]
parse_cdxml_fragment_colors returns one sub-list for single-fragment files.
tests.test_utils module
- class tests.test_utils.TestDeduplicateStringKeywords[source]
Bases:
objectTests for deduplicate_string_keywords utility function.
- test_args_and_bare_keyword_keeps_args_form()[source]
When keyword(args) appears before the bare keyword, keyword(args) is kept.
- test_bare_and_args_keyword_keeps_args_form()[source]
When bare keyword and keyword(args) both appear, keyword(args) is kept.
- test_bare_keyword_duplicate_keeps_first()[source]
When a bare keyword appears twice, the first occurrence is kept.
- test_empty_keywords_list_returns_unchanged()[source]
Route string is returned unchanged when keywords is an empty list.
- test_empty_keywords_returns_unchanged()[source]
Route string is returned unchanged when keywords is empty.
- test_empty_route_string_returns_unchanged()[source]
Empty route string is returned as-is regardless of keywords.
- test_keyword_not_present_returns_unchanged()[source]
Route string is returned unchanged when the keyword is not present.
- test_keyword_with_longer_args_preferred_over_shorter()[source]
When keyword appears twice with args, the longer args form is kept.
- test_mixed_case_keyword_argument()[source]
The keyword argument itself is matched case-insensitively.
- test_no_duplicates_returns_unchanged()[source]
Route string without duplicates is returned unchanged.
- test_three_bare_duplicates_keeps_first()[source]
When a bare keyword appears three times, only the first is kept.
Tokens not in the keyword list are always preserved.
- class tests.test_utils.TestPKaTableParsing[source]
Bases:
objectTests for the pKa table parsing utility functions.
- test_discover_pka_reference_companion_outputs(tmp_path)[source]
analyze should discover HRef companion files from the HRef gas output.
- test_discover_pka_target_companion_outputs_matches_batch_suffixes(tmp_path)[source]
analyze auto-discovery should use the same suffixes as batch-analyze.
- test_echo_pka_output_table_results_writes_same_table_to_file(tmp_path)[source]
batch-analyze -O should write the same table echoed to stdout.
- test_export_pka_results_table_direct_scheme(tmp_path)[source]
Direct-cycle export uses the ΔG_diss column label.
- test_export_pka_results_table_matches_stdout_format(tmp_path)[source]
-O output should match the formatted batch table printed to stdout.
- test_parse_and_resolve_multi_row_table(tmp_path)[source]
End-to-end test: parse → resolve → validate on a multi-row table.
- test_parse_pka_output_table_alias_columns(tmp_path)[source]
Test that aliased column names (e.g., HA_optimization_output) work.
- test_parse_pka_output_table_csv(tmp_path)[source]
Test parsing a CSV output table with canonical column names.
- test_parse_pka_output_table_empty(tmp_path)[source]
Test that an empty output table raises ValueError.
- test_parse_pka_output_table_empty_cells_become_none(tmp_path)[source]
Blank CSV cells must not remain as float NaN in parsed entries.
- test_parse_pka_output_table_file_not_found()[source]
Test that a missing table file raises FileNotFoundError.
- test_parse_pka_table_blank_proton_index_for_cdxml(tmp_path, colored_proton_cdxml_file)[source]
Blank proton_index is allowed for single-molecule CDXML table rows.
- test_parse_pka_table_blank_proton_index_for_xyz_raises(tmp_path)[source]
Blank proton_index is rejected for non-CDXML table rows.
- test_parse_pka_table_invalid_column_count(tmp_path)[source]
Test that invalid column count raises ValueError.
- test_parse_pka_table_invalid_integer(tmp_path)[source]
Test that invalid integer values raise ValueError.
- test_parse_pka_table_skip_comments_and_empty_lines(tmp_path)[source]
Test that comments and empty lines are skipped.
- test_pka_output_table_entry_resolve_filenames_gaussian_log(tmp_path, monkeypatch)[source]
Blank result-file cells resolve to Gaussian <basename>_<suffix>.log files.
- test_pka_output_table_entry_resolve_filenames_orca_default_extension(tmp_path, monkeypatch)[source]
ORCA reference paths default missing basename outputs to .out.
- test_pka_output_table_entry_resolve_filenames_orca_out(tmp_path, monkeypatch)[source]
Blank result-file cells resolve to ORCA <basename>_<suffix>.out files.
- test_pka_output_table_entry_validate_missing_basename()[source]
Test validation catches missing basename.
- test_pka_output_table_entry_validate_missing_file(tmp_path)[source]
Test validation catches missing files.
- test_pka_output_table_entry_validate_valid(tmp_path)[source]
Test validation passes for a complete, valid entry.
- test_pka_output_table_prepare_autodetects_files_and_inherits_references(tmp_path, monkeypatch)[source]
prepare() auto-discovers output files and carries forward references.
- test_pka_output_table_run_pka(tmp_path)[source]
PKaOutputTable owns parsing, validation, and pKa execution.
- test_pka_output_table_run_pka_direct(tmp_path)[source]
PKaOutputTable supports direct-cycle batch analysis.
- test_pka_table_entry_alias_resolution(tmp_path)[source]
Alias resolution should keep backward-compatible attribute access.
- test_pka_table_entry_dict_and_kwargs_helpers()[source]
to_dict/to_kwargs should support forwarding to downstream settings.
- test_pka_table_entry_validate_invalid_multiplicity(tmp_path)[source]
Test PKaTableEntry validation catches invalid multiplicity.
- test_pka_table_entry_validate_invalid_proton_index(tmp_path)[source]
Test PKaTableEntry validation catches invalid proton_index.
- test_pka_table_entry_validate_missing_file(tmp_path)[source]
Test PKaTableEntry validation catches missing files.
- test_resolve_pka_output_references_carry_forward(tmp_path)[source]
Test that blank reference cells are filled from the previous row.
- test_resolve_pka_output_references_first_row_blank_raises()[source]
Test that blank reference in first row raises ValueError.
- class tests.test_utils.TestParseIndexSpecification[source]
Bases:
objectTests for the new unified parse_index_specification function.
- test_parse_index_boundary_detection_disabled()[source]
Test boundary detection when allow_out_of_range=False.
- test_parse_index_boundary_detection_enabled()[source]
Test boundary detection when allow_out_of_range=True.
- test_parse_index_duplicate_detection_disabled()[source]
Test duplicate detection when allow_duplicates=False.
- class tests.test_utils.TestReturnObjectsAndIndicesFromStringIndex[source]
Bases:
objectTests for the return_objects_and_indices_from_string_index utility function.
- test_index_zero_raises_value_error()[source]
Test that index 0 raises ValueError (1-based indexing required).
- class tests.test_utils.TestRunCommand[source]
Bases:
objectTests for the run_command utility function.
- test_command_exception(mock_popen, capture_log)[source]
Test handling an exception during command execution.
- test_command_failure(mock_popen, capture_log)[source]
Test running a command that fails with non-zero return code.
- test_invalid_input_type(capture_log)[source]
Test handling invalid input type (neither string nor list).
- test_list_command_success(mock_popen)[source]
Test running a command provided as a list with successful execution.
- class tests.test_utils.TestUtils[source]
Bases:
object- test_cmp_with_ignore_string(gaussian_written_sp_from_nhc_singlet_log_with_custom_basis_from_api_file, gaussian_written_sp_from_nhc_singlet_log_with_custom_basis_from_api_file_v2)[source]