-
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.
- Loading branch information
Showing
7 changed files
with
173 additions
and
337 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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,54 @@ | ||
from pathlib import Path | ||
|
||
import numpy as np | ||
|
||
ASSETS = Path("./tests/assets") | ||
|
||
|
||
def get_asize(list_of_atoms, pad): | ||
"""TODO Anders what is asize""" | ||
|
||
asize: dict[int, int] = dict() | ||
|
||
# WHAT | ||
|
||
for atoms in list_of_atoms: | ||
|
||
unique_atoms, unique_counts = np.unique(atoms, return_counts=True) | ||
|
||
for atom, count in zip(unique_atoms, unique_counts): | ||
|
||
prev = asize.get(atom, None) | ||
|
||
if prev is None: | ||
asize[atom] = count + pad | ||
continue | ||
|
||
asize[atom] = max(asize[atom], count + pad) | ||
|
||
# for key, value in mol.natypes.items(): | ||
# try: | ||
# asize[key] = max(asize[key], value + pad) | ||
# except KeyError: | ||
# asize[key] = value + pad | ||
|
||
return asize | ||
|
||
|
||
def get_energies(filename: Path): | ||
"""Returns a dictionary with heats of formation for each xyz-file.""" | ||
|
||
with open(filename, "r") as f: | ||
lines = f.readlines() | ||
|
||
energies = dict() | ||
|
||
for line in lines: | ||
tokens = line.split() | ||
|
||
xyz_name = tokens[0] | ||
hof = float(tokens[1]) | ||
|
||
energies[xyz_name] = hof | ||
|
||
return energies |
Oops, something went wrong.