## Parameter file belonging to PDinsight.py
## This script computes the requirements for obtaining a given target effective wall permeability (Peff) through diffusive symplastic transport and/or values of Peff given all parameters. 
## All output is written to files, tsv (tab separated values) format, with names indicated with the respective modes/switches.
## The first (or sometimes second/..) line of each output file contains the column headers. 
## This script belongs to the manuscript .... Deinum et al 2019, ... . When using this script, please cite Deinum et al 2019. 
## In this script, PDs are modeled as a set of concentric cylinders. The space available for symplastic transport, the cytoplasmic sleeve, is confined between desmotubule (DT, radius Rdt) and outer radius (Rn, neck radius and/or Rc, central radius). 
### If Rn == Rc, as is the case in most computations in this script, the parameter Lneck (length of the neck region) does not have any effect.
### We found that Fih, a correction factor for the fact that the cell wall is only permeable at discrete spots (the PDs), does not depend on Lcell, the cell length. This parameter, therefore, also has no effect.

## Script usage: python PDinsight.py [PARFILE]
## where PARFILE is the name of the parameter file. If no name is given, the script looks for "parameters.txt" in the current directory.
## Alternatively (linux), make the script executable and type ./PDinsight.py [PARFILE]
## After reading, all parameters are printed to "allParameters.txt"

## switches for computing. Choose between 1 ("True") and 0 ("False").
compSubNano 0 # switch: compare with sub-nano channel model; conversion factors are written to file "densityConversionFactorTable.dat"; these are only valid for sufficiently narrow channels. 
computeClusterIncrease 0 # switch: consider (repeated) twinning from the starting densities in densList rather than homogeneous (high) densities. Useful for computing requirements for a sudden increase of Peff. ; only affects computeAperture and computeVals

# Modes for computing tables
computeDens 0 # switch: calculate required densities for Peff targets in peList and alpha_bar values in xMaxList ; output is written to file "requiredDensityTable.dat"
computeAperture 0 ## calculate required alpha_bar and Rn values for Peff targets in peList and densities in densList; if computeClusterIncrease == True: calculate required alpha_bar and Rn values for Peff targets in peList, starting densities in densList and the n-fold increase in clusters from twinningList ; output is written to file "requiredApertureTable.dat"
computeVals 0 # calculate Peff values from all given combinations of variable parameters: densList x xMaxList [[ x RcList]] x ....

# Modes for computing graphs (high resolution tables that can be plotted with a graphics program of choice)
computeRnDensityGraph 1 # switch: compute Rn, rho graphs that yield target Peff in peList. Rn is increased by steps of xStep; Rn runs from Rdt+xStart to Rdt + xMax; incompatible with compSubNano, because correction factors can't be used for large Rn

# Modes for computing tables with inhomogeneity correction factor Fih
computeFih_subNano 0 # switch: compute Fih values for default and sub-nano channel model; results are written to files "Fih_subNano_densXX_lXX.dat", where XX are the respective parameter values.
computeFih_pitField_xMax 0 # switch: compute Fih for pit fields as a function of maximum particle radius (xMax / alpha_bar) ; results are written to files Fih_xMax_pit_RnXX_dXX_lXX.dat", where XX are the respective parameter values.
computeFih_pitField_dens 0 # switch: compute Fih for pit fields as a function of PD density (rho); results are written to files Fih_dens_pit_RnXX_dXX_lXX.dat", where XX are the respective parameter values.  
# Related to Fih: compute tables with impact of (repeated) twinning on total Peff
computeTwinning 0 # switch: compute impact on Peff due to twinning, starting from isolated PDs that follow the distribution of parameter grid.; results are written to files "twinning_pit_RnXX_dXX_lXX.dat", where XX are the respective parameter values.   


## Shared Parameters
## length for most parameters in nm, except for diff, dens/pdDens and Lcell which use um
## internally, all lengths are in nm, which are converted back to um in the output where appropriate
x   0.5 # particle radius (nm) # x = 0.5 nm is used for carboxyfluorescein. This parametrs is called alpha in manuscript
Lpd 100. # PD length. Usually similar to cell wall thickness. 
diff   162 # particle diffusion constant (in um2/s) 162 is used for carboxyfluorescein (following Rutschow et al 2011)

Lneck 25. # neck region length. Only affects results for channels with a dilated central region (Rc > Rn); default 25; reasonable range probably 20 - 30 nm; necked PDs are mostly/only observed in thicker cell walls, i.e., Lpd >= 200 nm; has no effect in modes computeDens and computeAperture. 
Rdt   8. # Desmotubule (DT) radius; default: 8 nm; typical range: 7.5 - 9.5 nm
Lcell 10 # cell length (in um) ; does not affect Peff, Fih, etc. The model is only valid if Lcell > spacing between PDs (or pit fields); default: 10 um.
grid triangular # distribution of PDs on regular grid. Choose from: triangular, square, hexagonal or hex, and random; default triangular
dPit 120. # centre-to-centre distance between PDs within a pit field. Only required when exploring twinning/clustering; default 120 nm. 

## Shared parameter lists
peList 1 6 8.5 25 # list of target permeabilities (Peff) in um/s
xMaxList  2.   2.5  3.  3.4  3.5  4.   # list of maximum particle sizes (also alpha_bar): corresponding densities will be computed for obtaining target permeabilities
densList  2.5 5 10  13     # list of target densities (in PDs/um2): corresponding xMax and Rn (neck radius) values will be computed for obtaining target permeabilities
twinningList 1 2 3 4 5 6 7 12 19       # fold-increases for density through (repeated) twinning. Only used if computeClusterIncrease == True. The list should include 1 to compute the reference values before twinning ; So far  only used in computing required xMax / Rn given (starting) densities in densList. Allowed numbers: 1,2,3,4,5,6,7,12,19. 

## parameters used for computeVals
RcList 0 # varying central region radius Rc; so far, only used for computeVals; if Rc < Rn, only a single value is computed for Rc == Rn, regardless of number of Rc values < Rn. ; default: 0, i.e., straight channels. 

## parameters used in computing correction factor Fih / twinning effect; also used for computeVals
pitList 1 2 3 ## Number of PDs per pit field. Allowed numbers: 1,2,3,4,5,6,7,12,19. ; Used for computing Fih in pit fields and twinning effect, and computeVals.  
dPitList   100 120 ## Center-to-center distance between PDs within pit field
LpdList 100. 200. 500. # PD length ; the list is only used for computing Fih in pit fields and twinning effect.
  pitDens 2. # pit density; only used for computing Fih in pit fields as a function of xMax (computeFih_pitField_xMax)
RnList 12. 14. # Neck radius Rn ; the list is only used for computing Fih in pit fields and twinning effect.

## parameters used in computing Rn, Density graphs
xStep   0.1 # increment of xMax = alpha_bar; Rn is incremented with 2*xStep
xStart   1. # starting value of xMax
xMax   36.  # final value of xMax. Rn = Rdt + 2*xMax

## numerical parameters 
dInc   0.1 # step size for finding target density (followed by linear interpolation)
xInc   0.01 # step size for finding target PD aperture (alpha_bar, Rn) (followed by linear interpolation)

