Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
FaVAD
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
NMPP
FaVAD
Commits
dd927cc5
Commit
dd927cc5
authored
Feb 20, 2020
by
Francisco Javier Dominguez Gutierrez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
99292e4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
0 deletions
+94
-0
sample/input/descriptor_vectors/H-W/DV_creator.py
sample/input/descriptor_vectors/H-W/DV_creator.py
+94
-0
No files found.
sample/input/descriptor_vectors/H-W/DV_creator.py
0 → 100644
View file @
dd927cc5
####################################################################################################
## Copyright (C) 2020 Udo von Toussaint, F. J. Dominguez-Gutierrez, Michele Compostella, Markus Rampp
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301, USA.
##
#####################################################################################################
##
## General Notes:
## FaVaD: Fingerprint And VisuAlization of Defects. Version: 1.0
## Python script to generate the set of standard descriptor vectors
## Please modify the code to create the chosen reference descriptor vector of the standard defect
## The geometry of the standard defect is defined in a xyz file
##
#####################################################################################################
import
numpy
as
np
from
numpy
import
*
import
matplotlib.pyplot
as
plt
import
linecache
import
subprocess
import
sys
#########################################################
num_lines
=
sum
(
1
for
line
in
open
(
'interstitial_geometry.xyz'
))
num_atom
=
int
(
linecache
.
getline
(
'interstitial_geometry.xyz'
,
1
))
print
(
'checking xyz file'
)
num_lines
=
num_lines
-
2
if
(
num_lines
==
num_atom
):
print
(
'xyz is in good shape'
)
else
:
sys
.
exit
(
"xyz file corrupted, please check its format"
)
##### computing descriptor vectors of damaged sample ####
print
(
'computing standard descriptor vector'
)
# command line for hundreds to thousands of atoms
cmd
=
'quip atoms_filename=interstitial_geometry.xyz descriptor_str="soap cutoff=3.0 l_max=4 n_max=4 atom_sigma=0.5 n_Z=2 Z={74 1} n_species=2 species_Z={74 1}" > vectors.dat'
#
subprocess
.
call
(
cmd
,
shell
=
True
)
i
=
0
arr
=
[]
# Cleaning quip output file
# Start reading DV at line 11
for
i
in
range
(
11
,
11
+
num_atom
):
dv_1
=
np
.
array
(
linecache
.
getline
(
'vectors.dat'
,
i
)[
7
::].
split
())
dv
=
dv_1
.
astype
(
np
.
float
)
arr
.
append
(
dv
)
arr
=
np
.
array
(
arr
)
DV_length
=
len
(
arr
[
0
,:])
print
(
'The number of DV components is: {0}'
.
format
(
DV_length
))
#### Printing out results
#### bcc DV ##################################
print
(
'Results are given in: bcc_vector.dat'
)
file_1
=
open
(
'bcc_vector.dat'
,
'w'
)
for
i
in
range
(
0
,
DV_length
):
file_1
.
write
(
"{0}
\n
"
.
format
(
arr
[
0
,
i
]))
#### interstitial DV ##################################
print
(
'Results are given in: interstitial_vector.dat'
)
file_1
=
open
(
'interstitial_vector.dat'
,
'w'
)
for
i
in
range
(
0
,
DV_length
):
file_1
.
write
(
"{0}
\n
"
.
format
(
arr
[
432
,
i
]))
#### W(first NN) DV ##################################
print
(
'Results are given in: W_first_NN_vector.dat'
)
file_1
=
open
(
'W_first_NN_vector.dat'
,
'w'
)
for
i
in
range
(
0
,
DV_length
):
file_1
.
write
(
"{0}
\n
"
.
format
(
arr
[
54
,
i
]))
#### W(second NN) DV ##################################
print
(
'Results are given in: W_second_NN_vector.dat'
)
file_1
=
open
(
'W_second_NN_vector.dat'
,
'w'
)
for
i
in
range
(
0
,
DV_length
):
file_1
.
write
(
"{0}
\n
"
.
format
(
arr
[
361
,
i
]))
#cleaning files
print
(
'cleaning...'
)
cmd1
=
'rm vectors.dat'
subprocess
.
call
(
cmd1
,
shell
=
True
)
print
(
'Done!'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment