import numpy as np
[docs]class CalculatorBase:
def __init__(self, atoms, atom_coords, basis, scf, units, molname, calcname, savefile):
self.atoms = atoms
self.atom_coords = atom_coords
self.basis_name = basis
self.scf = scf
self.units = units
self.molname = molname
self.calcname = calcname
self.savefile = savefile
[docs] def run(self):
raise NotImplementedError(
'Implement a run method in your calculator.')
[docs] def save_data(self):
raise NotImplementedError(
'Implement a save_data method in your calculator.')
[docs] @staticmethod
def normalize_columns(mat):
"""Normalize a matrix column-wise.
Arguments:
mat {np.ndarray} -- the matrix to be normalized
Returns:
np.ndarray -- normalized matrix
"""
norm = np.sqrt((mat**2).sum(0))
return mat / norm