def get_param_values(self, model_info=None, sim_index=None): """Return a vector of parameter values. @keyword model_info: The model information from model_loop(). This is unused. @type model_info: None @keyword sim_index: The Monte Carlo simulation index. @type sim_index: int @return: The vector of parameter values. @rtype: list of str """ # Assemble the values and return it. return assemble_param_vector(sim_index=sim_index)
def get_param_values(self, model_info=None, sim_index=None): """Return a vector of parameter values. @keyword model_info: The model information from model_loop(). This is unused. @type model_info: None @keyword sim_index: The Monte Carlo simulation index. @type sim_index: int @return: The vector of parameter values. @rtype: list of str """ # Assemble the values and return it. return assemble_param_vector(sim_index=sim_index)
def distribute(file="distribution.pdb.bz2", dir=None, atom_id=None, total=1000, max_rotations=100000, model=1, force=True): """Create a uniform distribution of structures for the frame order motions. @keyword file: The PDB file for storing the frame order motional distribution. The compression is determined automatically by the file extensions '*.pdb', '*.pdb.gz', and '*.pdb.bz2'. @type file: str @keyword dir: The directory name to place the file into. @type dir: str or None @keyword atom_id: The atom identification string to allow the distribution to be a subset of all atoms. @type atom_id: None or str @keyword total: The total number of states/model/structures in the distribution. @type total: int @keyword max_rotations: The maximum number of rotations to generate the distribution from. This prevents an execution for an infinite amount of time when a frame order amplitude parameter is close to zero so that the subset of all rotations within the distribution is close to zero. @type max_rotations: int @keyword model: Only one model from an analysed ensemble of structures can be used for the distribution, as the corresponding PDB file consists of one model per state. @type model: int @keyword force: A flag which, if set to True, will overwrite the any pre-existing file. @type force: bool """ # Printout. print("Uniform distribution of structures representing the frame order motions.") # Check the total. if total > 9999: raise RelaxError("A maximum of 9999 models is allowed in the PDB format.") # Checks. check_pipe() check_model() check_domain() check_parameters() check_pivot() # Skip the rigid model. if cdp.model == MODEL_RIGID: print("Skipping the rigid model.") return # Open the output file. file = open_write_file(file_name=file, dir=dir, force=force) # The parameter values. values = assemble_param_vector() params = {} i = 0 for name in cdp.params: params[name] = values[i] i += 1 # The structure. structure = deepcopy(cdp.structure) if structure.num_models() > 1: structure.collapse_ensemble(model_num=model) # The pivot points. num_states = 1 if cdp.model == MODEL_DOUBLE_ROTOR: num_states = 2 pivot = zeros((num_states, 3), float64) for i in range(num_states): pivot[i] = generate_pivot(order=i+1, pdb_limit=True) # Shift to the average position. average_position(structure=structure, models=[None]) # The motional eigenframe. frame = generate_axis_system() # Only work with a subset. if atom_id: # The inverted selection. selection = structure.selection(atom_id=atom_id, inv=True) # Delete the data. structure.delete(selection=selection, verbosity=0) # Create the distribution. uniform_distribution(file=file, model=cdp.model, structure=structure, parameters=params, eigenframe=frame, pivot=pivot, atom_id=domain_moving(), total=total, max_rotations=max_rotations) # Close the file. file.close()
def simulate(file="simulation.pdb.bz2", dir=None, step_size=2.0, snapshot=10, total=1000, model=1, force=True): """Pseudo-Brownian dynamics simulation of the frame order motions. @keyword file: The PDB file for storing the frame order pseudo-Brownian dynamics simulation. The compression is determined automatically by the file extensions '*.pdb', '*.pdb.gz', and '*.pdb.bz2'. @type file: str @keyword dir: The directory name to place the file into. @type dir: str or None @keyword step_size: The rotation will be of a random direction but with this fixed angle. The value is in degrees. @type step_size: float @keyword snapshot: The number of steps in the simulation when snapshots will be taken. @type snapshot: int @keyword total: The total number of snapshots to take before stopping the simulation. @type total: int @keyword model: Only one model from an analysed ensemble of structures can be used for the pseudo-Brownian simulation, as the simulation and corresponding PDB file consists of one model per simulation. @type model: int @keyword force: A flag which, if set to True, will overwrite the any pre-existing file. @type force: bool """ # Printout. print("Pseudo-Brownian dynamics simulation of the frame order motions.") # Checks. check_pipe() check_model() check_domain() check_parameters() check_pivot() # Skip the rigid model. if cdp.model == MODEL_RIGID: print("Skipping the rigid model.") return # Open the output file. file = open_write_file(file_name=file, dir=dir, force=force) # The parameter values. values = assemble_param_vector() params = {} i = 0 for name in cdp.params: params[name] = values[i] i += 1 # The structure. structure = deepcopy(cdp.structure) if structure.num_models() > 1: structure.collapse_ensemble(model_num=model) # The pivot points. num_states = 1 if cdp.model == MODEL_DOUBLE_ROTOR: num_states = 2 pivot = zeros((num_states, 3), float64) for i in range(num_states): pivot[i] = generate_pivot(order=i+1, pdb_limit=True) # Shift to the average position. average_position(structure=structure, models=[None]) # The motional eigenframe. frame = generate_axis_system() # Create the distribution. brownian(file=file, model=cdp.model, structure=structure, parameters=params, eigenframe=frame, pivot=pivot, atom_id=domain_moving(), step_size=step_size, snapshot=snapshot, total=total) # Close the file. file.close()
def simulate(file="simulation.pdb.bz2", dir=None, step_size=2.0, snapshot=10, total=1000, model=1, force=True): """Pseudo-Brownian dynamics simulation of the frame order motions. @keyword file: The PDB file for storing the frame order pseudo-Brownian dynamics simulation. The compression is determined automatically by the file extensions '*.pdb', '*.pdb.gz', and '*.pdb.bz2'. @type file: str @keyword dir: The directory name to place the file into. @type dir: str or None @keyword step_size: The rotation will be of a random direction but with this fixed angle. The value is in degrees. @type step_size: float @keyword snapshot: The number of steps in the simulation when snapshots will be taken. @type snapshot: int @keyword total: The total number of snapshots to take before stopping the simulation. @type total: int @keyword model: Only one model from an analysed ensemble of structures can be used for the pseudo-Brownian simulation, as the simulation and corresponding PDB file consists of one model per simulation. @type model: int @keyword force: A flag which, if set to True, will overwrite the any pre-existing file. @type force: bool """ # Printout. print("Pseudo-Brownian dynamics simulation of the frame order motions.") # Checks. check_pipe() check_model() check_domain() check_parameters() check_pivot() # Skip the rigid model. if cdp.model == MODEL_RIGID: print("Skipping the rigid model.") return # Open the output file. file = open_write_file(file_name=file, dir=dir, force=force) # The parameter values. values = assemble_param_vector() params = {} i = 0 for name in cdp.params: params[name] = values[i] i += 1 # The structure. structure = deepcopy(cdp.structure) if structure.num_models() > 1: structure.collapse_ensemble(model_num=model) # The pivot points. num_states = 1 if cdp.model == MODEL_DOUBLE_ROTOR: num_states = 2 pivot = zeros((num_states, 3), float64) for i in range(num_states): pivot[i] = generate_pivot(order=i + 1, pdb_limit=True) # Shift to the average position. average_position(structure=structure, models=[None]) # The motional eigenframe. frame = generate_axis_system() # Create the distribution. brownian(file=file, model=cdp.model, structure=structure, parameters=params, eigenframe=frame, pivot=pivot, atom_id=domain_moving(), step_size=step_size, snapshot=snapshot, total=total) # Close the file. file.close()
def distribute(file="distribution.pdb.bz2", dir=None, atom_id=None, total=1000, max_rotations=100000, model=1, force=True): """Create a uniform distribution of structures for the frame order motions. @keyword file: The PDB file for storing the frame order motional distribution. The compression is determined automatically by the file extensions '*.pdb', '*.pdb.gz', and '*.pdb.bz2'. @type file: str @keyword dir: The directory name to place the file into. @type dir: str or None @keyword atom_id: The atom identification string to allow the distribution to be a subset of all atoms. @type atom_id: None or str @keyword total: The total number of states/model/structures in the distribution. @type total: int @keyword max_rotations: The maximum number of rotations to generate the distribution from. This prevents an execution for an infinite amount of time when a frame order amplitude parameter is close to zero so that the subset of all rotations within the distribution is close to zero. @type max_rotations: int @keyword model: Only one model from an analysed ensemble of structures can be used for the distribution, as the corresponding PDB file consists of one model per state. @type model: int @keyword force: A flag which, if set to True, will overwrite the any pre-existing file. @type force: bool """ # Printout. print( "Uniform distribution of structures representing the frame order motions." ) # Check the total. if total > 9999: raise RelaxError( "A maximum of 9999 models is allowed in the PDB format.") # Checks. check_pipe() check_model() check_domain() check_parameters() check_pivot() # Skip the rigid model. if cdp.model == MODEL_RIGID: print("Skipping the rigid model.") return # Open the output file. file = open_write_file(file_name=file, dir=dir, force=force) # The parameter values. values = assemble_param_vector() params = {} i = 0 for name in cdp.params: params[name] = values[i] i += 1 # The structure. structure = deepcopy(cdp.structure) if structure.num_models() > 1: structure.collapse_ensemble(model_num=model) # The pivot points. num_states = 1 if cdp.model == MODEL_DOUBLE_ROTOR: num_states = 2 pivot = zeros((num_states, 3), float64) for i in range(num_states): pivot[i] = generate_pivot(order=i + 1, pdb_limit=True) # Shift to the average position. average_position(structure=structure, models=[None]) # The motional eigenframe. frame = generate_axis_system() # Only work with a subset. if atom_id: # The inverted selection. selection = structure.selection(atom_id=atom_id, inv=True) # Delete the data. structure.delete(selection=selection, verbosity=0) # Create the distribution. uniform_distribution(file=file, model=cdp.model, structure=structure, parameters=params, eigenframe=frame, pivot=pivot, atom_id=domain_moving(), total=total, max_rotations=max_rotations) # Close the file. file.close()