diff --git a/src/quacc/atoms/skzcam.py b/src/quacc/atoms/skzcam.py index 7315d7cbb6..606c2687ec 100644 --- a/src/quacc/atoms/skzcam.py +++ b/src/quacc/atoms/skzcam.py @@ -250,20 +250,20 @@ def generate_input(self) -> BlockInfo: """ # Create the blocks for the basis sets (basis, basis_sm, dfbasis_scf, dfbasis_cor, ecp) - self.generate_basis_ecp_block() + self._generate_basis_ecp_block() # Create the blocks for the coordinates - self.generate_coords_block() + self._generate_coords_block() # Create the point charge block and add it to the adsorbate-slab complex and slab blocks - point_charge_block = self.generate_point_charge_block() + point_charge_block = self._generate_point_charge_block() self.mrccblocks["adsorbate_slab"] += point_charge_block self.mrccblocks["slab"] += point_charge_block # Combine the blocks return self.mrccblocks - def generate_basis_ecp_block(self) -> None: + def _generate_basis_ecp_block(self) -> None: """ Generates the basis and ECP block for the MRCC input file. @@ -276,16 +276,16 @@ def generate_basis_ecp_block(self) -> None: def _create_basis_block(quantum_region, ecp_region=None): return f""" basis_sm=atomtype -{self.create_atomtype_basis(quantum_region=quantum_region, ecp_region=ecp_region, element_basis_info={element: 'def2-SVP' for element in self.element_info})} +{self._create_atomtype_basis(quantum_region=quantum_region, ecp_region=ecp_region, element_basis_info={element: 'def2-SVP' for element in self.element_info})} basis=atomtype -{self.create_atomtype_basis(quantum_region=quantum_region, ecp_region=ecp_region, element_basis_info={element: self.element_info[element]['basis'] for element in self.element_info})} +{self._create_atomtype_basis(quantum_region=quantum_region, ecp_region=ecp_region, element_basis_info={element: self.element_info[element]['basis'] for element in self.element_info})} dfbasis_scf=atomtype -{self.create_atomtype_basis(quantum_region=quantum_region, ecp_region=ecp_region, element_basis_info={element: self.element_info[element]['ri_scf_basis'] for element in self.element_info})} +{self._create_atomtype_basis(quantum_region=quantum_region, ecp_region=ecp_region, element_basis_info={element: self.element_info[element]['ri_scf_basis'] for element in self.element_info})} dfbasis_cor=atomtype -{self.create_atomtype_basis(quantum_region=quantum_region, ecp_region=ecp_region, element_basis_info={element: self.element_info[element]['ri_cwft_basis'] for element in self.element_info})} +{self._create_atomtype_basis(quantum_region=quantum_region, ecp_region=ecp_region, element_basis_info={element: self.element_info[element]['ri_cwft_basis'] for element in self.element_info})} """ if self.include_cp: @@ -309,7 +309,7 @@ def _create_basis_block(quantum_region, ecp_region=None): quantum_region=self.adsorbate_cluster, ecp_region=None ) - def create_atomtype_basis( + def _create_atomtype_basis( self, quantum_region: Atoms, element_basis_info: dict[ElementStr, str], @@ -341,7 +341,7 @@ def create_atomtype_basis( return basis_str - def generate_coords_block(self) -> None: + def _generate_coords_block(self) -> None: """ Generates the coordinates block for the MRCC input file. This includes the coordinates of the quantum cluster, the ECP region, and the point charges. It will return three strings for the adsorbate-slab complex, adsorbate and slab. @@ -448,7 +448,7 @@ def generate_coords_block(self) -> None: self.mrccblocks["slab"] += create_atom_coord_string(atom=atom) self.mrccblocks["slab"] += ecp_region_block - def generate_point_charge_block(self) -> str: + def _generate_point_charge_block(self) -> str: """ Create the point charge block for the MRCC input file. This requires the embedded_cluster Atoms object containing both atom_type and oxi_states arrays, as well as the indices of the quantum cluster and ECP region. Such arrays are created by the [quacc.atoms.skzcam.CreateSKZCAMClusters][] class. @@ -585,15 +585,52 @@ def generate_input(self) -> None: """ # First generate the preamble block - self.generate_preamble_block() + self._generate_preamble_block() # Create the blocks for the coordinates - self.generate_coords_block() + self._generate_coords_block() # Combine the blocks return self.orcablocks - def generate_coords_block(self) -> None: + def create_point_charge_file(self, pc_file: str | Path) -> None: + """ + Create a point charge file that can be read by ORCA. This requires the embedded_cluster Atoms object containing both atom_type and oxi_states arrays, as well as the indices of the quantum cluster and ECP region. + + Parameters + ---------- + pc_file + A file containing the point charges to be written by ORCA. + + Returns + ------- + None + """ + + # Get the oxi_states arrays from the embedded_cluster + oxi_states = self.adsorbate_slab_embedded_cluster.get_array("oxi_states") + + # Get the number of point charges for this system + total_indices = self.quantum_cluster_indices + self.ecp_region_indices + num_pc = len(self.adsorbate_slab_embedded_cluster) - len(total_indices) + counter = 0 + with Path.open(pc_file, "w") as f: + # Write the number of point charges first + f.write(f"{num_pc}\n") + for i in range(len(self.adsorbate_slab_embedded_cluster)): + if i not in total_indices: + counter += 1 + position = self.adsorbate_slab_embedded_cluster[i].position + if counter != num_pc: + f.write( + f"{oxi_states[i]:-16.11f} {position[0]:-16.11f} {position[1]:-16.11f} {position[2]:-16.11f}\n" + ) + else: + f.write( + f"{oxi_states[i]:-16.11f} {position[0]:-16.11f} {position[1]:-16.11f} {position[2]:-16.11f}" + ) + + def _generate_coords_block(self) -> None: """ Generates the coordinates block for the ORCA input file. This includes the coordinates of the quantum cluster, the ECP region, and the point charges. It will return three strings for the adsorbate-slab complex, adsorbate and slab. @@ -649,7 +686,7 @@ def generate_coords_block(self) -> None: # Create the coords section for the ECP region ecp_region_coords_section = "" for i, atom in enumerate(self.ecp_region): - atom_ecp_info = self.format_ecp_info( + atom_ecp_info = self._format_ecp_info( atom_ecp_info=self.ecp_info[atom.symbol] ) ecp_region_coords_section += create_atom_coord_string( @@ -663,7 +700,7 @@ def generate_coords_block(self) -> None: self.orcablocks["slab"] += f"{ecp_region_coords_section}end\nend\n" self.orcablocks["adsorbate"] += "end\nend\n" - def format_ecp_info(self, atom_ecp_info: str) -> str: + def _format_ecp_info(self, atom_ecp_info: str) -> str: """ Formats the ECP info so that it can be inputted to ORCA without problems. @@ -690,7 +727,7 @@ def format_ecp_info(self, atom_ecp_info: str) -> str: # Extract content between "NewECP" and "end", exclusive of "end", then add correctly formatted "NewECP" and "end" return f"NewECP\n{atom_ecp_info[start_pos:end_pos].strip()}\nend\n" - def generate_preamble_block(self) -> str: + def _generate_preamble_block(self) -> str: """ From the quantum cluster Atoms object, generate the ORCA input preamble for the basis, method, pal, and scf blocks. @@ -809,86 +846,7 @@ def generate_preamble_block(self) -> str: self.orcablocks["adsorbate"] += preamble_input self.orcablocks["slab"] += preamble_input - def create_point_charge_file(self, pc_file: str | Path) -> None: - """ - Create a point charge file that can be read by ORCA. This requires the embedded_cluster Atoms object containing both atom_type and oxi_states arrays, as well as the indices of the quantum cluster and ECP region. - - Parameters - ---------- - pc_file - A file containing the point charges to be written by ORCA. - - Returns - ------- - None - """ - - # Get the oxi_states arrays from the embedded_cluster - oxi_states = self.adsorbate_slab_embedded_cluster.get_array("oxi_states") - - # Get the number of point charges for this system - total_indices = self.quantum_cluster_indices + self.ecp_region_indices - num_pc = len(self.adsorbate_slab_embedded_cluster) - len(total_indices) - counter = 0 - with Path.open(pc_file, "w") as f: - # Write the number of point charges first - f.write(f"{num_pc}\n") - for i in range(len(self.adsorbate_slab_embedded_cluster)): - if i not in total_indices: - counter += 1 - position = self.adsorbate_slab_embedded_cluster[i].position - if counter != num_pc: - f.write( - f"{oxi_states[i]:-16.11f} {position[0]:-16.11f} {position[1]:-16.11f} {position[2]:-16.11f}\n" - ) - else: - f.write( - f"{oxi_states[i]:-16.11f} {position[0]:-16.11f} {position[1]:-16.11f} {position[2]:-16.11f}" - ) - - -def create_atom_coord_string( - atom: Atom, - is_ghost_atom: bool = False, - atom_ecp_info: str | None = None, - pc_charge: float | None = None, -) -> str: - """ - Creates a string containing the Atom symbol and coordinates for both MRCC and ORCA, with additional information for atoms in the ECP region as well as ghost atoms. - - Parameters - ---------- - atom - The ASE Atom (not Atoms) object containing the atomic coordinates. - is_ghost_atom - If True, then the atom is a ghost atom. - atom_ecp_info - If not None, then assume this is an atom in the ECP region and adds the ECP info. - pc_charge - The point charge value for the ECP region atom. - - Returns - ------- - str - The atom symbol and coordinates in the ORCA input file format. - """ - - # If ecp_info is not None and ghost_atom is True, raise an error - if atom_ecp_info and is_ghost_atom: - raise ValueError("ECP info cannot be provided for ghost atoms.") - - # Check that pc_charge is a float if atom_ecp_info is not None - if atom_ecp_info and pc_charge is None: - raise ValueError("Point charge value must be given for atoms with ECP info.") - - if is_ghost_atom: - atom_coord_str = f"{(atom.symbol + ':').ljust(3)} {' '*16} {atom.position[0]:-16.11f} {atom.position[1]:-16.11f} {atom.position[2]:-16.11f}\n" - elif atom_ecp_info is not None: - atom_coord_str = f"{(atom.symbol + '>').ljust(3)} {pc_charge:-16.11f} {atom.position[0]:-16.11f} {atom.position[1]:-16.11f} {atom.position[2]:-16.11f}\n{atom_ecp_info}" - else: - atom_coord_str = f"{atom.symbol.ljust(3)} {' '*16} {atom.position[0]:-16.11f} {atom.position[1]:-16.11f} {atom.position[2]:-16.11f}\n" - return atom_coord_str class CreateSKZCAMClusters: @@ -955,6 +913,113 @@ def __init__( self.quantum_cluster_indices = None self.ecp_region_indices = None + def convert_slab_to_atoms(self) -> None: + """ + Read the file containing the periodic slab and adsorbate (geometry optimized) and format the resulting Atoms object to be used to create a .pun file in ChemShell. + + Returns + ------- + None + """ + + # Get the necessary information for the cluster from a provided slab file (in any format that ASE can read) + adsorbate_slab = read(self.adsorbate_slab_file) + + # Find indices (within adsorbate_slab) of the slab + slab_indices = self.slab_center_indices + [ + i + for i, _ in enumerate(adsorbate_slab) + if i not in (self.adsorbate_indices + self.slab_center_indices) + ] + + # Create adsorbate and slab from adsorbate_slab + slab = adsorbate_slab[slab_indices] + adsorbate = adsorbate_slab[self.adsorbate_indices] + + adsorbate.translate(-slab[0].position) + slab.translate(-slab[0].position) + + # Get the relative distance of the adsorbate from the first center atom of the slab as defined in the slab_center_indices + adsorbate_vector_from_slab = adsorbate[0].position - slab[0].position + + # Get the center of the cluster from the slab_center_indices + slab_center_position = slab[ + : len(self.slab_center_indices) + ].get_positions().sum(axis=0) / len(self.slab_center_indices) + + # Add the height of the adsorbate from the slab along the z-direction relative to the slab_center + adsorbate_com_z_disp = ( + adsorbate.get_center_of_mass()[2] - slab_center_position[2] + ) + + center_position = ( + np.array([0.0, 0.0, adsorbate_com_z_disp]) + slab_center_position + ) + + self.adsorbate = adsorbate + self.slab = slab + self.adsorbate_slab = adsorbate_slab + self.adsorbate_vector_from_slab = adsorbate_vector_from_slab + self.center_position = center_position + + @requires(has_chemshell, "ChemShell is not installed") + def run_chemshell( + self, + filepath: str | Path, + chemsh_radius_active: float = 40.0, + chemsh_radius_cluster: float = 60.0, + chemsh_bq_layer: float = 6.0, + write_xyz_file: bool = False, + ) -> None: + """ + Run ChemShell to create an embedded cluster from a slab. + + Parameters + ---------- + filepath + The location where the ChemShell output files will be written. + chemsh_radius_active + The radius of the active region in Angstroms. This 'active' region is simply region where the charge fitting is performed to ensure correct Madelung potential; it can be a relatively large value. + chemsh_radius_cluster + The radius of the total embedded cluster in Angstroms. + chemsh_bq_layer + The height above the surface to place some additional fitting point charges in Angstroms; simply for better reproduction of the electrostatic potential close to the adsorbate. + write_xyz_file + Whether to write an XYZ file of the cluster for visualisation. + + Returns + ------- + None + """ + from chemsh.io.tools import convert_atoms_to_frag + + # Convert ASE Atoms to ChemShell Fragment object + slab_frag = convert_atoms_to_frag(self.slab, connect_mode="ionic", dim="2D") + + # Add the atomic charges to the fragment + slab_frag.addCharges(self.atom_oxi_states) + + # Create the chemshell cluster (i.e., add electrostatic fitting charges) from the fragment + chemsh_slab_embedded_cluster = slab_frag.construct_cluster( + origin=0, + radius_cluster=chemsh_radius_cluster / Bohr, + radius_active=chemsh_radius_active / Bohr, + bq_layer=chemsh_bq_layer / Bohr, + adjust_charge="coordination_scaled", + ) + + # Save the final cluster to a .pun file + chemsh_slab_embedded_cluster.save( + filename=Path(filepath).with_suffix(".pun"), fmt="pun" + ) + self.pun_file = Path(filepath).with_suffix(".pun") + + if write_xyz_file: + # XYZ for visualisation + chemsh_slab_embedded_cluster.save( + filename=Path(filepath).with_suffix(".xyz"), fmt="xyz" + ) + def run_skzcam( self, shell_max: int = 10, @@ -991,7 +1056,7 @@ def run_skzcam( """ # Read the .pun file and create the embedded_cluster Atoms object - self.slab_embedded_cluster = self.convert_pun_to_atoms(pun_file=self.pun_file) + self.slab_embedded_cluster = self._convert_pun_to_atoms(pun_file=self.pun_file) # Get distances of all atoms from the cluster center atom_center_distances = _get_atom_distances( @@ -1041,7 +1106,7 @@ def run_skzcam( ) # Create the adsorbate_slab_embedded_cluster from slab_embedded_cluster and adsorbate atoms objects. This also sets the final quantum_cluster_indices and ecp_region_indices for the adsorbate_slab_embedded_cluster - self.create_adsorbate_slab_embedded_cluster( + self._create_adsorbate_slab_embedded_cluster( quantum_cluster_indices=slab_quantum_cluster_indices, ecp_region_indices=slab_ecp_region_indices, ) @@ -1065,114 +1130,7 @@ def run_skzcam( cluster_atoms, ) - @requires(has_chemshell, "ChemShell is not installed") - def run_chemshell( - self, - filepath: str | Path, - chemsh_radius_active: float = 40.0, - chemsh_radius_cluster: float = 60.0, - chemsh_bq_layer: float = 6.0, - write_xyz_file: bool = False, - ) -> None: - """ - Run ChemShell to create an embedded cluster from a slab. - - Parameters - ---------- - filepath - The location where the ChemShell output files will be written. - chemsh_radius_active - The radius of the active region in Angstroms. This 'active' region is simply region where the charge fitting is performed to ensure correct Madelung potential; it can be a relatively large value. - chemsh_radius_cluster - The radius of the total embedded cluster in Angstroms. - chemsh_bq_layer - The height above the surface to place some additional fitting point charges in Angstroms; simply for better reproduction of the electrostatic potential close to the adsorbate. - write_xyz_file - Whether to write an XYZ file of the cluster for visualisation. - - Returns - ------- - None - """ - from chemsh.io.tools import convert_atoms_to_frag - - # Convert ASE Atoms to ChemShell Fragment object - slab_frag = convert_atoms_to_frag(self.slab, connect_mode="ionic", dim="2D") - - # Add the atomic charges to the fragment - slab_frag.addCharges(self.atom_oxi_states) - - # Create the chemshell cluster (i.e., add electrostatic fitting charges) from the fragment - chemsh_slab_embedded_cluster = slab_frag.construct_cluster( - origin=0, - radius_cluster=chemsh_radius_cluster / Bohr, - radius_active=chemsh_radius_active / Bohr, - bq_layer=chemsh_bq_layer / Bohr, - adjust_charge="coordination_scaled", - ) - - # Save the final cluster to a .pun file - chemsh_slab_embedded_cluster.save( - filename=Path(filepath).with_suffix(".pun"), fmt="pun" - ) - self.pun_file = Path(filepath).with_suffix(".pun") - - if write_xyz_file: - # XYZ for visualisation - chemsh_slab_embedded_cluster.save( - filename=Path(filepath).with_suffix(".xyz"), fmt="xyz" - ) - - def convert_slab_to_atoms(self) -> None: - """ - Read the file containing the periodic slab and adsorbate (geometry optimized) and format the resulting Atoms object to be used to create a .pun file in ChemShell. - - Returns - ------- - None - """ - - # Get the necessary information for the cluster from a provided slab file (in any format that ASE can read) - adsorbate_slab = read(self.adsorbate_slab_file) - - # Find indices (within adsorbate_slab) of the slab - slab_indices = self.slab_center_indices + [ - i - for i, _ in enumerate(adsorbate_slab) - if i not in (self.adsorbate_indices + self.slab_center_indices) - ] - - # Create adsorbate and slab from adsorbate_slab - slab = adsorbate_slab[slab_indices] - adsorbate = adsorbate_slab[self.adsorbate_indices] - - adsorbate.translate(-slab[0].position) - slab.translate(-slab[0].position) - - # Get the relative distance of the adsorbate from the first center atom of the slab as defined in the slab_center_indices - adsorbate_vector_from_slab = adsorbate[0].position - slab[0].position - - # Get the center of the cluster from the slab_center_indices - slab_center_position = slab[ - : len(self.slab_center_indices) - ].get_positions().sum(axis=0) / len(self.slab_center_indices) - - # Add the height of the adsorbate from the slab along the z-direction relative to the slab_center - adsorbate_com_z_disp = ( - adsorbate.get_center_of_mass()[2] - slab_center_position[2] - ) - - center_position = ( - np.array([0.0, 0.0, adsorbate_com_z_disp]) + slab_center_position - ) - - self.adsorbate = adsorbate - self.slab = slab - self.adsorbate_slab = adsorbate_slab - self.adsorbate_vector_from_slab = adsorbate_vector_from_slab - self.center_position = center_position - - def convert_pun_to_atoms(self, pun_file: str | Path) -> Atoms: + def _convert_pun_to_atoms(self, pun_file: str | Path) -> Atoms: """ Reads a .pun file and returns an ASE Atoms object containing the atomic coordinates, point charges/oxidation states, and atom types. @@ -1255,7 +1213,7 @@ def convert_pun_to_atoms(self, pun_file: str | Path) -> Atoms: return slab_embedded_cluster - def create_adsorbate_slab_embedded_cluster( + def _create_adsorbate_slab_embedded_cluster( self, quantum_cluster_indices: list[list[int]] | None = None, ecp_region_indices: list[list[int]] | None = None, @@ -1478,3 +1436,47 @@ def _get_atom_distances(atoms: Atoms, center_position: NDArray) -> NDArray: """ return np.array([np.linalg.norm(atom.position - center_position) for atom in atoms]) + + +def create_atom_coord_string( + atom: Atom, + is_ghost_atom: bool = False, + atom_ecp_info: str | None = None, + pc_charge: float | None = None, +) -> str: + """ + Creates a string containing the Atom symbol and coordinates for both MRCC and ORCA, with additional information for atoms in the ECP region as well as ghost atoms. + + Parameters + ---------- + atom + The ASE Atom (not Atoms) object containing the atomic coordinates. + is_ghost_atom + If True, then the atom is a ghost atom. + atom_ecp_info + If not None, then assume this is an atom in the ECP region and adds the ECP info. + pc_charge + The point charge value for the ECP region atom. + + Returns + ------- + str + The atom symbol and coordinates in the ORCA input file format. + """ + + # If ecp_info is not None and ghost_atom is True, raise an error + if atom_ecp_info and is_ghost_atom: + raise ValueError("ECP info cannot be provided for ghost atoms.") + + # Check that pc_charge is a float if atom_ecp_info is not None + if atom_ecp_info and pc_charge is None: + raise ValueError("Point charge value must be given for atoms with ECP info.") + + if is_ghost_atom: + atom_coord_str = f"{(atom.symbol + ':').ljust(3)} {' '*16} {atom.position[0]:-16.11f} {atom.position[1]:-16.11f} {atom.position[2]:-16.11f}\n" + elif atom_ecp_info is not None: + atom_coord_str = f"{(atom.symbol + '>').ljust(3)} {pc_charge:-16.11f} {atom.position[0]:-16.11f} {atom.position[1]:-16.11f} {atom.position[2]:-16.11f}\n{atom_ecp_info}" + else: + atom_coord_str = f"{atom.symbol.ljust(3)} {' '*16} {atom.position[0]:-16.11f} {atom.position[1]:-16.11f} {atom.position[2]:-16.11f}\n" + + return atom_coord_str \ No newline at end of file diff --git a/tests/core/atoms/test_skzcam.py b/tests/core/atoms/test_skzcam.py index e2d320e4eb..ce779afd95 100644 --- a/tests/core/atoms/test_skzcam.py +++ b/tests/core/atoms/test_skzcam.py @@ -37,7 +37,7 @@ def skzcam_clusters(): @pytest.fixture() def slab_embedded_cluster(skzcam_clusters): - return skzcam_clusters.convert_pun_to_atoms( + return skzcam_clusters._convert_pun_to_atoms( pun_file=Path(FILE_DIR, "skzcam_files", "ChemShell_Cluster.pun.gz") ) @@ -193,7 +193,7 @@ def test_MRCCInputGenerator_init(adsorbate_slab_embedded_cluster, element_info): ) -def test_MRCCInputGenerator_create_eint_blocks(mrcc_input_generator): +def test_MRCCInputGenerator_generate_input(mrcc_input_generator): mrcc_input_generator_nocp = deepcopy(mrcc_input_generator) mrcc_input_generator_nocp.include_cp = False @@ -291,9 +291,9 @@ def test_MRCCInputGenerator_generate_basis_ecp_block(mrcc_input_generator): mrcc_input_generator_nocp = deepcopy(mrcc_input_generator) mrcc_input_generator_nocp.include_cp = False - mrcc_input_generator_nocp.generate_basis_ecp_block() + mrcc_input_generator_nocp._generate_basis_ecp_block() - mrcc_input_generator.generate_basis_ecp_block() + mrcc_input_generator._generate_basis_ecp_block() reference_mrcc_blocks_collated = { "adsorbate_slab": [ @@ -371,14 +371,14 @@ def test_MRCCInputGenerator_generate_basis_ecp_block(mrcc_input_generator): def test_MRCCInputGenerator_create_atomtype_basis(mrcc_input_generator): - generated_basis_block_without_ecp = mrcc_input_generator.create_atomtype_basis( + generated_basis_block_without_ecp = mrcc_input_generator._create_atomtype_basis( quantum_region=mrcc_input_generator.adsorbate_slab_cluster, element_basis_info={ element: mrcc_input_generator.element_info[element]["ri_cwft_basis"] for element in mrcc_input_generator.element_info }, ) - generated_basis_block_with_ecp = mrcc_input_generator.create_atomtype_basis( + generated_basis_block_with_ecp = mrcc_input_generator._create_atomtype_basis( quantum_region=mrcc_input_generator.adsorbate_slab_cluster, element_basis_info={ element: mrcc_input_generator.element_info[element]["ri_cwft_basis"] @@ -398,9 +398,9 @@ def test_MRCCInputGenerator_generate_coords_block(mrcc_input_generator): mrcc_input_generator_nocp = deepcopy(mrcc_input_generator) mrcc_input_generator_nocp.include_cp = False - mrcc_input_generator_nocp.generate_coords_block() + mrcc_input_generator_nocp._generate_coords_block() - mrcc_input_generator.generate_coords_block() + mrcc_input_generator._generate_coords_block() reference_block_collated = { "adsorbate_slab": { @@ -509,7 +509,7 @@ def test_MRCCInputGenerator_generate_coords_block(mrcc_input_generator): def test_MRCCInputGenerator_generate_point_charge_block(mrcc_input_generator): - generated_point_charge_block = mrcc_input_generator.generate_point_charge_block() + generated_point_charge_block = mrcc_input_generator._generate_point_charge_block() generated_point_charge_block_shortened = [ float(x) for x in generated_point_charge_block.split()[5::180] @@ -850,9 +850,9 @@ def test_ORCAInputGenerator_generate_coords_block(orca_input_generator): orca_input_generator_nocp = deepcopy(orca_input_generator) orca_input_generator_nocp.include_cp = False - orca_input_generator_nocp.generate_coords_block() + orca_input_generator_nocp._generate_coords_block() - orca_input_generator.generate_coords_block() + orca_input_generator._generate_coords_block() reference_block_collated = { "adsorbate_slab": { @@ -1026,7 +1026,7 @@ def test_ORCAInputGenerator_generate_coords_block(orca_input_generator): def test_ORCAInputGenerator_format_ecp_info(orca_input_generator): with pytest.raises(ValueError): - orca_input_generator.format_ecp_info(atom_ecp_info="dummy_info\nN_core0\nend") + orca_input_generator._format_ecp_info(atom_ecp_info="dummy_info\nN_core0\nend") atom_ecp_info = """ NewECP @@ -1036,7 +1036,7 @@ def test_ORCAInputGenerator_format_ecp_info(orca_input_generator): 1 1.732000000 14.676000000 2 end """ - formatted_atom_ecp_info = orca_input_generator.format_ecp_info( + formatted_atom_ecp_info = orca_input_generator._format_ecp_info( atom_ecp_info=atom_ecp_info ) assert ( @@ -1052,7 +1052,7 @@ def test_ORCAInputGenerator_generate_preamble_block(orca_input_generator): orca_input_generator_3 = deepcopy(orca_input_generator) # Generate the orca input preamble - orca_input_generator_1.generate_preamble_block() + orca_input_generator_1._generate_preamble_block() assert ( orca_input_generator_1.orcablocks["adsorbate_slab"] @@ -1090,7 +1090,7 @@ def test_ORCAInputGenerator_generate_preamble_block(orca_input_generator): }, } orca_input_generator_2.element_info = element_info - orca_input_generator_2.generate_preamble_block() + orca_input_generator_2._generate_preamble_block() assert ( orca_input_generator_2.orcablocks["adsorbate_slab"] @@ -1102,7 +1102,7 @@ def test_ORCAInputGenerator_generate_preamble_block(orca_input_generator): orca_input_generator_3.method_block = None orca_input_generator_3.pal_nprocs_block = None orca_input_generator_3.element_info = None - orca_input_generator_3.generate_preamble_block() + orca_input_generator_3._generate_preamble_block() assert ( orca_input_generator_3.orcablocks["adsorbate_slab"] @@ -1113,7 +1113,7 @@ def test_ORCAInputGenerator_generate_preamble_block(orca_input_generator): with pytest.raises(ValueError): element_info_error = {"C": element_info["C"]} orca_input_generator_3.element_info = element_info_error - orca_input_generator_3.generate_preamble_block() + orca_input_generator_3._generate_preamble_block() def test_ORCAInputGenerator_create_point_charge_file(orca_input_generator, tmp_path): @@ -1237,7 +1237,7 @@ def test_CreateSKZCAMClusters_run_chemshell(skzcam_clusters, tmp_path): def test_CreateSKZCAMClusters_convert_pun_to_atoms(skzcam_clusters): - slab_embedded_cluster = skzcam_clusters.convert_pun_to_atoms( + slab_embedded_cluster = skzcam_clusters._convert_pun_to_atoms( pun_file=Path(FILE_DIR, "skzcam_files", "ChemShell_Cluster.pun.gz") ) @@ -1500,7 +1500,7 @@ def test_CreateSKZCAMClusters_create_adsorbate_slab_embedded_cluster( ) skzcam_clusters.adsorbate_vector_from_slab = [0.0, 0.0, 2.0] - skzcam_clusters.create_adsorbate_slab_embedded_cluster( + skzcam_clusters._create_adsorbate_slab_embedded_cluster( quantum_cluster_indices=[[0, 1, 3, 4], [5, 6, 7, 8]], ecp_region_indices=[[0, 1, 3, 4], [5, 6, 7, 8]], )