See Supplementary Methods for detailed methods. Constructs with Arch, Mac, and Halo are available at http://syntheticneurobiology.org/protocols. In brief, codon-optimized genes were synthesized by Genscript and fused to GFP in lentiviral and mammalian expression vectors as used previously5 (link),23 (link) for transfection or viral infection of neurons. Primary hippocampal or cortical neurons were cultured and then transfected with plasmids or infected with viruses encoding for genes of interest, as described previously5 (link). Images were taken using a Zeiss LSM 510 confocal microscope. Patch clamp recordings were made using glass microelectrodes and a Multiclamp 700B/Digidata electrophysiology setup, using appropriate pipette and bath solutions for the experimental goal at hand. Neural pH imaging was done using carboxy-SNARF-1-AM ester (Invitrogen). Cell health was assayed using Trypan blue staining (Gibco). HEK cells were cultured and patch clamped using standard protocols. Mutagenesis was performed using the QuikChange kit (Stratagene). Computational modelling of light propagation was done with Monte Carlo simulation with MATLAB. In vivo recordings were made on headfixed awake mice, which were surgically injected with lentivirus, and implanted with a headplate as described before23 (link). Glass pipettes attached to laser-coupled optical fibers were inserted into the brain, to record neural activity during laser illumination in a photoelectrochemical artifact-free way. Data analysis was performed using Clampfit, Excel, Origin, and MATLAB. Histology was performed using transcardial formaldehyde perfusion followed by sectioning and subsequent confocal imaging.