src/setup.py
def read_shell_input(current_dir, sim_dir, input_file_name=False, verbosity=True):
	"""
	read_shell_input(current_dir, sim_dir)

	Reads bash shell tags to gather simulation and analysis parameters.
	Order of input methods: default_param < input_file < inline tags < param_file 

	Parameters
	----------

	current_dir:  str
		Working directory from which ColECM excecutable is called

	sim_dir:  str
		Directory in which simulation files are to be saved

	Returns
	-------

	file_names:  list (str)
		List of simulation and analysis files names

	param:  dict
		Dictionary of simulation and analysis parameters
	"""

	file_names = get_file_name_defaults()
	param = get_param_defaults()

	if input_file_name: file_names, _ = read_input_file(input_file_name, files=True, file_names=file_names)

	file_names =  check_file_names(sys.argv, file_names=file_names)

	if not file_names['param_file_name']: 
		file_names['param_file_name'] = input("Enter param_file name: ")
		check_file_names(sys.argv, file_names=file_names)
	if not file_names['pos_file_name']: 
		file_names['pos_file_name'] = input("Enter pos_file name: ")
		check_file_names(sys.argv, file_names=file_names)

	keys = ['n_dim', 'dt', 'mass', 'vdw_sigma', 'vdw_epsilon', 'bond_r0', 'bond_k0', 'angle_theta0', 
			'angle_k0', 'rc', 'kBT', 'gamma', 'sigma', 'l_fibril', 'n_fibril_x', 'n_fibril_y', 
			'n_fibril_z', 'n_fibril', 'n_bead', 'density']

	if os.path.exists(sim_dir + file_names['param_file_name'] + '.pkl'):
		if verbosity: print(" Loading parameter file {}.pkl".format(sim_dir + file_names['param_file_name']))
		param_file = ut.read_param_file(sim_dir + file_names['param_file_name'])

		"""
		if param_file['l_fibre']:
			fibre_keys = ['l_fibre', 'n_fibre_x', 'n_fibre_y', 'n_fibre_z', 'n_fibre']			
			fibril_keys = ['l_fibril', 'n_fibril_x', 'n_fibril_y', 'n_fibril_z', 'n_fibril']
			for i, key in enumerate(fibril_keys): param_file[key] = param_file.pop(fibre_keys[i])

			ut.make_param_file(sim_dir + file_names['param_file_name'])
			for key in keys: ut.update_param_file(sim_dir + file_names['param_file_name'], key, param[key])
		"""

		for key in keys: param[key] = param_file[key]		
		for key in ['bond_matrix', 'angle_array', 'vdw_matrix']: param[key] = param_file[key]

	else:
		if input_file_name: _, param = read_input_file(input_file_name, simulation=True, param=param)
		param = check_sim_param(sys.argv, param)

		if verbosity: print(" Creating parameter file {}.pkl".format(sim_dir + file_names['param_file_name'])) 
		ut.make_param_file(sim_dir + file_names['param_file_name'])
		for key in keys: ut.update_param_file(sim_dir + file_names['param_file_name'], key, param[key])
		
	assert param['n_dim'] in [2, 3]
	assert param['rc'] >= 1.5 * param['vdw_sigma']

	if ('-nstep' in sys.argv): param['n_step'] = int(sys.argv[sys.argv.index('-nstep') + 1])
	if ('-save_step' in sys.argv): param['save_step'] = int(sys.argv[sys.argv.index('-save_step') + 1])

	param = check_analysis_param(sys.argv, param)

	if verbosity: 
		print(" Parameters found:")
		for key in keys: print(" {:<15s} : {}".format(key, param[key]))	

	return file_names, param

	read_shell_input(current_dir, sim_dir)

	Reads bash shell tags to gather simulation and analysis parameters.
	Order of input methods: default_param < input_file < inline tags < param_file 

	Parameters
	----------

	current_dir:  str
		Working directory from which ColECM excecutable is called

	sim_dir:  str
		Directory in which simulation files are to be saved

	Returns
	-------

	file_names:  list (str)
		List of simulation and analysis files names

	param:  dict
		Dictionary of simulation and analysis parameters
	
