# for multiple molecules. feat = CoulombMatrix() HCN = (HCN_ELES, HCN_COORDS) feat.fit([H2, HCN]) print("Transformed H2") print(feat.transform([H2])) print("H2 and HCN transformed") print(feat.transform([H2, HCN])) print() # Example of generating the Coulomb matrix with elements, coords, and # connections. feat = CoulombMatrix() H2_conn = (H2_ELES, H2_COORDS, H2_CONNS) HCN_conn = (HCN_ELES, HCN_COORDS, HCN_CONNS) print(feat.fit_transform([H2_conn, HCN_conn])) print() # Example of generating the Coulomb matrix using a specified input_type print("User specified input_type") feat = CoulombMatrix(input_type=("coords", "numbers")) H2_spec = (H2_COORDS, H2_NUMS) HCN_spec = (HCN_COORDS, HCN_NUMS) print(feat.fit_transform([H2_spec, HCN_spec])) print() # Example of generating the Local Coulomb matrix (atom-wise # representation) print("Atom feature") feat = LocalCoulombMatrix() print(feat.fit_transform([H2, HCN]))
from molml.features import CoulombMatrix feat = CoulombMatrix(input_type='list', n_jobs=1, sort=False, eigen=False, drop_values=False, only_lower_triangle=False) H2 = (['H', 'H'], [ [0.0, 0.0, 0.0], [1.0, 0.0, 0.0], ]) HCN = (['H', 'C', 'N'], [ [-1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [1.0, 0.0, 0.0], ]) feat.fit([H2, HCN]) print(feat.transform([H2])) print(feat.transform([H2, HCN])) feat2 = CoulombMatrix(input_type='filename') paths = ['data/qm7/qm-%04d.out' % i for i in range(2)] print(feat2.fit_transform(paths))