Exemple #1
0
import py_util as pyu
import py_func as pyf
import numpy as np
import tensorflow as tf
import tf_func as tff
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split

nnParams = pyu.loadNN("log/nnParams.npz")
featParams = pyu.loadFeat("log/featParams.npz")

tf_feat = tf.placeholder(tf.float32, (None, featParams['nFeat']))
L3 = tff.getE(tf_feat, featParams['nFeat'], nnParams)
Router = 8

atomList, atomType, R_surf = pyu.loadXYZ("surface_cu.xyz")
atomList, atomType, R_Cu = pyu.loadXYZ("cu_np.xyz")

Ei = np.zeros(len(R_surf))
Emask = np.zeros(len(R_surf))
with tf.Session() as sess:
    saver = tf.train.Saver(tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES))
    sess.run(tf.global_variables_initializer())
    saver.restore(sess, "./log/model.ckpt")

    for i in range(len(R_surf)):
        # for Rs in R_surf[:10]:
        Rl = R_surf[i] - R_Cu
        dl = np.sqrt(np.sum(Rl**2, axis=-1))

        dl[dl > Router] = 0
# -*- coding: utf-8 -*-
"""
Created on Sun Mar  4 21:11:07 2018

@author: hif10
"""

import py_util as pyu
import py_func as pyf
import numpy as np

nnParams = pyu.loadNN("nnParams.npz")
featParams = pyu.loadFeat("featParams.npz")

atomList, atomType, R_surf = pyu.loadXYZ('Cu_surf2.xyz')
atomList, atomType, R = pyu.loadXYZ('CuC_NP.xyz')
R_Cu = R[atomList == atomType.index('Cu')]

nCase = 500
Rcut = 20.0 # radius for the initial cluster
Rcut4 = 15.0
Rcut2 = 3.0 # nearest neighbor distance
Rcut3 = 8.0 # 
angleCutoff=45

dCu0C0 = [2.0, 2.56, 2.59, 2.0, 1.98]
dCu1C1 = [2.0, 2.0, 2.0, 2.14, 2.19]
dC0C1 = [1.47, 1.41, 1.34, 1.45,1.36]
dC0O0 = [1.39, 1.41, 1.41, 1.39, 1.4]
dC1O1 = [1.22, 1.19, 1.19, 1.24, 1.2]
dC0H = [1.91, 1.91, 1.91, 1.91, 1.92]