read_shell_input(current_dir, sim_dir)
Reads bash shell tags to gather simulation and analysis parameters.
Order of input methods: default_param < input_file < inline tags < param_file

Parameters

str
Working directory from which ColECM excecutable is called

str
Directory in which simulation files are to be saved

Returns

list (str)
List of simulation and analysis files names

dict
Dictionary of simulation and analysis parameters
read_shell_input ( current_dir sim_dir ) Reads bash shell tags to gather simulation and analysis parameters . Order of input methods : default_param < input_file < inline tags < param_file Parameters str Working directory from which ColECM excecutable is called str Directory in which simulation files are to be saved Returns list ( str ) List of simulation and analysis files names dict Dictionary of simulation and analysis parameters
def read_shell_input(current_dir, sim_dir, input_file_name=False, verbosity=True):
	file_names = get_file_name_defaults()
	param = get_param_defaults()
	if input_file_name: file_names, _ = read_input_file(input_file_name, files=True, file_names=file_names)
	file_names =  check_file_names(sys.argv, file_names=file_names)
	if not file_names['param_file_name']: 
		file_names['param_file_name'] = input("Enter param_file name: ")
		check_file_names(sys.argv, file_names=file_names)
	if not file_names['pos_file_name']: 
		file_names['pos_file_name'] = input("Enter pos_file name: ")
		check_file_names(sys.argv, file_names=file_names)
	keys = ['n_dim', 'dt', 'mass', 'vdw_sigma', 'vdw_epsilon', 'bond_r0', 'bond_k0', 'angle_theta0', 
			'angle_k0', 'rc', 'kBT', 'gamma', 'sigma', 'l_fibril', 'n_fibril_x', 'n_fibril_y', 
			'n_fibril_z', 'n_fibril', 'n_bead', 'density']
	if os.path.exists(sim_dir + file_names['param_file_name'] + '.pkl'):
		if verbosity: print(" Loading parameter file {}.pkl".format(sim_dir + file_names['param_file_name']))
		param_file = ut.read_param_file(sim_dir + file_names['param_file_name'])
		for key in keys: param[key] = param_file[key]		
		for key in ['bond_matrix', 'angle_array', 'vdw_matrix']: param[key] = param_file[key]
	else:
		if input_file_name: _, param = read_input_file(input_file_name, simulation=True, param=param)
		param = check_sim_param(sys.argv, param)
		if verbosity: print(" Creating parameter file {}.pkl".format(sim_dir + file_names['param_file_name'])) 
		ut.make_param_file(sim_dir + file_names['param_file_name'])
		for key in keys: ut.update_param_file(sim_dir + file_names['param_file_name'], key, param[key])
	assert param['n_dim'] in [2, 3]
	assert param['rc'] >= 1.5 * param['vdw_sigma']
	if ('-nstep' in sys.argv): param['n_step'] = int(sys.argv[sys.argv.index('-nstep') + 1])
	if ('-save_step' in sys.argv): param['save_step'] = int(sys.argv[sys.argv.index('-save_step') + 1])
	param = check_analysis_param(sys.argv, param)
	if verbosity: 
		print(" Parameters found:")
		for key in keys: print(" {:<15s} : {}".format(key, param[key]))	
	return file_names, param
