<jupyter_start><jupyter_text>Parameters<jupyter_code># Detector (pnCCD)
pixelsize = 75e-6
nx,ny = (1024,1024)
detector_distance = 300e-3
# Source
photon_energy = 3500 # [eV]
ph = condor.utils.photon.Photon(energy_eV=photon_energy)
wavelength = ph.get_wavelength()
fluence = 1e15 #[ph/um2]
focus_diameter = 0.2e-6
pulse_energy = fluence * ph.get_energy() * (np.pi*((1e6*focus_diameter/2.)**2)) # [J]
# Sample
pdb_id = '1FFK'
sample_size = 18e-9<jupyter_output><empty_output><jupyter_text>Run simulation<jupyter_code>src = condor.Source(wavelength=wavelength, pulse_energy=pulse_energy, focus_diameter=focus_diameter)
det = condor.Detector(distance=detector_distance, pixel_size=pixelsize, nx=nx, ny=ny, noise="poisson")
par = condor.ParticleAtoms(pdb_id=pdb_id,rotation_formalism="random")
E = condor.Experiment(source=src, particles={"particle_atoms":par}, detector=det)
o = E.propagate()<jupyter_output><empty_output><jupyter_text>Output<jupyter_code>print "Photon energy: %d eV" %photon_energy
print "Fluence: %g ph/um2" %fluence
print "Pulse energy: %.4f mJ" %(1e3*pulse_energy)
print "Sample size: %d nm" %(1e9*sample_size)
print "Detector distance: %d mm" %(1e3*detector_distance)
print "Full period resolution (corner): %.2f nm" %(1e9*fullp_res_corner(det,wavelength))
print "Full period resolution (edge): %.2f nm" %(1e9*fullp_res_edge(det,wavelength))
print "Nr. of resolution elements: %.2f" %(sample_size / fullp_res_corner(det,wavelength)*2)
plot_diffraction(o['entry_1']['data_1']['data'])
print "\n"<jupyter_output><empty_output><jupyter_text>Write to CXI file<jupyter_code>W = condor.utils.cxiwriter.CXIWriter("../data/single_protein_diffraction_pattern.h5")
W.write(o)
W.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1526407428903076, 'fraction_numerical': 0.030760301799187463, 'mean_word_length': 9.023255813953488, 'pattern_counts': {'":': 1, '<': 17, '<?xml version=': 0, '>': 17, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '217002', 'license': 'Apache-2.0', 'n_tokens_mistral': 732, 'n_tokens_neox': 683, 'n_words': 111, 'path': 'ipynb/simulate_protein_diffraction.ipynb', 'repo_name': 'daurer/phasing-tutorial', 'size': '1723'}