def __init__(self, filename, loadWork=True): """ Get data from header. Parameters ---------- filename : string Path to data file. loadWork : bool or 'r' Load dump arrays. (default: True) NOTE: if loadWork=='r', force re-extract dumps from data file. """ if get_env( 'FORCE_DAT', default=False, vartype=bool ): # enforce choice of data structure with custom relations between parameters _Dat.__init__(self, filename, loadWork=loadWork) elif get_env( 'FORCE_DAT0', default=False, vartype=bool ): # enforce choice of data structure from simulation with general parameters _Dat0.__init__(self, filename, loadWork=loadWork) else: # guess data structure try: _Dat.__init__( self, filename, loadWork=loadWork ) # simulation with custom relations between parameters except ValueError: _Dat0.__init__( self, filename, loadWork=loadWork) # simulation with general parameters
_N_cell = 100 # number of particles above which simulations should be launched with a cell list _exec_dir = path.join(path.dirname(path.realpath(__file__)), 'build') # default executable directory _exec_name = ['simulation0', 'simulation0_cell_list' ] # default executable name without and with a cell list _out_dir = _exec_dir # default simulation output directory # SCRIPT if __name__ == '__main__': # VARIABLE DEFINITIONS # INPUT FILE PARAMETERS inputFilename = get_env('INPUT_FILENAME', default='', vartype=str) # input file from which to copy data inputFrame = get_env('INPUT_FRAME', default=0, vartype=int) # frame to copy as initial frame if inputFilename == '': # SYSTEM PARAMETERS N = get_env('N', default=_N, vartype=int) # number of particles in the system Dr = get_env('DR', default=_Dr, vartype=float) # rotational diffusivity epsilon = get_env('EPSILON', default=Dr / 3., vartype=float) # coefficient parameter of potential v0 = get_env('V0', default=_v0, vartype=float) # self-propulsion velocity D = get_env('D', default=epsilon,
_period = 1 # default period of dumping of positions and orientations in number of frames _N_cell = 100 # number of particles above which simulations should be launched with a cell list _exec_dir = path.join(path.dirname(path.realpath(__file__)), 'build') # default executable directory _exec_name = ['simulation', 'simulation_cell_list'] # default executable name without and with a cell list _out_dir = _exec_dir # default simulation output directory # SCRIPT if __name__ == '__main__': # VARIABLE DEFINITIONS # INPUT FILE PARAMETERS inputFilename = get_env('INPUT_FILENAME', default='', vartype=str) # input file from which to copy data inputFrame = get_env('INPUT_FRAME', default=0, vartype=int) # frame to copy as initial frame if inputFilename == '': # SYSTEM PARAMETERS N = get_env('N', default=_N, vartype=int) # number of particles in the system lp = get_env('LP', default=_lp, vartype=float) # dimensionless persistence length phi = get_env('PHI', default=_phi, vartype=float) # packing fraction g = get_env('TORQUE_PARAMETER', default=0, vartype=float) # torque parameter else: # SYSTEM PARAMETERS with Dat(inputFilename, loadWork=False) as dat: # data object N = dat.N # number of particles in the system
axn.add_artist( plt.legend(loc='lower left', ncol=1, borderpad=0.025, handletextpad=0.2, handles=[ Line2D([0], [0], color='black', linestyle='--', label=r'$\nu^{\rm RTP}_{\rm end}$'), Line2D([0], [0], color='black', linestyle='-', label=r'$\nu^{\rm RTP}_{\rm ave}$') ])) fign.subplots_adjust(**adjust) # show and save if get_env('SAVE', default=False, vartype=bool): def save(f, fname): f.savefig(fname + '.eps') f.savefig(fname + '.svg') save(fig, 'exactPsiRTP') save(fign, 'exactNuRTP') if get_env('SHOW', default=True, vartype=bool): plt.show()
_N_cell = 100 # number of particles above which simulations should be launched with a cell list _exec_dir = path.join(path.dirname(path.realpath(__file__)), 'build') # default executable directory _exec_name = ['simulation', 'simulation_cell_list'] # default executable name without and with a cell list _slurm_path = path.join(path.dirname(path.realpath(__file__)), 'slurm.sh') # Slurm submitting script _out_dir = _exec_dir # default simulation output directory # SCRIPT if __name__ == '__main__': # VARIABLE DEFINITIONS # CLONING PARAMETERS nRuns = get_env('NRUNS', default=_nRuns, vartype=int) # number of different runs initSim = get_env('INITSIM', default=_initSim, vartype=int) # number of initial number of iterations to "randomise" the systems # BIASING PARAMETERS gMin = get_env('GMIN', default=_gMin, vartype=float) # minimum value of the torque parameter gMax = get_env('GMAX', default=_gMax, vartype=float) # maximum value of the torque parameter gNum = get_env('GNUM', default=_gNum, vartype=int) # number of values of the torque parameter gValues = np.linspace(gMin, gMax, gNum, endpoint=True) # array of values of the torque parameter # RANDOM SEEDS seed = get_env('SEED', default=_seed, vartype=int) # master random seed of master random seeds random.seed(seed) # set seed seeds = random.randint(1e7, size=(gNum, nRuns)) # master random seeds # SLURM PARAMETERS slurm = get_env('SLURM', default=False, vartype=bool) # use Slurm job scheduler (see active_work/slurm.sh)
} } # biasing with respect to polarisation _slurm_path = path.join(path.dirname(path.realpath(__file__)), 'slurm.sh') # Slurm submitting script _out_dir = _exec_dir # default simulation output directory # SCRIPT if __name__ == '__main__': # VARIABLE DEFINITIONS # CLONING PARAMETERS tmax = get_env('TMAX', default=_tmax, vartype=float) # dimensionless time to simulate nc = get_env('NC', default=_nc, vartype=int) # number of clones nRuns = get_env('NRUNS', default=_nRuns, vartype=int) # number of different runs initSim = get_env( 'INITSIM', default=_initSim, vartype=int ) # number of initial elementary number of iterations to "randomise" the systems # BIASING PARAMETERS sMin = get_env('SMIN', default=_sMin, vartype=float) # minimum value of the biasing parameter sMax = get_env('SMAX', default=_sMax, vartype=float) # maximum value of the biasing parameter sNum = get_env('SNUM', default=_sNum, vartype=int) # number of values of the biasing parameter sValues = np.linspace(
1: ('cloningR_B1', 'cloningR_B1_C') } # cloning bias `1' without and with control _slurm_path = path.join(path.dirname(path.realpath(__file__)), 'slurm.sh') # Slurm submitting script _out_dir = _exec_dir # default simulation output directory # SCRIPT if __name__ == '__main__': # VARIABLE DEFINITIONS # CLONING PARAMETERS tmax = get_env('TMAX', default=_tmax, vartype=float) # dimensionless time to simulate nc = get_env('NC', default=_nc, vartype=int) # number of clones nRuns = get_env('NRUNS', default=_nRuns, vartype=int) # number of different runs initSim = get_env( 'INITSIM', default=_initSim, vartype=int ) # number of initial elementary number of iterations to "randomise" the systems bias = get_env('CLONING_BIAS', default=_bias, vartype=int) # cloning bias # BIASING PARAMETERS sMin = get_env('SMIN', default=_sMin, vartype=float) # minimum value of the biasing parameter sMax = get_env('SMAX', default=_sMax, vartype=float) # maximum value of the biasing parameter sNum = get_env('SNUM', default=_sNum, vartype=int) # number of values of the biasing parameter
self.draw_circle( particle, color='black', fill=False, # draw black circle label=self.label) # SCRIPT if __name__ == '__main__': # executing as script startTime = datetime.now() # VARIABLE DEFINITIONS mode = get_env('MODE', default='orientation') # plotting mode if mode == 'orientation': plotting_object = Orientation elif mode == 'displacement': plotting_object = Displacement elif mode == 'velocity': plotting_object = Velocity elif mode == 'bare': plotting_object = Bare else: raise ValueError('Mode %s is not known.' % mode) # mode is not known dat_file = get_env('DAT_FILE', default=joinpath(getcwd(), 'out.dat')) # data file dat = Dat(dat_file, loadWork=False) # data object
_period = 1 # default period of dumping of orientations in number of frames _exec_dir = path.join(path.dirname(path.realpath(__file__)), 'build') # default executable directory _exec_name = 'rotors' # default executable name _out_dir = _exec_dir # default simulation output directory # SCRIPT if __name__ == '__main__': # VARIABLE DEFINITIONS # SYSTEM PARAMETERS N = get_env('N', default=_N, vartype=int) # number of particles in the system Dr = get_env('DR', default=_Dr, vartype=float) # rotational diffusivity g = get_env('G', default=-Dr / 2, vartype=float) # aligning torque parameter # SIMULATION PARAMETERS seed = get_env('SEED', default=_seed, vartype=int) # random seed dt = get_env('DT', default=_dt, vartype=float) # time step Niter = get_env('NITER', default=_Niter, vartype=int) # number of iterations # NAMING PARAMETERS launch = get_env('LAUNCH', default=_launch, vartype=float) # launch identifier # OUTPUT PARAMETERS