def read_shell_input ( current_dir , sim_dir , input_file_name = False , verbosity = True ) : file_names = get_file_name_defaults ( ) param = get_param_defaults ( ) if input_file_name : file_names , _ = read_input_file ( input_file_name , files = True , file_names = file_names ) file_names = check_file_names ( sys . argv , file_names = file_names ) if not file_names [ 'param_file_name' ] : file_names [ 'param_file_name' ] = input ( "Enter param_file name: " ) check_file_names ( sys . argv , file_names = file_names ) if not file_names [ 'pos_file_name' ] : file_names [ 'pos_file_name' ] = input ( "Enter pos_file name: " ) check_file_names ( sys . argv , file_names = file_names ) keys = [ 'n_dim' , 'dt' , 'mass' , 'vdw_sigma' , 'vdw_epsilon' , 'bond_r0' , 'bond_k0' , 'angle_theta0' , 'angle_k0' , 'rc' , 'kBT' , 'gamma' , 'sigma' , 'l_fibril' , 'n_fibril_x' , 'n_fibril_y' , 'n_fibril_z' , 'n_fibril' , 'n_bead' , 'density' ] if os . path . exists ( sim_dir + file_names [ 'param_file_name' ] + '.pkl' ) : if verbosity : print ( " Loading parameter file {}.pkl" . format ( sim_dir + file_names [ 'param_file_name' ] ) ) param_file = ut . read_param_file ( sim_dir + file_names [ 'param_file_name' ] ) """
		if param_file['l_fibre']:
			fibre_keys = ['l_fibre', 'n_fibre_x', 'n_fibre_y', 'n_fibre_z', 'n_fibre']			
			fibril_keys = ['l_fibril', 'n_fibril_x', 'n_fibril_y', 'n_fibril_z', 'n_fibril']
			for i, key in enumerate(fibril_keys): param_file[key] = param_file.pop(fibre_keys[i])

			ut.make_param_file(sim_dir + file_names['param_file_name'])
			for key in keys: ut.update_param_file(sim_dir + file_names['param_file_name'], key, param[key])
		""" for key in keys : param [ key ] = param_file [ key ] for key in [ 'bond_matrix' , 'angle_array' , 'vdw_matrix' ] : param [ key ] = param_file [ key ] else : if input_file_name : _ , param = read_input_file ( input_file_name , simulation = True , param = param ) param = check_sim_param ( sys . argv , param ) if verbosity : print ( " Creating parameter file {}.pkl" . format ( sim_dir + file_names [ 'param_file_name' ] ) ) ut . make_param_file ( sim_dir + file_names [ 'param_file_name' ] ) for key in keys : ut . update_param_file ( sim_dir + file_names [ 'param_file_name' ] , key , param [ key ] ) assert param [ 'n_dim' ] in [ 2 , 3 ] assert param [ 'rc' ] >= 1.5 * param [ 'vdw_sigma' ] if ( '-nstep' in sys . argv ) : param [ 'n_step' ] = int ( sys . argv [ sys . argv . index ( '-nstep' ) + 1 ] ) if ( '-save_step' in sys . argv ) : param [ 'save_step' ] = int ( sys . argv [ sys . argv . index ( '-save_step' ) + 1 ] ) param = check_analysis_param ( sys . argv , param ) if verbosity : print ( " Parameters found:" ) for key in keys : print ( " {:<15s} : {}" . format ( key , param [ key ] ) ) return file_names , param
read_shell_input(current_dir, sim_dir)
Reads bash shell tags to gather simulation and analysis parameters.
read_shell_input ( current_dir sim_dir ) Reads bash shell tags to gather simulation and analysis parameters .
"""
	read_shell_input(current_dir, sim_dir)

	Reads bash shell tags to gather simulation and analysis parameters.
	Order of input methods: default_param < input_file < inline tags < param_file 

	Parameters
	----------

	current_dir:  str
		Working directory from which ColECM excecutable is called

	sim_dir:  str
		Directory in which simulation files are to be saved

	Returns
	-------

	file_names:  list (str)
		List of simulation and analysis files names

	param:  dict
		Dictionary of simulation and analysis parameters
	""" """
		if param_file['l_fibre']:
			fibre_keys = ['l_fibre', 'n_fibre_x', 'n_fibre_y', 'n_fibre_z', 'n_fibre']			
			fibril_keys = ['l_fibril', 'n_fibril_x', 'n_fibril_y', 'n_fibril_z', 'n_fibril']
			for i, key in enumerate(fibril_keys): param_file[key] = param_file.pop(fibre_keys[i])

			ut.make_param_file(sim_dir + file_names['param_file_name'])
			for key in keys: ut.update_param_file(sim_dir + file_names['param_file_name'], key, param[key])
		"""
current_dir
sim_dir
input_file_name
verbosity