-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6e436e
commit 1a48559
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Test symmetry function value in OUTCAR or POSCAR to pickled file | ||
# Need module pytorch , PyYaml , Ase , numpy | ||
# | ||
import numpy as np | ||
# All functions in here | ||
import test_sf | ||
|
||
|
||
|
||
# Load structure | ||
structure = test_sf.open_outcar('OUTCAR_1') | ||
|
||
|
||
#Generate Symmetry function using parameters | ||
#index = 2 : G2 / 4 : G4 / 5 : G5 symmetry function | ||
test_g2 = test_sf.generate_sf(index = 2 , param_d = [6.0 , 0.003214 , 0.0 , 0.0]) #[cutoff , eta , R_s , Mone] | ||
test_g4 = test_sf.generate_sf(index = 4 , param_d = [6.0 , 0.089277 , 4.0 , 1.0]) #[cutoff , eta , zeta , lambda] | ||
|
||
|
||
#Get distance information from OUTCAR & POSCAR | ||
#Distance_atoms use adjust & get distance from structure | ||
distance = test_sf.Distance_atoms(structure) | ||
#Set cufoff radius | ||
distance.set_cutoff(6.0) | ||
|
||
### Validation ### | ||
cal_list = list() | ||
print('_'*60) | ||
tmp = 0 | ||
for i in range(33,73): ## For Te in OUTCAR_1 | ||
tmp = distance.get_g2_dist(i,1) # get_g2_dist(atom number , atom type) | ||
cal_list.append(test_g2(tmp)) | ||
print('Testing G2 symmetry function') | ||
print('Calculated SF :',np.array(cal_list)) | ||
pickle1 = test_sf.load_pickle('data1.pickle') #From picked data | ||
print('Pickled data :',pickle1['x']['Te'][:,0]) | ||
print('') | ||
### G2 SF validation OK ### | ||
|
||
|
||
### G4 SF validation ### | ||
cal_list = list() | ||
print('_'*60) | ||
tmp = 0 | ||
for i in range(33,73): ## For Te in OUTCAR_1 | ||
tmp = distance.get_g4_dist(i,3,3) | ||
cal_list.append(test_g4(tmp)) # get_g4_dist(atom number , atom type_1 , atom type_2) | ||
print('Testing G4 symmetry function') | ||
print('Calculated SF :',np.array(cal_list)) | ||
pickle1 = test_sf.load_pickle('data1.pickle') | ||
print('Pickled data :',pickle1['x']['Te'][:,131]) | ||
### G4 SF validation OK ### |