Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-S-Rosen committed Jul 1, 2024
1 parent 25de1f2 commit 7c92597
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 157 deletions.
140 changes: 2 additions & 138 deletions src/quacc/atoms/skzcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from importlib.util import find_spec
from pathlib import Path
from typing import TYPE_CHECKING, Literal, TypedDict
from typing import TYPE_CHECKING

import numpy as np
from ase.atoms import Atoms
Expand All @@ -17,143 +17,7 @@
from ase.atom import Atom
from numpy.typing import NDArray

class ElementInfo(TypedDict):
core: int
basis: str
ecp: str
ri_scf_basis: str
ri_cwft_basis: str

class BlockInfo(TypedDict):
adsorbate_slab: str
adsorbate: str
slab: str

class MultiplicityDict(TypedDict):
adsorbate_slab: int
slab: int
adsorbate: int

ElementStr = Literal[
"H",
"He",
"Li",
"Be",
"B",
"C",
"N",
"O",
"F",
"Ne",
"Na",
"Mg",
"Al",
"Si",
"P",
"S",
"Cl",
"Ar",
"K",
"Ca",
"Sc",
"Ti",
"V",
"Cr",
"Mn",
"Fe",
"Co",
"Ni",
"Cu",
"Zn",
"Ga",
"Ge",
"As",
"Se",
"Br",
"Kr",
"Rb",
"Sr",
"Y",
"Zr",
"Nb",
"Mo",
"Tc",
"Ru",
"Rh",
"Pd",
"Ag",
"Cd",
"In",
"Sn",
"Sb",
"Te",
"I",
"Xe",
"Cs",
"Ba",
"La",
"Ce",
"Pr",
"Nd",
"Pm",
"Sm",
"Eu",
"Gd",
"Tb",
"Dy",
"Ho",
"Er",
"Tm",
"Yb",
"Lu",
"Hf",
"Ta",
"W",
"Re",
"Os",
"Ir",
"Pt",
"Au",
"Hg",
"Tl",
"Pb",
"Bi",
"Po",
"At",
"Rn",
"Fr",
"Ra",
"Ac",
"Th",
"Pa",
"U",
"Np",
"Pu",
"Am",
"Cm",
"Bk",
"Cf",
"Es",
"Fm",
"Md",
"No",
"Lr",
"Rf",
"Db",
"Sg",
"Bh",
"Hs",
"Mt",
"Ds",
"Rg",
"Cn",
"Nh",
"Fl",
"Mc",
"Lv",
"Ts",
"Og",
]
from quacc.types import BlockInfo, ElementInfo, ElementStr, MultiplicityDict


has_chemshell = find_spec("chemsh") is not None
Expand Down
27 changes: 8 additions & 19 deletions src/quacc/calculators/mrcc/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,15 @@

from io import StringIO
from pathlib import Path
from typing import TYPE_CHECKING, TypedDict
from typing import TYPE_CHECKING

from ase.io import read
from ase.units import Hartree

if TYPE_CHECKING:
from ase.atoms import Atoms

class ParamsInfo(TypedDict):
mrccinput: dict[str, str]
mrccblocks: str
charge: int
mult: int

class EnergyInfo(TypedDict):
energy: float | None
scf_energy: float | None
mp2_corr_energy: float | None
ccsd_corr_energy: float | None
ccsdt_corr_energy: float | None
from quacc.types import MRCCEnergyInfo, MRCCParamsInfo


def read_geom_mrccinp(file_path: Path | str) -> Atoms:
Expand Down Expand Up @@ -65,7 +54,7 @@ def read_geom_mrccinp(file_path: Path | str) -> Atoms:
return atoms


def write_mrcc(file_path: Path | str, atoms: Atoms, parameters: ParamsInfo) -> None:
def write_mrcc(file_path: Path | str, atoms: Atoms, parameters: MRCCParamsInfo) -> None:
"""
Write MRCC input file given the Atoms object and the parameters.
Expand All @@ -75,7 +64,7 @@ def write_mrcc(file_path: Path | str, atoms: Atoms, parameters: ParamsInfo) -> N
File path to write the MRCC input file.
atoms : Atoms
Atoms object with the geometry.
parameters : ParamsInfo
parameters : MRCCParamsInfo
Dictionary with the parameters to be written in the MRCC input file. The keys are the following:
- mrccinput : dict[str, str] <-- This is a dictionary with the MRCC input parameters are keys and their values as values.
- mrccblocks : str <-- This is a string with the MRCC blocks to be written.
Expand Down Expand Up @@ -112,7 +101,7 @@ def write_mrcc(file_path: Path | str, atoms: Atoms, parameters: ParamsInfo) -> N
file_path.write(",".join([str(atom_idx) for atom_idx in ghost_list]))


def read_energy(lines: list[str]) -> EnergyInfo:
def read_energy(lines: list[str]) -> MRCCEnergyInfo:
"""
Reads the energy components (SCF energy, MP2 correlation energy, CCSD correlation energy, CCSD(T) correlation energy) from the MRCC output file where available.
Expand All @@ -123,7 +112,7 @@ def read_energy(lines: list[str]) -> EnergyInfo:
Returns
-------
EnergyInfo
MRCCEnergyInfo
Dictionary with the energy components. The keys are the following:
- energy : float <-- Total energy which will not be computed in this function.
- scf_energy : float <-- SCF energy.
Expand Down Expand Up @@ -153,7 +142,7 @@ def read_energy(lines: list[str]) -> EnergyInfo:
return energy_dict


def read_mrcc_outputs(output_file_path: Path | str) -> EnergyInfo:
def read_mrcc_outputs(output_file_path: Path | str) -> MRCCEnergyInfo:
"""
Reads the energy components (SCF energy, MP2 correlation energy, CCSD correlation energy, CCSD(T) correlation energy) from the MRCC output file where available and calculates the total energy (based on the highest level of theory)
Expand All @@ -164,7 +153,7 @@ def read_mrcc_outputs(output_file_path: Path | str) -> EnergyInfo:
Returns
-------
EnergyInfo
MRCCEnergyInfo
Dictionary with the energy components. The keys are the following:
- energy : float | None <-- Total energy of highest available level.
- scf_energy : float | None <-- SCF energy.
Expand Down
Loading

0 comments on commit 7c92597

Please sign in to comment.