geom.tests.test_ ================ .. py:module:: geom.tests.test_ Attributes ---------- .. autoapisummary:: geom.tests.test_.test_folder_path Functions --------- .. autoapisummary:: geom.tests.test_.test_remove_duplicate_xyz_preserves_first_atom_labels geom.tests.test_.move_input_geom geom.tests.test_.move_managed_geom geom.tests.test_.move_created_geom geom.tests.test_.compare_mesh_files geom.tests.test_.test_create_sphere geom.tests.test_.test_rdkit_optimization geom.tests.test_.test_create_sphere_core_shell geom.tests.test_.test_create_rod geom.tests.test_.test_create_rod_core_shell geom.tests.test_.test_create_tip geom.tests.test_.test_create_pyramid geom.tests.test_.test_create_cone geom.tests.test_.test_create_icosahedra geom.tests.test_.test_create_cuboctahedra geom.tests.test_.test_create_decahedra geom.tests.test_.test_create_microscope geom.tests.test_.test_create_graphene_ribbon geom.tests.test_.test_create_graphene_disk geom.tests.test_.test_create_graphene_ring geom.tests.test_.test_create_graphene_triangle_armchair geom.tests.test_.test_create_graphene_triangle_zigzag geom.tests.test_.test_specular_geometry geom.tests.test_.test_controlled_distance geom.tests.test_.test_controlled_rotation geom.tests.test_.test_create_dimer geom.tests.test_.test_create_bowtie Module Contents --------------- .. py:data:: test_folder_path :value: b'.' .. py:function:: test_remove_duplicate_xyz_preserves_first_atom_labels() Tests that duplicate XYZ entries are removed while keeping atom labels aligned. .. py:function:: move_input_geom(folder, geom_file, optional_file=None) Moves the input geometry file into the scratch folder. :param folder: The folder where the input file is located. :type folder: str :param geom_file: The name of the input geometry file to be moved. :type geom_file: str :param optional_file: An additional file to move if provided. :type optional_file: str, optional :returns: The function executes shell commands to move files. :rtype: None .. rubric:: Notes - Uses `os.system` to copy files. - If an optional file is provided, it is also copied. .. py:function:: move_managed_geom(folder, remove_optional_file=None) Moves managed geometry files to the specified folder and removes temporary files. :param folder: The destination folder for the created geometry files. :type folder: str :param remove_optional_file: A specific file to be removed if provided. :type remove_optional_file: str, optional :returns: The function executes shell commands to move and remove files. :rtype: None .. rubric:: Notes - Moves generated `.xyz` files from `results_geom` to the specified folder. - Deletes temporary geometry files and the `results_geom` directory. .. py:function:: move_created_geom(folder) Moves the generated geometry files to the specified folder and removes temporary files. :param folder: The destination folder for the created geometry files. :type folder: str :returns: The function executes shell commands to move and remove files. :rtype: None .. rubric:: Notes - Moves all generated files from `results_geom` to the specified folder. - Deletes the `results_geom` directory afterward. .. py:function:: compare_mesh_files(file1: str, file2: str, tol: float = 1e-10) -> bool Compare two .msh files while allowing small floating-point differences. This function reads two mesh files and compares them line by line. It ignores non-numeric headers (lines starting with "$") and allows numerical differences within a specified tolerance (`tol`). Non-numeric values (e.g., node indices) are compared strictly. :param file1: Path to the first .msh file (generated mesh). :type file1: str :param file2: Path to the second .msh file (reference mesh). :type file2: str :param tol: Absolute tolerance for floating-point comparisons. Defaults to 1e-10. :type tol: float, optional :returns: True if the files match within the tolerance, False otherwise. :rtype: bool :raises AssertionError: If the files differ in length, structure, or values :raises outside the specified tolerance.: .. py:function:: test_create_sphere(monkeypatch) Tests the generation of a spherical geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of generated output. :rtype: None .. rubric:: Notes - Mocks command-line arguments for sphere creation. - Runs the geometry creation process. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_rdkit_optimization(monkeypatch) Tests the optimization of a molecular structure using RDKit and compares the result with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate that the optimized molecular structure matches the expected reference output. :rtype: None .. rubric:: Notes - Mocks command-line arguments to perform an RDKit-based molecular optimization. - Temporarily moves the input `.smi` file into the test directory. - Executes the optimization routine using the specified force field (e.g., MMFF94s). - Moves the generated files back to their managed location after execution. - Compares the generated `.sdf` file with an expected reference file. .. py:function:: test_create_sphere_core_shell(monkeypatch) Tests the generation of a sphere core-shell geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for core-shell sphere creation. - Runs the geometry creation process. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_create_rod(monkeypatch) Tests the generation of a rod geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for rod creation. - Runs the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_create_rod_core_shell(monkeypatch) Tests the generation of a rod core-shell geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for core-shell rod creation. - Runs the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_create_tip(monkeypatch) Tests the generation of a tip geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for tip creation. - Runs the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_create_pyramid(monkeypatch) Tests the generation of a pyramid geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for pyramid creation. - Runs the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_create_cone(monkeypatch) Tests the generation of a cone geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for cone creation. - Runs the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_create_icosahedra(monkeypatch) Tests the generation of an icosahedral geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for icosahedral geometry creation. - Runs the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_create_cuboctahedra(monkeypatch) Tests the generation of a cuboctahedral geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for cuboctahedral geometry creation. - Runs the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_create_decahedra(monkeypatch) Tests the generation of a decahedral geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for decahedral geometry creation. - Runs the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_create_microscope(monkeypatch) Tests the generation of a microscope geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for microscope geometry creation. - Runs the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_create_graphene_ribbon(monkeypatch) Tests the generation of a graphene ribbon geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for graphene ribbon creation. - Runs the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_create_graphene_disk(monkeypatch) Tests the generation of a graphene disk geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for graphene disk creation. - Runs the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_create_graphene_ring(monkeypatch) Tests the generation of a graphene ring geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for graphene ring creation. - Runs the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_create_graphene_triangle_armchair(monkeypatch) Tests the generation of a graphene triangle (armchair type) geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for graphene armchair triangle creation. - Runs the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_create_graphene_triangle_zigzag(monkeypatch) Tests the generation of a graphene triangle (zigzag type) geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for graphene zigzag triangle creation. - Runs the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_specular_geometry(monkeypatch) Tests the creation of a specular (mirrored) geometry and compares it with a reference file. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for mirroring a geometry. - Moves the input file temporarily. - Runs the mirroring process. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_controlled_distance(monkeypatch) Tests the controlled translation of a molecule to maintain a specific distance. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for controlled distance translation. - Moves the input file temporarily. - Runs the translation process. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_controlled_rotation(monkeypatch) Tests the controlled rotation of a molecule along a specified axis. :param monkeypatch: A fixture to modify `sys.argv`. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to validate the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for controlled rotation. - Moves the input file temporarily. - Runs the rotation process. - Compares the generated `.xyz` file with an expected reference file. .. py:function:: test_create_dimer(monkeypatch) Tests the creation of a dimer geometry and validates it against a reference file. :param monkeypatch: A fixture to modify `sys.argv` for command-line argument simulation. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to verify the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for dimer creation with a conical base structure. - Initializes and populates the input class. - Executes the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file against an expected reference file. .. py:function:: test_create_bowtie(monkeypatch) Tests the creation of a bowtie geometry and validates it against a reference file. :param monkeypatch: A fixture to modify `sys.argv` for command-line argument simulation. :type monkeypatch: pytest.MonkeyPatch :returns: Uses assertions to verify the correctness of the generated `.xyz` file. :rtype: None .. rubric:: Notes - Mocks command-line arguments for bowtie creation with a conical base structure. - Initializes and populates the input class. - Executes the geometry creation process. - Moves the created geometry files to the test folder. - Compares the generated `.xyz` file against an expected reference file.