Hi all,
I am trying to retrieve different l channel SOAP features and found the retrieved values are not the same with features from lmax=0. Here are my codes:
from dscribe.descriptors import SOAP
from ase.io import read
import numpy as np
# Setting up the SOAP descriptor
species = [1, 8]
r_cut = 6.0
n_max = 3
l_max = 1
# Setting up the SOAP descriptor
soap = SOAP(
species=species,
periodic=False,
r_cut=r_cut,
n_max=n_max,
l_max=l_max,
)
num_feats = soap.get_number_of_features()
print(f"Number of SOAP features: {num_feats}")
# read water frames
water_monomer_xyz = "../xyz_files/water_monomer.xyz"
frames = read(water_monomer_xyz, ':')
num_molecules = len(frames)
num_atoms = 3
soap_water = soap.create(frames)
l_channels = {l: [] for l in range(l_max + 1)}
idx = 0
for Z1 in species:
for Z2 in species:
for l in range(l_max + 1):
for n1 in range(n_max):
for n2 in range(n_max):
if (n2, Z2) >= (n1, Z1):
l_channels[l].append(idx)
idx += 1
soap_l = np.empty((num_molecules, num_atoms, num_feats // (l_max+1), l_max+1))
for l, indices in l_channels.items():
soap_l[..., l] = soap_water[..., indices]
# Compare with lmax = 0
soap0 = SOAP(
species=species,
periodic=False,
r_cut=r_cut,
n_max=n_max,
l_max=0,
)
soap0_water = soap0.create(frames)
print(soap0_water.shape)
print(soap_l[..., 0].shape)
print(np.allclose(soap0_water, soap_l[..., 0]))
The results shows the final comparison is False, is there any difference when computing SOAP descriptors or simply the way I retrieve different l channels are wrong?
Hi all,
I am trying to retrieve different l channel SOAP features and found the retrieved values are not the same with features from lmax=0. Here are my codes:
The results shows the final comparison is
False, is there any difference when computing SOAP descriptors or simply the way I retrieve different l channels are wrong?