<jupyter_start><jupyter_text>Read colloidal ice from simulation or experimental dataThis notebook explores options for reading simulations and experiments, and using them to define a `colloidal_ice` object.<jupyter_code># This only adds the package to the path.
import os
import sys 
sys.path.insert(0, '../../../')

import icenumerics as ice

import matplotlib.pyplot as plt
%matplotlib inline
ureg = ice.ureg
sp = ice.spins()
sp.create_lattice("square",[10,10],lattice_constant=30*ureg.um, border="closed spin")
particle = ice.particle(radius = 5.15*ureg.um,
             susceptibility = 0.0576,
             diffusion = 0.125*ureg.um**2/ureg.s,
             temperature = 300*ureg.K,
             density = 1000*ureg.kg/ureg.m**3)

trap = ice.trap(trap_sep = 10*ureg.um,
               height = 10*ureg.pN*ureg.nm,
               stiffness = 6e-4*ureg.pN/ureg.nm)

col = ice.colloidal_ice(sp, particle, trap, height_spread = 0, susceptibility_spread = 0.1)
col.pad_region(30*ureg.um)
world = ice.world(
    field = 20*ureg.mT,
    temperature = 300*ureg.K,
    dipole_cutoff = 200*ureg.um)
%%time

col.simulate(world,
             name = "test",
             include_timestamp = False,
             targetdir = r".",
             framerate = 100*ureg.Hz,
             timestep = 10*ureg.ms,
             run_time = 60*ureg.s,
             output = ["x","y","z"])
f, (ax2) = plt.subplots(1,1,figsize = (8,8))
col.display(ax2)<jupyter_output><empty_output><jupyter_text>What happens when a colloid is exactly at zero?It is possible, due to rounding errors, to find a colloid exactly in the center of the trap. In order not to lose the direction, the program will preserve the last direction.<jupyter_code>col.trj.loc[(5999,220),["x","y"]] = col.trj.loc[(5999,440),["x","y"]]
col = col.set_state_from_frame(-1)
f, (ax2) = plt.subplots(1,1,figsize = (8,8))
col.display(ax2)
plt.plot(col.trj.loc[(5999,220),"x"],col.trj.loc[(5999,220),"y"],'.',color="red")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14811083123425692, 'fraction_numerical': 0.04785894206549118, 'mean_word_length': 3.4035476718403546, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '585123', 'license': 'MIT', 'n_tokens_mistral': 789, 'n_tokens_neox': 722, 'n_words': 158, 'path': 'docs/_build/html/OtherNotebooks/ReadingColloidsFromSimulation.ipynb', 'repo_name': 'aortiza/icenumerics', 'size': '1985'}