|
51 | 51 | from . import functions_general as fg, functions_crystallography as fc |
52 | 52 | from . import functions_crystallography as fc |
53 | 53 | from .classes_properties import Properties |
| 54 | +#from .classes_orbitals import CrystalOrbitals |
54 | 55 | from .classes_scattering import Scattering |
55 | 56 | from .classes_multicrystal import MultiCrystal |
56 | 57 | from .classes_plotting import Plotting, PlottingSuperstructure |
@@ -127,6 +128,7 @@ def __init__(self, filename=None): |
127 | 128 | self.Plot = Plotting(self) |
128 | 129 | self.Scatter = Scattering(self) |
129 | 130 | self.Properties = Properties(self) |
| 131 | + #self.Orbitals = CrystalOrbitals(self) # slows down cif parsing a lot! |
130 | 132 | # self.Fdmnes = Fdmnes(self) |
131 | 133 |
|
132 | 134 | def generate_structure(self): |
@@ -823,9 +825,14 @@ def fromcif(self, cifvals): |
823 | 825 | label = cifvals['_atom_site_label'] |
824 | 826 |
|
825 | 827 | if '_atom_site_type_symbol' in keys: |
826 | | - element = [x.strip('+-.0123456789()') for x in cifvals['_atom_site_type_symbol']] |
| 828 | + element = [fc.str2element(x) for x in cifvals['_atom_site_type_symbol']] |
827 | 829 | else: |
828 | | - element = [x.strip('+-.0123456789()') for x in cifvals['_atom_site_label']] |
| 830 | + element = [fc.str2element(x) for x in cifvals['_atom_site_label']] |
| 831 | + |
| 832 | + while False in element: |
| 833 | + fidx = element.index(False) |
| 834 | + warn('%s is not a valid element, replacing with H' % cifvals['_atom_site_label'][fidx]) |
| 835 | + element[fidx] = 'H' |
829 | 836 |
|
830 | 837 | # Replace Deuterium with Hydrogen |
831 | 838 | if 'D' in element: |
@@ -1187,17 +1194,22 @@ def info(self, idx=None, type=None): |
1187 | 1194 |
|
1188 | 1195 | out = '' |
1189 | 1196 | if np.any(fg.mag(self.mxmymz()) > 0): |
1190 | | - out += ' n Atom u v w Occ Uiso mx my mz \n' |
1191 | | - fmt = '%3.0f %4s %7.4f %7.4f %7.4f %4.2f %6.4f %7.4f %7.4f %7.4f\n' |
| 1197 | + out += ' n Label Atom u v w Occ Uiso mx my mz \n' |
| 1198 | + fmt = '%3.0f %5s %4s %7.4f %7.4f %7.4f %4.2f %6.4f %7.4f %7.4f %7.4f\n' |
1192 | 1199 | for n in disprange: |
1193 | 1200 | out += fmt % ( |
1194 | | - n, self.type[n], self.u[n], self.v[n], self.w[n], self.occupancy[n], self.uiso[n], self.mx[n], |
1195 | | - self.my[n], self.mz[n]) |
| 1201 | + n, self.label[n], self.type[n], self.u[n], self.v[n], self.w[n], |
| 1202 | + self.occupancy[n], self.uiso[n], |
| 1203 | + self.mx[n], self.my[n], self.mz[n] |
| 1204 | + ) |
1196 | 1205 | else: |
1197 | | - out += ' n Atom u v w Occ Uiso\n' |
1198 | | - fmt = '%3.0f %4s %7.4f %7.4f %7.4f %4.2f %6.4f\n' |
| 1206 | + out += ' n Label Atom u v w Occ Uiso\n' |
| 1207 | + fmt = '%3.0f %5s %4s %7.4f %7.4f %7.4f %4.2f %6.4f\n' |
1199 | 1208 | for n in disprange: |
1200 | | - out += fmt % (n, self.type[n], self.u[n], self.v[n], self.w[n], self.occupancy[n], self.uiso[n]) |
| 1209 | + out += fmt % ( |
| 1210 | + n, self.label[n], self.type[n], self.u[n], self.v[n], self.w[n], |
| 1211 | + self.occupancy[n], self.uiso[n] |
| 1212 | + ) |
1201 | 1213 | return out |
1202 | 1214 |
|
1203 | 1215 | def __repr__(self): |
@@ -1887,8 +1899,8 @@ class Superstructure(Crystal): |
1887 | 1899 | superstructure Crystal class |
1888 | 1900 | """ |
1889 | 1901 |
|
1890 | | - Parent = Crystal() |
1891 | | - P = [[1, 0, 0], [0, 1, 0], [0, 0, 1]] |
| 1902 | + #Parent = Crystal() |
| 1903 | + #P = [[1, 0, 0], [0, 1, 0], [0, 0, 1]] |
1892 | 1904 |
|
1893 | 1905 | def __init__(self, Parent, P): |
1894 | 1906 | """Initialise""" |
|
0 commit comments