gemdat.crystallizer
This module contains the Crystallizer, which reconstructs a symmetry-fitted crystal structure (and cif file) from the occupancy density of a molecular dynamics trajectory.
Crystallizer(*, trajectory, floating_specie, resolution=0.2)
Reconstruct a crystal structure from a trajectory's occupancy density.
The pipeline is: the mobile species density is turned into candidate sites with partial occupancies, these are combined with the time-averaged static host framework, and the highest crystal symmetry consistent with the resulting structure is fitted. The result can be written to a cif file.
Parameters:
-
trajectory(Trajectory) –Input trajectory
-
floating_specie(str) –Symbol of the diffusing/mobile species, e.g.
'Li'. All other species are treated as the static framework. -
resolution(float, default:0.2) –Minimum resolution for the density voxels in Ångstrom, passed to gemdat.trajectory.Trajectory.to_volume.
Source code in src/gemdat/crystallizer.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
crystallize(*, symprec_range=(0.01, 0.05, 0.1, 0.2, 0.3, 0.5), angle_tolerance=5.0, background_level=0.1, **find_peaks_kwargs)
Build the full structure and fit the highest possible space group.
Parameters:
-
symprec_range(tuple[float, ...], default:(0.01, 0.05, 0.1, 0.2, 0.3, 0.5)) –Symmetry tolerances (Ångstrom) to try. The tolerance giving the highest space group number wins; ties are broken towards the tightest (smallest) tolerance.
-
angle_tolerance(float, default:5.0) –Angle tolerance (degrees) passed to pymatgen.symmetry.analyzer.SpacegroupAnalyzer.
-
background_level(float, default:0.1) –Fraction of the maximum density used as the segmentation floor.
-
**find_peaks_kwargs(dict, default:{}) –Passed through to gemdat.volume.Volume.find_peaks.
Returns:
-
result(CrystallizerResult) –The symmetrized structure and the fitted space group.
Source code in src/gemdat/crystallizer.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
framework()
Return the static host framework as a fully-occupied structure.
Fractional coordinates are averaged over all frames using a circular mean per axis, which is robust to atoms sitting on/near a periodic boundary.
Returns:
-
structure(Structure) –Time-averaged framework structure (one site per framework atom).
Source code in src/gemdat/crystallizer.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
from_trajectory(trajectory, floating_specie, resolution=0.2)
classmethod
Construct a Crystallizer from a trajectory.
Parameters:
-
trajectory(Trajectory) –Input trajectory
-
floating_specie(str) –Symbol of the diffusing/mobile species, e.g.
'Li'. -
resolution(float, default:0.2) –Minimum resolution for the density voxels in Ångstrom.
Returns:
-
Crystallizer–
Source code in src/gemdat/crystallizer.py
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 104 105 106 | |
mobile_sites(*, background_level=0.1, **find_peaks_kwargs)
Extract the mobile-species sites from the density, with partial occupancies.
Parameters:
-
background_level(float, default:0.1) –Fraction of the maximum density used as the segmentation floor, see gemdat.volume.Volume.to_structure.
-
**find_peaks_kwargs(dict, default:{}) –Passed through to gemdat.volume.Volume.find_peaks.
Returns:
-
structure(Structure) –Structure of mobile sites with partial occupancies.
Source code in src/gemdat/crystallizer.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
to_cif(filename, **kwargs)
Crystallize and write the result to a cif file (with symmetry).
Parameters:
-
filename(Path | str) –Output filename (a
.cifsuffix is enforced). -
**kwargs(dict, default:{}) –Passed through to [Crystallizer.crystallize][gemdat.crystallizer.Crys tallizer.crystallize].
Returns:
-
result(CrystallizerResult) –The same result that was written to file.
Source code in src/gemdat/crystallizer.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |
CrystallizerResult(structure, spacegroup_symbol, spacegroup_number, symprec)
dataclass
Result of crystallize.
Parameters:
-
structure(Structure) –Full structure (static framework + density-derived mobile sites), with partial occupancies and occupancies averaged over symmetry-equivalent sites.
-
spacegroup_symbol(str) –International symbol of the fitted space group.
-
spacegroup_number(int) –International number of the fitted space group.
-
symprec(float) –Symmetry tolerance (in Ångstrom) that produced the highest-symmetry fit.