Simulation code for the paper: Yi G.S. and Grill W.M. Kilohertz waveforms optimized to produce closed-state Na+ channel inactivation eliminate onset response in nerve conduction block. PLoS Computational Biology, 2020. Hybrid_MRG --- for simulating nerve conductions in peripheral axons %% MRG model follows the reference: McIntyre CC, Richardson AG, and Grill WM. Modeling the excitability of mammalian nerve fibers: influence of afterpotentials on the recovery cycle. Journal of Neurophysiology 87:995-1006, 2002. %% Markov models of Nav 1.1 and Nav 1.6 currents in our manuscript follow the reference: Balbi P, Massobrio P, and Hellgren-Kotaleski J. A single Markov-type kinetic model accounting for the macroscopic currents of all human voltage-gated sodium channel isoforms. PLoS Compu Biol 13(9):e1005737, 2017. (1) Under Windows systems: -compile the mod files using the "mknrndll" in NEURON. - A double click on the MRGaxon_vol_clam.hoc file will open the simulation window by using PSO-generated voltage profile, which can generate the data in Fig 2, S1 Fig and S7 Fig. - A double click on the MRGaxon_point_source.hoc file will open the simulation window by using point source electrode, which can generate the data in Figs 3-5 and S2-S5 Fig. - A double click on the MRGaxon_bipolar_cuff.hoc file will open the simulation window by using bipolar cuff, which can generate the data in S6A Fig. - A double click on the MRGaxon_tripolar_cuff.hoc file will open the simulation window by using tripolar cuff, which can generate the data in S6B Fig. (2) Under Mac OS X systems: -Drag and drop the Hybrid_MRG folder onto the mknrndll icon in NEURON. -Drag and drop the following simulation files onto the nrngui icon in NEURON. - MRGaxon_vol_clam.hoc - MRGaxon_point_source.hoc - MRGaxon_bipolar_cuff.hoc - MRGaxon_tripolar_cuff.hoc Generate_Figures --- for generating each of the figures - Fig2 folder: running plotFig2.m in Matlab generates figures in Fig. 2 - Fig3 folder: running plotFig3.m in Matlab generates figures in Fig. 3 - Fig4 folder: running plotFig4.m in Matlab generates figures in Fig. 4 - Fig5 folder: running plotFig5.m in Matlab generates figures in Fig. 5 - S1_Fig folder: running plotS1Fig.m in Matlab generates figures in S1 Fig - S2_Fig folder: running plotS2Fig.m in Matlab generates figures in S2 Fig - S3_Fig folder: running plotS3Fig.m in Matlab generates figures in S3 Fig - S4_Fig folder: running plotS4Fig.m in Matlab generates figures in S4 Fig - S5_Fig folder: running plotS5Fig.m in Matlab generates figures in S5 Fig - S6_Fig folder: running plotS6Fig.m in Matlab generates figures in S6 Fig - S7_Fig folder: running plotS7Fig.m in Matlab generates figures in S7 Fig - S8_Fig folder: running plotS8Fig.m in Matlab generates figures in S8 Fig PSO_KHFAC --- for simulating KHFAC waveform optimization on the Duke Computing Cluster using particle swarm optimization with winner-takes-all, neighborhood-based connectivity %% Originally written by Tim Hoer %% Modified by Guosheng Yi and Nathan Titus - pso_optimize.m: main script - running starts optimization - all parameters should be included on this script - "swarm" array is initialization to be (number of particles per solution/waveform) by (number of neighborhoods) by (solutions per nbh) - each of swarm(:,x,y) represents a solution - particle.m: definition of particle object - contains all properties, setter methods, and sort method - initialize.m: initializes velocity and position for first run - called from pso_optimize.m - evaluates fitness without calling evaluate (first run only) - evaluate.m: evaluates and updates fitness - called from pso_optimize.m and initialize.m - evaluates cost function of each particle in solution waveform - calls write_timeCourse.m to write waveform to NEURON input file - calls runNrn.m to run NEURON simulation - calculates fitness - calls elect.m to reform neighborhoods - elect.m: reforms neighbors, selecting (or electing) global and neighborhood leaders - called from evaluate.m - write_timeCourse.m: write waveform to NEURON input file - passGo.m: performed every iteration to update particles - updates particle locations based on current velocity - set new velocity based on influencing agents - writeDat.m: writes fitness and location data to locDat.bin and fitDat.bin respectively - called every generation in current implementation - matBatch3.m: writes slurm file for each waveform to distribute NEURON evaluations across DCC machines - runNrn.m - Writes slurm files, launches simulations, and catches job ids. Version at main level of directory launches 5 simulations on each of 10 nodes (see slurm folder). The alternate folder contains a version of this script that submits each simulation as an individual job. - set_stimamp: overwrites output threshold in each Neuron simulation folder. - Because the bounds of the Neuron binary threshold search are determined by the previous threshold found, this function overwrites that value upon initialization of the swarm. - shift: aligns candidate solutions with global leader, effectively allowing particles to change dimension - called in elect.m - not recommended for non-waveform optimization (set xcorr = 0 in pso_optimize.m) - randomize.m: reinitializes particles while particles retain best location, fitness data - experimental feature, optionally called in pso_optimize.m - Neuron folder: contains simulation files for each waveform in population - base repository just contains 'wave1' - use copy.sh to create as many folders as simultaneous simulations needed - contains init.sh to create population folders - contains copy.sh to easy copy changes made in one folder to all other folders Yi G.S. and Grill W.M. guoshengyi@tju.edu.cn warren.grill@duke.edu