Skip to content

Commit

Permalink
Bunch of technical fixes (#65)
Browse files Browse the repository at this point in the history
* fix AutoAUX for Z>86; note regarding basis set choice; missing init entry and linting correction

Signed-off-by: Marcel Müller <[email protected]>

* fix typo

Signed-off-by: Marcel Müller <[email protected]>

---------

Signed-off-by: Marcel Müller <[email protected]>
  • Loading branch information
marcelmbn authored Oct 17, 2024
1 parent 4fb16d1 commit 6bb74ea
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ There are two related aspects of the element composition:
- **Example 1**: `C:1-3, O:1-1, H:1-*` would result in a molecule with 1, 2, or 3 carbon atoms, exactly 1 oxygen atom, and between 1 and an undefined number of hydrogen atoms (i.e., at least 1).
- **Example 2**: `Na:10-10, In:10-10, O:20-20`. This example would result in a molecule with exactly 10 sodium atoms, 10 indium atoms, and 20 oxygen atoms. **For a fixed element composition, the number of atoms (40) has to be within the min_num_atoms and max_num_atom interval.** `mindlessgen` will consequently always return a molecule with exactly 40 atoms.

> [!WARNING]
> When using `orca` and specifying elements with `Z > 86`, ensure that the basis set you've selected is compatible with (super-)heavy elements like actinides.
> You can find a list of available basis sets [here](https://www.faccts.de/docs/orca/6.0/manual/contents/detailed/basisset.html#built-in-basis-sets).
> A reliable standard choice that covers the entire periodic table is `def2-mTZVPP`.
## Citation

When using the program for academic purposes, please cite:
Expand Down
2 changes: 2 additions & 0 deletions src/mindlessgen/molecules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
get_four_d_metals,
get_five_d_metals,
get_lanthanides,
get_actinides,
get_alkali_metals,
get_alkaline_earth_metals,
)
Expand All @@ -34,6 +35,7 @@
"get_four_d_metals",
"get_five_d_metals",
"get_lanthanides",
"get_actinides",
"get_alkali_metals",
"get_alkaline_earth_metals",
"PSE_NUMBERS",
Expand Down
4 changes: 3 additions & 1 deletion src/mindlessgen/molecules/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,10 @@ def read_mol_from_file(file: str | Path) -> Molecule:
molecule = Molecule()
if isinstance(file, str):
file_path = Path(file).resolve()
if isinstance(file, Path):
elif isinstance(file, Path):
file_path = file.resolve()
else:
raise TypeError("String or Path expected.")
molecule.read_xyz_from_file(file_path)
if file_path.with_suffix(".CHRG").exists():
molecule.read_charge_from_file(file_path.with_suffix(".CHRG"))
Expand Down
3 changes: 3 additions & 0 deletions src/mindlessgen/qm/orca.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ def _gen_input(
orca_input = f"! {self.cfg.functional} {self.cfg.basis}\n"
orca_input += f"! DEFGRID{self.cfg.gridsize}\n"
orca_input += "! NoTRAH NoSOSCF SlowConv\n"
# "! AutoAux" keyword for super-heavy elements as def2/J ends at Rn
if any(atom >= 86 for atom in molecule.ati):
orca_input += "! AutoAux\n"
if optimization:
orca_input += "! OPT\n"
if opt_cycles is not None:
Expand Down
8 changes: 4 additions & 4 deletions src/mindlessgen/qm/xtb.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ def _run(self, temp_path: Path, arguments: list[str]) -> tuple[str, str, int]:
check=True,
)
# get the output of the xtb calculation (of both stdout and stderr)
xtb_log_out = xtb_out.stdout.decode("utf8")
xtb_log_err = xtb_out.stderr.decode("utf8")
xtb_log_out = xtb_out.stdout.decode("utf8", errors="replace")
xtb_log_err = xtb_out.stderr.decode("utf8", errors="replace")
return xtb_log_out, xtb_log_err, 0
except sp.CalledProcessError as e:
xtb_log_out = e.stdout.decode("utf8")
xtb_log_err = e.stderr.decode("utf8")
xtb_log_out = e.stdout.decode("utf8", errors="replace")
xtb_log_err = e.stderr.decode("utf8", errors="replace")
return xtb_log_out, xtb_log_err, e.returncode


Expand Down

0 comments on commit 6bb74ea

Please sign in to comment.