-
Notifications
You must be signed in to change notification settings - Fork 21
/
data.py
executable file
·103 lines (79 loc) · 3.38 KB
/
data.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/env python
################################################################################
# Copyright Daniel Davies, Adam J. Jackson (2013) #
# #
# This file is part of SMACT: data.py 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 3 of #
# the License, 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, see <http://www.gnu.org/licenses/>. #
################################################################################
from __future__ import division
from past.utils import old_div
import smact
def get_mulliken(element):
"""Get Mulliken electronegativity from the IE and EA
Arguments:
symbol (smact.Element or str): Element object or symbol
Returns:
mulliken (float): Mulliken electronegativity
"""
if type(element) == str:
element = smact.Element(element)
elif type(element) != smact.Element:
raise Exception("Unexpected type: {0}".format(type(element)))
mulliken = old_div((element.ionpot+element.e_affinity),2.0)
return mulliken
################################################################################
#### The following functions are deprecated. New code should access these ####
#### properties directly by forming an "element" object and calling the ####
#### desired property, as in the wrappers below. ####
################################################################################
def get_pauling(element):
"""Pauling electronegativity of specified element.
Arguments:
symbol (smact.Element or str): Element object or symbol
Returns:
pauling_eneg (float): Pauling electronegativity
"""
if type(element) == str:
element = smact.Element(element)
elif type(element) != smact.Element:
raise Exception("Unexpected type: {0}".format(type(element)))
return element.pauling_eneg
def get_covalent(symbol):
"""Covalent radius of specified element.
Drawn from Open Babel data table.
Arguments:
symbol (string): Element label
Returns:
covalent_radius (float): Covalent radius
"""
from smact import Element
A = Element(symbol)
return A.covalent_radius
def get_eig(symbol):
"""Eigenvalue of specified element.
Arguments:
symbol (string): Element label
Returns:
eig (float): Eigenvalue
"""
from smact import Element
A=Element(symbol)
return A.eig
def get_eig_s(symbol):
"""Eigenvalue of s-orbital in specified element.
Arguments:
symbol (string): Element label
Returns:
eig_s (float): Eigenvalue
"""
from smact import Element
A=Element(symbol)
return A.eig_s