Skip to content

Instantly share code, notes, and snippets.

@andersx
Created May 17, 2019 14:22
Show Gist options
  • Save andersx/705d5d3382c0c946714eb0c585cf44e8 to your computer and use it in GitHub Desktop.
Save andersx/705d5d3382c0c946714eb0c585cf44e8 to your computer and use it in GitHub Desktop.
Atomic distances between atom in different C20 molecules,, QML/develop branch
#!/usr/bin/env python3
import numpy as np
# The development version of QML
import qml
from qml.fchl import generate_representation
from qml.fchl import get_atomic_kernels
from qml.fchl import get_global_symmetric_kernels
from qml.data import Compound
np.set_printoptions(linewidth=99999999, suppress=True)
REP_ARGS = {
"max_size": 20,
"cut_distance": 1e6,
}
KERNEL_ARGS = {
"kernel_args": {
"sigma": [0.1],
},
"alchemy": "off",
"cut_distance": 1e6,
}
if __name__ == "__main__":
c1 = Compound(xyz="c20.xyz")
c2 = Compound(xyz="c20-other.xyz") # [6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 7, 6, 6, 6, 6]
c3 = Compound(xyz="c20-opposite.xyz") # [6, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 6]
r1 = generate_representation(c1.coordinates, c1.nuclear_charges, **REP_ARGS)
r2 = generate_representation(c2.coordinates, c2.nuclear_charges, **REP_ARGS)
r3 = generate_representation(c3.coordinates, c3.nuclear_charges, **REP_ARGS)
K12 = get_atomic_kernels(r2, r3, **KERNEL_ARGS)[0]
print(K12)
all_reps = np.array([r1, r2, r3])
K12 = get_global_symmetric_kernels(all_reps, **KERNEL_ARGS)[0]
print(K12)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment