-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate notebooks for exact answer, steps in fitting (#14)
* Add utility for making calculator Avoid copying code between notebooks * Separate exact, sampling and approximation * Accept "None" as an option
- Loading branch information
Showing
15 changed files
with
1,757 additions
and
1,359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Utility functions""" | ||
from typing import Optional | ||
|
||
|
||
from ase.calculators.calculator import Calculator | ||
from ase.calculators.mopac import MOPAC | ||
from ase.calculators.psi4 import Psi4 | ||
|
||
mopac_methods = ['pm7'] | ||
"""List of methods for which we will use MOPAC""" | ||
|
||
|
||
def make_calculator(method: str, basis: Optional[str], **kwargs) -> Calculator: | ||
"""Make an ASE calculator that implements a desired method. | ||
This function will select the appropriate quantum chemistry code depending | ||
on the method name using the following rules: | ||
1. Use MOPAC if the method is PM7. | ||
2. Use Psi4 otherwise | ||
Any keyword arguments are passed to the calculator | ||
Args: | ||
method: Name of the quantum chemistry method | ||
basis: Basis set name, if appropriate | ||
Returns: | ||
Calculator defined according to the user's settings | ||
""" | ||
|
||
if method in mopac_methods: | ||
if not (basis is None or basis == "None"): | ||
raise ValueError(f'Basis must be none for method: {method}') | ||
return MOPAC(method=method, command='mopac PREFIX.mop > /dev/null') | ||
else: | ||
return Psi4(method=method, basis=basis, **kwargs) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.