-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jinzhe Zeng <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
4536aa6
commit 94741be
Showing
4 changed files
with
145 additions
and
1 deletion.
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
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,57 @@ | ||
import numpy as np | ||
|
||
# Angston is used in Psi4 by default | ||
template = """molecule {{ | ||
{atoms:s} | ||
{charge:d} {multiplicity:d} | ||
}} | ||
set basis {basis:s} | ||
set gradient_write on | ||
G, wfn = gradient("WB97M-D3BJ", return_wfn=True) | ||
wfn.energy() | ||
wfn.gradient().print_out() | ||
""" | ||
|
||
|
||
def write_psi4_input( | ||
types: np.ndarray, | ||
coords: np.ndarray, | ||
method: str, | ||
basis: str, | ||
charge: int = 0, | ||
multiplicity: int = 1, | ||
) -> str: | ||
"""Write Psi4 input file. | ||
Parameters | ||
---------- | ||
types : np.ndarray | ||
atomic symbols | ||
coords : np.ndarray | ||
atomic coordinates | ||
method : str | ||
computational method | ||
basis : str | ||
basis set; see https://psicode.org/psi4manual/master/basissets_tables.html | ||
charge : int, default=0 | ||
charge of system | ||
multiplicity : int, default=1 | ||
multiplicity of system | ||
Returns | ||
------- | ||
str | ||
content of Psi4 input file | ||
""" | ||
return template.format( | ||
atoms="\n".join( | ||
[ | ||
"{:s} {:16.9f} {:16.9f} {:16.9f}".format(*ii) | ||
for ii in zip(types, *coords.T) | ||
] | ||
), | ||
charge=charge, | ||
multiplicity=multiplicity, | ||
method=method, | ||
basis=basis, | ||
) |
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
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