Giter Club home page Giter Club logo

Comments (5)

lauri-codes avatar lauri-codes commented on August 24, 2024

Hi @Firaskigali,

Thank you for your question. I would need a minimal non-working example to reproduce this behaviour. I can't seem to reproduce the issue with a minimal example like this:

from dscribe.descriptors import SOAP
from ase.build import bulk

soap_descriptor = SOAP(species=['Cu'], n_max=2, l_max=2, r_cut=5, periodic=True)

system_1x1 = bulk("Cu", "fcc")
features_1x1 = soap_descriptor.create(system_1x1, centers=[0])

system_3x3 = bulk("Cu", "fcc") * [3, 3, 3]
features_3x3 = soap_descriptor.create(system_3x3, centers=[0])

diff = features_1x1-features_3x3
print(diff.max())

where difference seems to be well below numerical accuracy of floating point operations.

Are you sure that you have set periodic boundary conditions correctly both in the descriptor, and in your ASE.Atoms?

from dscribe.

Firaskigali avatar Firaskigali commented on August 24, 2024

data.zip
Hi lauri,
Thank you for your response and your example. I have attached two data files: one contained a unit cell of a monoclinic ZrO2 system, and the second file is a 2x2x2 of the unit cell. Then the issue comes when I try to compute the similarity between the first atom, "Zr," in the unit cell and its equivalent atoms in the supercell (the first 8 atoms) as follows:

unit_cell_mono, super_cell_mono          =  'ZrO2_mono_111.xyz', 'ZrO2_mono_222.xyz'
system_1x1     = ase.io.read(unit_cell_mono,':')
system_2x2     = ase.io.read(super_cell_mono,':')

metric_soap    = AverageKernel(metric="polynomial",gamma=None, degree=4, coef0=1.0, normalize_kernel=True)
soap_descriptor = SOAP(species=['Zr','O'], rcut=2.5, nmax=10, lmax=10, sigma=0.5, periodic=True, rbf='polynomial',crossover=True, sparse=False)

features_1x1 = soap_descriptor.create(system_1x1)
features_2x2 = soap_descriptor.create(system_2x2)

diff = features_1x1[0] - features_2x2 [0] 
#diff is not equal to zero

CUB_MONO = []
for j in range(0,8):
    sim_kernel = metric_soap.create([features_1x1[0].reshape(1, -1), features_2x2[j].reshape(1, -1)])
    CUB_MONO.append(sim_kernel[0][1])
    print(j, sim_kernel[0][1])
print(np.mean(CUB_MONO))

The output shows that the average similarity between equivalent atoms is not very close to one. While in your example we can see the average similarity between equivalent atoms is one Why is that? Do you know an explanation of this or any modifications or post-processing that can be done?

Thank you in advance.
Firas

from dscribe.

lauri-codes avatar lauri-codes commented on August 24, 2024

Hi @Firaskigali,

There is a problem in your structure file ZrO2_mono_222.xyz: it is not a 2x2x2 version of the unit cell, but instead contains some sort of a rotation of the atom positions.

If you e.g. use ASE to create the 2x2x2 system, you should get correct behaviour:
system_2x2 = system_1x1 * [2, 2, 2]

Below is a full example (base on dscribe==2.1.0, hence the syntax differences) of your script, from which I get the maximum absolute difference of 3.5373242421136986e-13 between the descriptor values.

import numpy as np
import ase.io
from dscribe.descriptors import SOAP
from dscribe.kernels import AverageKernel

unit_cell_mono = 'ZrO2_mono_111.xyz'
system_1x1 = ase.io.read(unit_cell_mono, 0)
system_2x2 = system_1x1 * [2, 2, 2]

metric_soap = AverageKernel(
    metric="polynomial",
    gamma=None,
    degree=4,
    coef0=1.0,
    normalize_kernel=True
)
soap_descriptor = SOAP(
    species=['Zr','O'],
    r_cut=2.5,
    n_max=10,
    l_max=10,
    sigma=0.5,
    periodic=True,
    rbf='polynomial',
    compression={"mode": "crossover"},
    sparse=False
)

features_1x1 = soap_descriptor.create(system_1x1)
features_2x2 = soap_descriptor.create(system_2x2)

max_diff = np.max(np.abs(features_1x1[0] - features_2x2[0]))
print(f"Maximum difference in SOAP desciptor: {max_diff}")

CUB_MONO = []
for j in range(0, 8):
    sim_kernel = metric_soap.create([features_1x1[0].reshape(1, -1), features_2x2[j].reshape(1, -1)])
    CUB_MONO.append(sim_kernel[0][1])
    print(j, sim_kernel[0][1])
print(np.mean(CUB_MONO))

from dscribe.

lauri-codes avatar lauri-codes commented on August 24, 2024

Closing as inactive.

from dscribe.

Firaskigali avatar Firaskigali commented on August 24, 2024

Thank you very much for your help. I duplicated the unit cell as you suggested, and everything is fine now. Thank you.

from dscribe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.