Skip to content

Commit 40cf334

Browse files
authored
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.
1 parent 46c554a commit 40cf334

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

torchani/ase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __init__(self, species, model, overwrite=False):
5050
def calculate(self, atoms=None, properties=['energy'],
5151
system_changes=ase.calculators.calculator.all_changes):
5252
super().calculate(atoms, properties, system_changes)
53-
cell = torch.tensor(self.atoms.get_cell(complete=True),
53+
cell = torch.tensor(self.atoms.get_cell(complete=True).array,
5454
dtype=self.dtype, device=self.device)
5555
pbc = torch.tensor(self.atoms.get_pbc(), dtype=torch.bool,
5656
device=self.device)

torchani/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def vibrational_analysis(masses, hessian, mode_type='MDU', unit='cm^-1'):
322322
if mass_scaled_hessian.shape[0] != 1:
323323
raise ValueError('The input should contain only one molecule')
324324
mass_scaled_hessian = mass_scaled_hessian.squeeze(0)
325-
eigenvalues, eigenvectors = torch.symeig(mass_scaled_hessian, eigenvectors=True)
325+
eigenvalues, eigenvectors = torch.linalg.eigh(mass_scaled_hessian)
326326
angular_frequencies = eigenvalues.sqrt()
327327
frequencies = angular_frequencies / (2 * math.pi)
328328
# converting from sqrt(hartree / (amu * angstrom^2)) to cm^-1 or meV

0 commit comments

Comments
 (0)