Unverified Commit 40cf334d authored by kfir4444's avatar kfir4444 Committed by GitHub
Browse files

Fixed: symeig deprication (#627)

* Fixed: symeig deprication

This causes:
RuntimeError: This function was deprecated since version 1.9 and is now removed. Please use the `torch.linalg.eigh` function instead.

* Fix: slow tensor creation

This raises:
Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with numpy.array() before converting to a tensor.
parent 46c554ad
......@@ -50,7 +50,7 @@ class Calculator(ase.calculators.calculator.Calculator):
def calculate(self, atoms=None, properties=['energy'],
system_changes=ase.calculators.calculator.all_changes):
super().calculate(atoms, properties, system_changes)
cell = torch.tensor(self.atoms.get_cell(complete=True),
cell = torch.tensor(self.atoms.get_cell(complete=True).array,
dtype=self.dtype, device=self.device)
pbc = torch.tensor(self.atoms.get_pbc(), dtype=torch.bool,
device=self.device)
......
......@@ -322,7 +322,7 @@ def vibrational_analysis(masses, hessian, mode_type='MDU', unit='cm^-1'):
if mass_scaled_hessian.shape[0] != 1:
raise ValueError('The input should contain only one molecule')
mass_scaled_hessian = mass_scaled_hessian.squeeze(0)
eigenvalues, eigenvectors = torch.symeig(mass_scaled_hessian, eigenvectors=True)
eigenvalues, eigenvectors = torch.linalg.eigh(mass_scaled_hessian)
angular_frequencies = eigenvalues.sqrt()
frequencies = angular_frequencies / (2 * math.pi)
# converting from sqrt(hartree / (amu * angstrom^2)) to cm^-1 or meV
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment