-
Notifications
You must be signed in to change notification settings - Fork 0
/
atomjoiner.py
74 lines (48 loc) · 1.44 KB
/
atomjoiner.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
"""
TO-DO
"""
#atom, index, false coords
from scipy.spatial.distance import pdist
import granules.structure.LAMMPSdata as ld
import numpy as np
import pandas as pd
lammps = ld.LammpsData('tubito.data')
atoms = lammps.atomproperty.atoms.copy()
atomIds = atoms[['aID']].copy()
a1 = atoms.set_index('aID')[['x', 'y', 'z']].values
distances = pdist(a1, 'euclidean')
distindex = 0
pairs = []
for i in atomIds.values.flatten():
for j in atomIds.values.flatten():
if i < j:
pairs.append([i,j,distances[distindex]])
distindex+=1
l = pd.DataFrame()
cols = ['atom1','atom2','distance']
for i in cols:
l[i] = None
arr = pd.DataFrame(np.array(pairs))
arr.columns = cols
l = l.append(arr)
#filtrar dist == 0 DONE
l.sort_values('distance', inplace=True)
#sort DONE
#probar que no se repitan
#descartar extremos y sacar los atomos
l = l[:79]
lammps.topologia.bonds = lammps.topologia.bonds[0:0]
lammps.topologia.bonds[['Atom1','Atom2']] = l[['atom1','atom2']]
lammps.topologia.bonds['bID'] = range(1,80)
lammps.topologia.bonds['bType'] = 1
lammps.topologia.bonds = lammps.topologia.bonds.astype('int32')
lammps.writeConf('finaltube.data')
#TODO:
#cada 5 grados, 100 copias distintas posiciones
#DONE
#generar tubos programaticamente* a diferentes angulos (0-90) grados con operaciones matriciales
#DONE
# usar temperaturas diferentes (20 diffs) 1800 sims total
#
# para despues
#tomar linea de atomos y generar el tubo