-
Notifications
You must be signed in to change notification settings - Fork 1
/
step6.py
53 lines (42 loc) · 1.05 KB
/
step6.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 12 09:26:44 2017
@author: chengch
"""
import numpy as np
xyz = np.load('Stand_xyz.npy')
Pro = np.load('Pros.npy')
Vec_sts = []
Vec_vars = []
ver_COs = []
ver_NHs = []
def st_vec(mat1,mat2):
mat_vec = mat1 - mat2
data = np.sqrt(sum((mat_vec) ** 2))
data = mat_vec / data
return(data)
def var_vec(mat1,mat2):
data = mat1 - mat2
return(data)
for isnp in xyz:
Vec_sts.append((st_vec(isnp[4],isnp[5]),st_vec(isnp[6],isnp[7])))
for isn in Pro:
Vec_var = []
for i in isn:
Vec_var.append((var_vec(i[4],i[5]),var_vec(i[6],i[7])))
Vec_vars.append(Vec_var)
for st, var in zip(Vec_sts,Vec_vars):
ver_CO = []
ver_NH = []
for v in var:
data_CO = np.dot(st[0],v[0])
data_NH = np.dot(st[1],v[1])
ver_CO.append(data_CO)
ver_NH.append(data_NH)
ver_COs.append(ver_CO)
ver_NHs.append(ver_NH)
ver_COs = np.array(ver_COs)
ver_NHs = np.array(ver_NHs)
np.save('ver_CO.npy',abs(ver_COs))
np.save('ver_NH.npy',abs(ver_NHs))