aromatools 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Fernando Martínez Villarino
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,23 @@
1
+ Metadata-Version: 2.4
2
+ Name: aromatools
3
+ Version: 0.1.0
4
+ Summary: Herramientas para el análisis de aromaticidad
5
+ Author: Fernando Martínez Villarino
6
+ Author-email: fernandomv5897@gmail.com
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.12
11
+ License-File: LICENSE
12
+ Requires-Dist: numpy
13
+ Requires-Dist: networkx
14
+ Requires-Dist: matplotlib
15
+ Requires-Dist: art
16
+ Requires-Dist: ase
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: classifier
20
+ Dynamic: license-file
21
+ Dynamic: requires-dist
22
+ Dynamic: requires-python
23
+ Dynamic: summary
@@ -0,0 +1,14 @@
1
+ # AromaTools
2
+
3
+ Paquete para el análisis de la aromaticidad.
4
+
5
+ Este código incluye los 3 principales formas de diagnosticar la aromaticidad:
6
+ * Criterios Magnéticos
7
+ Calcular el campo magnético inducido en direcciones x, y o z
8
+ Calcular NICS SP, NICS-XY-Scan (1D y 2D) y NICS 3D
9
+ Calcular la intensidad de corriente anular mediante integración numérica
10
+ *Criterios Geométricos
11
+ Analisis de alternación de longuitudes de enlaces (BLA, por sus siglas en inglés)
12
+ Índice HOMA, HOMER y HOMAc
13
+ *Criterios energéticos
14
+ Muy pronto...
File without changes
File without changes
@@ -0,0 +1,176 @@
1
+ #!/usr/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ import sys
5
+ import math
6
+ import numpy as np
7
+ import networkx as nx
8
+ import contextlib
9
+ import glob
10
+ import os
11
+ import time
12
+ import getpass
13
+ from ase.data import covalent_radii, atomic_numbers
14
+ from art import text2art
15
+
16
+ # Diccionarios de parámetros
17
+ R_opt = {'HOMA': {'CC': 1.388, 'CN': 1.334, 'NN': 1.309, 'CO': 1.265},
18
+ 'HOMER': {'CC': 1.437, 'CN': 1.39, 'NN': 1.375, 'CO': 1.379},
19
+ 'HOMAC': {'CC': 1.392, 'CN': 1.333, 'NN': 1.318, 'CO': 1.315, 'SiSi': 2.163, 'CSi': 1.752}}
20
+
21
+ alpha = {'HOMA': {'CC': 257.7, 'CN': 93.52, 'NN': 130.33, 'CO': 157.38},
22
+ 'HOMER': {'CC': 950.74, 'CN': 506.43, 'NN': 187.36, 'CO': 164.96},
23
+ 'HOMAC': {'CC': 153.37, 'CN': 111.83, 'NN': 98.99, 'CO': 335.16, 'SiSi': 325.6, 'CSi': 115.41}}
24
+
25
+ def arogeometric():
26
+ text_ascci = text2art("AROGEOMETRIC 1.0", font='old banner')
27
+ print("\n" + text_ascci)
28
+ welcome = """
29
+ Welcome to AroGeometric — Geometric Aromaticity Index Calculator
30
+ Authors: Fernando Martinez-Villarino and Gabriel Merino
31
+ Cinvestav Mérida, 2024
32
+
33
+ This tool allows you to compute geometric-based aromaticity indices for a set of molecules in .xyz files.
34
+ You can choose among three different indices:
35
+
36
+ • HOMA (HOMA93): 0 = non-aromatic, 1 = aromatic.
37
+ • HOMAc: -1 = antiaromatic, 0 = non-aromatic, 1 = aromatic.
38
+ • HOMER: Excited-state version of HOMAc.
39
+
40
+ Use as: aroegeometric.py [HOMA|HOMER|HOMAc]
41
+ """
42
+ print(welcome)
43
+
44
+ def parse_xyz(file_xyz):
45
+ with open(file_xyz, 'r') as f:
46
+ lines = [line.strip() for line in f if line.strip()]
47
+ natoms = int(lines[0])
48
+ atoms = []
49
+ for i in range(2, 2 + natoms):
50
+ parts = lines[i].split()
51
+ if len(parts) < 4:
52
+ continue
53
+ symbol = parts[0].capitalize()
54
+ if symbol == 'H':
55
+ continue
56
+ try:
57
+ x, y, z = map(float, parts[1:4])
58
+ atoms.append((symbol, x, y, z))
59
+ except ValueError:
60
+ print(f"Error: Invalid coordinates at line {i+1}.")
61
+ sys.exit(1)
62
+ return atoms
63
+
64
+ def build_graph(atoms, tol=0.45):
65
+ G = nx.Graph()
66
+ for idx, (sym, _, _, _) in enumerate(atoms):
67
+ G.add_node(idx, element=sym)
68
+ for i in range(len(atoms)):
69
+ sym1, x1, y1, z1 = atoms[i]
70
+ r1 = covalent_radii[atomic_numbers[sym1]]
71
+ for j in range(i + 1, len(atoms)):
72
+ sym2, x2, y2, z2 = atoms[j]
73
+ r2 = covalent_radii[atomic_numbers[sym2]]
74
+ dist = math.sqrt((x1 - x2)**2 + (y1 - y2)**2 + (z1 - z2)**2)
75
+ if dist <= r1 + r2 + tol:
76
+ bond_type = ''.join(sorted(sym1 + sym2))
77
+ G.add_edge(i, j, length=dist, bond_type=bond_type)
78
+ return G
79
+
80
+ def compute_index(G, atoms, index_type, filename):
81
+ print(f"\nProcessing: {filename}")
82
+ rings = nx.minimum_cycle_basis(G)
83
+ print(f"Number of rings detected: {len(rings)}")
84
+ for idx, ring in enumerate(rings, start=1):
85
+ ring_atoms = ring + [ring[0]]
86
+ ring_bonds = []
87
+ bond_types_in_ring = []
88
+
89
+ for i in range(len(ring)):
90
+ a1, a2 = ring_atoms[i], ring_atoms[i+1]
91
+ if G.has_edge(a1, a2):
92
+ data = G[a1][a2]
93
+ bond_type = data['bond_type']
94
+ dist = data['length']
95
+
96
+ print(f"Ring {idx}: bond {bond_type} with distance {dist:.4f} Å")
97
+
98
+ if bond_type == 'SiSi':
99
+ print(f"Ring {idx} contains Si-Si bond: distance = {dist:.4f} Å")
100
+
101
+ if bond_type not in R_opt[index_type]:
102
+ continue
103
+
104
+ Ropt = R_opt[index_type][bond_type]
105
+ a = alpha[index_type][bond_type]
106
+ bond_types_in_ring.append(bond_type)
107
+ ring_bonds.append((bond_type, dist, Ropt, a))
108
+
109
+ if not ring_bonds:
110
+ print(f"Ring {idx}: No valid bonds for index {index_type}.")
111
+ continue
112
+
113
+ n = len(ring_bonds)
114
+ total = sum(a * (dist - Ropt)**2 for _, dist, Ropt, a in ring_bonds)
115
+ index_value = 1.0 - (1.0 / n) * total
116
+ print(f"{index_type} index for ring {idx}: {index_value:.4f}")
117
+
118
+ def get_session_info():
119
+ init_time = time.strftime("%H:%M:%S", time.localtime())
120
+ work_direc = os.getcwd()
121
+ user = getpass.getuser()
122
+
123
+ session_info = f"""
124
+ Initiation time: {init_time}
125
+ Working directory: {work_direc}
126
+ User: {user}
127
+ """
128
+ return session_info
129
+
130
+ def main():
131
+ if len(sys.argv) != 2:
132
+ arogeometric()
133
+ sys.exit(1)
134
+
135
+ index_type = sys.argv[1].upper()
136
+ if index_type not in R_opt:
137
+ print("Error: Invalid index type. Choose from HOMA, HOMER, HOMAC.")
138
+ sys.exit(1)
139
+
140
+ xyz_files = sorted(glob.glob("*.xyz"))
141
+ if not xyz_files:
142
+ print("No .xyz files found in the current directory.")
143
+ sys.exit(1)
144
+
145
+ ascci_title = text2art("AROGEOMETRIC", font='big')
146
+ session_info = get_session_info()
147
+
148
+ with open("index.dat", "w") as log_file:
149
+ with contextlib.redirect_stdout(log_file):
150
+ print()
151
+ print(f"AroGeometric 2025, output file — {index_type}")
152
+ print(ascci_title)
153
+ print("Theoretical and Computational Chemistry Group")
154
+ print("Centro de Investigacion y de Estudios Avanzados — Unidad Merida")
155
+ print("Merida, Yucatan, Mexico\n")
156
+
157
+ print("---------------------------------Cite this work as---------------------------------")
158
+ print("AroGeometric 2025, Fernando Martinez-Villarino and G. Merino, Cinvestav, Merida, YUC, Mexico, 2025")
159
+ print("-----------------------------------------------------------------------------------\n")
160
+
161
+ print("Copyright (C) 1943, Cinvestav. All Rights Reserved")
162
+ print("Session information:")
163
+ print(session_info + "\n")
164
+
165
+ print(f"Total XYZ files found: {len(xyz_files)}\n")
166
+
167
+ for file_xyz in xyz_files:
168
+ atoms = parse_xyz(file_xyz)
169
+ G = build_graph(atoms)
170
+ compute_index(G, atoms, index_type, file_xyz)
171
+
172
+ print("\n")
173
+ print("************************************ AroGeometric terminated normally! ************************************\n")
174
+
175
+ print("All calculations completed and saved to 'index.dat'")
176
+
File without changes
@@ -0,0 +1,23 @@
1
+ Metadata-Version: 2.4
2
+ Name: aromatools
3
+ Version: 0.1.0
4
+ Summary: Herramientas para el análisis de aromaticidad
5
+ Author: Fernando Martínez Villarino
6
+ Author-email: fernandomv5897@gmail.com
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.12
11
+ License-File: LICENSE
12
+ Requires-Dist: numpy
13
+ Requires-Dist: networkx
14
+ Requires-Dist: matplotlib
15
+ Requires-Dist: art
16
+ Requires-Dist: ase
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: classifier
20
+ Dynamic: license-file
21
+ Dynamic: requires-dist
22
+ Dynamic: requires-python
23
+ Dynamic: summary
@@ -0,0 +1,14 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ aromatools/aroenergetic/__init__.py
6
+ aromatools/arogeometric/__init__.py
7
+ aromatools/arogeometric/__main__.py
8
+ aromatools/aromagnetic/__init__.py
9
+ aromatools/aromatools.egg-info/PKG-INFO
10
+ aromatools/aromatools.egg-info/SOURCES.txt
11
+ aromatools/aromatools.egg-info/dependency_links.txt
12
+ aromatools/aromatools.egg-info/entry_points.txt
13
+ aromatools/aromatools.egg-info/requires.txt
14
+ aromatools/aromatools.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ arogeometric = aromatools.arogeometric.__main__:main
@@ -0,0 +1,5 @@
1
+ numpy
2
+ networkx
3
+ matplotlib
4
+ art
5
+ ase
@@ -0,0 +1,3 @@
1
+ aroenergetic
2
+ arogeometric
3
+ aromagnetic
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,29 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="aromatools",
5
+ version="0.1.0",
6
+ packages=find_packages(where="aromatools"),
7
+ package_dir={"": "aromatools"},
8
+ description="Herramientas para el análisis de aromaticidad",
9
+ author="Fernando Martínez Villarino",
10
+ author_email="fernandomv5897@gmail.com",
11
+ classifiers=[
12
+ "Programming Language :: Python :: 3",
13
+ "License :: OSI Approved :: MIT License",
14
+ "Operating System :: OS Independent",
15
+ ],
16
+ entry_points={
17
+ "console_scripts": [
18
+ "arogeometric = aromatools.arogeometric.__main__:main"
19
+ ]
20
+ },
21
+ python_requires=">=3.12",
22
+ install_requires=[
23
+ "numpy",
24
+ "networkx",
25
+ "matplotlib",
26
+ "art",
27
+ "ase"
28
+ ],
29
+ )