Author: bugman
Date: Fri Sep 19 18:26:26 2014
New Revision: 25926
URL: http://svn.gna.org/viewcvs/relax?rev=25926&view=rev
Log:
Spun out part of the frame_order.pdb_model user function into the new
frame_order.simulate.
The new user function arguments required for properly creating the
pseudo-Brownian dynamics
simulation would have made the frame_order.pdb_model user function too
complicated. Therefore this
part has been spun out into the new frame_order.simulate user function. The
frame_order.simulate
frontend fully describes the algorithm that will be used to simulate the
dynamic content of the PCS
and RDC data, and warns that not all modes of motion are visible and present.
Modified:
branches/frame_order_cleanup/specific_analyses/frame_order/uf.py
branches/frame_order_cleanup/user_functions/frame_order.py
Modified: branches/frame_order_cleanup/specific_analyses/frame_order/uf.py
URL:
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/uf.py?rev=25926&r1=25925&r2=25926&view=diff
==============================================================================
--- branches/frame_order_cleanup/specific_analyses/frame_order/uf.py
(original)
+++ branches/frame_order_cleanup/specific_analyses/frame_order/uf.py Fri Sep
19 18:26:26 2014
@@ -43,7 +43,7 @@
from specific_analyses.frame_order.variables import MODEL_ISO_CONE,
MODEL_ISO_CONE_FREE_ROTOR, MODEL_ISO_CONE_TORSIONLESS, MODEL_LIST,
MODEL_LIST_FREE_ROTORS, MODEL_LIST_ISO_CONE, MODEL_LIST_PSEUDO_ELLIPSE,
MODEL_LIST_RESTRICTED_TORSION, MODEL_PSEUDO_ELLIPSE,
MODEL_PSEUDO_ELLIPSE_TORSIONLESS, MODEL_RIGID
-def pdb_model(ave_pos="ave_pos", rep="frame_order",
dist="domain_distribution", dir=None, compress_type=0, size=30.0, inc=36,
model=1, force=False):
+def pdb_model(ave_pos="ave_pos", rep="frame_order", dir=None, compress_type=0,
size=30.0, inc=36, model=1, force=False):
"""Create 3 different PDB files for representing the frame order dynamics
of the system.
@keyword ave_pos: The file root for the average molecule structure.
@@ -85,10 +85,6 @@
if rep:
create_geometric_rep(file=rep, dir=dir, compress_type=compress_type,
size=size, inc=inc, force=force)
- # Create the distribution.
- if dist:
- create_distribution(file=dist, dir=dir, compress_type=compress_type,
model=model, force=force)
-
def permute_axes(permutation='A'):
"""Permute the axes of the motional eigenframe to switch between local
minima.
@@ -367,6 +363,29 @@
update_model()
+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
+ """
+
+ # Create the distribution.
+ create_distribution(file=dist, dir=dir, model=model, force=force)
+
+
def sobol_setup(max_num=200, oversample=100):
"""Oversampling setup for the quasi-random Sobol' sequence used for
numerical PCS integration.
Modified: branches/frame_order_cleanup/user_functions/frame_order.py
URL:
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/user_functions/frame_order.py?rev=25926&r1=25925&r2=25926&view=diff
==============================================================================
--- branches/frame_order_cleanup/user_functions/frame_order.py (original)
+++ branches/frame_order_cleanup/user_functions/frame_order.py Fri Sep 19
18:26:26 2014
@@ -22,14 +22,23 @@
# Module docstring.
"""The frame_order user function definitions."""
+# Python module imports.
+import dep_check
+if dep_check.wx_module:
+ from wx import FD_OPEN, FD_SAVE
+else:
+ FD_OPEN = -1
+ FD_SAVE = -1
+
# relax module imports.
from graphics import WIZARD_IMAGE_PATH
from specific_analyses.frame_order.optimisation import count_sobol_points
-from specific_analyses.frame_order.uf import sobol_setup, pdb_model,
permute_axes, pivot, ref_domain, select_model
+from specific_analyses.frame_order.uf import sobol_setup, pdb_model,
permute_axes, pivot, ref_domain, select_model, simulate
from specific_analyses.frame_order.variables import MODEL_DOUBLE_ROTOR,
MODEL_FREE_ROTOR, MODEL_ISO_CONE, MODEL_ISO_CONE_FREE_ROTOR,
MODEL_ISO_CONE_TORSIONLESS, MODEL_PSEUDO_ELLIPSE,
MODEL_PSEUDO_ELLIPSE_FREE_ROTOR, MODEL_PSEUDO_ELLIPSE_TORSIONLESS, MODEL_RIGID,
MODEL_ROTOR
from user_functions.data import Uf_info; uf_info = Uf_info()
from user_functions.data import Uf_tables; uf_tables = Uf_tables()
from user_functions.objects import Desc_container
+from user_functions.wildcards import WILDCARD_RELAX_SAVE
# The user function class.
@@ -73,15 +82,6 @@
arg_type = "str",
desc_short = "PDB representation file root",
desc = "The file root of the PDB file for the geometric object
representation of the frame order dynamics.",
- can_be_none = True
-)
-uf.add_keyarg(
- name = "dist",
- default = "domain_distribution",
- py_type = "str",
- arg_type = "str",
- desc_short = "distribution file root",
- desc = "The file root of the file which will contain multiple models
spanning the full dynamics distribution of the frame order model.",
can_be_none = True
)
uf.add_keyarg(
@@ -132,7 +132,7 @@
min = 1,
py_type = "int",
desc_short = "structural model",
- desc = "Only one model from an analysed ensemble can be used for the PDB
representation of the Monte Carlo simulations of the average domain position,
as these consists of one model per simulation, and also for the distribution of
structures.",
+ desc = "Only one model from an analysed ensemble can be used for the PDB
representation of the Monte Carlo simulations of the average domain position,
as these consists of one model per simulation.",
wiz_element_type = "spin"
)
uf.add_keyarg(
@@ -144,15 +144,15 @@
)
# Description.
uf.desc.append(Desc_container())
-uf.desc[-1].add_paragraph("This function creates a set of PDB files for
representing the frame order cone models. This includes a file for the average
position of the molecule, a file containing a geometric representation of the
frame order motions, and a file containing a distribution of structures which
sample the motional modes.")
+uf.desc[-1].add_paragraph("This function creates a set of PDB files for
representing the frame order cone models. This includes a file for the average
position of the molecule and a file containing a geometric representation of
the frame order motions.")
uf.desc[-1].add_paragraph("The three files are specified via the file root
whereby the extensions '.pdb', '.pdb.gz', etc. should not be provided. This is
important for the geometric representation whereby different files are created
for the positive and negative representations (due to symmetry in the NMR data,
these cannot be differentiated), and for the Monte Carlo simulations. For
example if the file root is 'frame_order', the positive and negative
representations will be placed in the 'frame_order_pos.pdb.gz' and
'frame_order_neg.pdb.gz' files and the Monte Carlo simulations in the
'frame_order_sim_pos.pdb.gz' and 'frame_order_sim_neg.pdb.gz' files. For
models where there is no difference in representation between the positive and
negative directions, the files 'frame_order.pdb.gz' and
'frame_order_sim.pdb.gz' will be produced.")
uf.desc[-1].add_paragraph("There are four different types of residue within
the PDB. The pivot point is represented as as a single carbon atom of the
residue 'PIV'. The cone consists of numerous H atoms of the residue 'CON'.
The cone axis vector is presented as the residue 'AXE' with one carbon atom
positioned at the pivot and the other x Angstroms away on the cone axis (set by
the geometric object size). Finally, if Monte Carlo have been performed, there
will be multiple 'MCC' residues representing the cone for each simulation, and
multiple 'MCA' residues representing the multiple cone axes.")
uf.desc[-1].add_paragraph("To create the diffusion in a cone PDB
representation, a uniform distribution of vectors on a sphere is generated
using spherical coordinates with the polar angle defined by the cone axis. By
incrementing the polar angle using an arccos distribution, a radial array of
vectors representing latitude are created while incrementing the azimuthal
angle evenly creates the longitudinal vectors. These are all placed into the
PDB file as H atoms and are all connected using PDB CONECT records. Each H
atom is connected to its two neighbours on the both the longitude and latitude.
This creates a geometric PDB object with longitudinal and latitudinal lines
representing the filled cone.")
-uf.desc[-1].add_paragraph("The PDB representation of the Monte Carlo
simulations consists of one model per simulation. And the distribution of
structures consists of one model per motional simulation step. Therefore if an
ensemble of structures has been analysed ,only one model from the ensemble can
be used for either representation. This defaults to model number 1, but this
can be changed.")
+uf.desc[-1].add_paragraph("The PDB representation of the Monte Carlo
simulations consists of one model per simulation. Therefore if an ensemble of
structures has been analysed, only one model from the ensemble can be used for
the representation. This defaults to model number 1, but this can be changed.")
uf.backend = pdb_model
uf.menu_text = "pdb_&model"
uf.gui_icon = "oxygen.actions.document-save"
-uf.wizard_height_desc = 370
+uf.wizard_height_desc = 400
uf.wizard_size = (1000, 750)
uf.wizard_image = WIZARD_IMAGE_PATH + 'frame_order.png'
@@ -333,6 +333,94 @@
uf.wizard_image = WIZARD_IMAGE_PATH + 'frame_order.png'
+# The frame_order.simulate user function.
+uf = uf_info.add_uf('frame_order.simulate')
+uf.title = "Pseudo-Brownian dynamics simulation of the frame order motions."
+uf.title_short = "Frame order pseudo-Brownian dynamics simulation."
+uf.add_keyarg(
+ name = "file",
+ default = "simulation.pdb.bz2",
+ py_type = "str",
+ arg_type = "file sel",
+ desc_short = "simulation file",
+ desc = "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'.",
+ wiz_filesel_wildcard = WILDCARD_RELAX_SAVE,
+ wiz_filesel_style = FD_OPEN,
+ wiz_filesel_preview = False
+)
+uf.add_keyarg(
+ name = "dir",
+ py_type = "str",
+ arg_type = "dir",
+ desc_short = "directory name",
+ desc = "The directory where the files are to be located.",
+ can_be_none = True
+)
+uf.add_keyarg(
+ name = "step_size",
+ default = 2.0,
+ py_type = "float",
+ desc_short = "angle of rotation",
+ desc = "The rotation will be of a random direction but with this fixed
angle. The value is in degrees."
+)
+uf.add_keyarg(
+ name = "snapshot",
+ default = 10,
+ min = 1,
+ max = 1000000,
+ py_type = "int",
+ desc_short = "number of steps per snapshot",
+ desc = "The number of steps in the simulation when snapshots will be
taken."
+)
+uf.add_keyarg(
+ name = "total",
+ default = 1000,
+ min = 1,
+ max = 1000000,
+ py_type = "int",
+ desc_short = "total number of snapshots",
+ desc = "The total number of snapshots to take before stopping the
simulation.",
+ wiz_element_type = "spin"
+)
+uf.add_keyarg(
+ name = "model",
+ default = 1,
+ min = 1,
+ py_type = "int",
+ desc_short = "original structural model",
+ desc = "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.",
+ wiz_element_type = "spin"
+)
+uf.add_keyarg(
+ name = "force",
+ default = False,
+ py_type = "bool",
+ desc_short = "force flag",
+ desc = "A flag which, if set to True, will overwrite the any pre-existing
file."
+)
+# Description.
+uf.desc.append(Desc_container())
+uf.desc[-1].add_paragraph("To visualise the frame order motions, this user
function performs a type of simulation whereby structures are randomly rotated
by a fixed angle within the bounds of the uniform distribution of the frame
order model. This can be thought of as a pseudo-Brownian dynamics simulation.
It is in no way a real molecular or Brownian dynamics simulation.")
+uf.desc[-1].add_paragraph("Note that the RDC and PCS data does not contain
information about all parts of the real distribution of structures. Therefore
the snapshots in this simulation only represent the components of the
distribution present in the data, as modelled by the frame order models.")
+uf.desc[-1].add_paragraph("The simulation algorithm is as follows. The
current state is initially defined as the identity matrix I. The maximum
opening angle theta or the torsion angle sigma are defined by the parameter
values of the frame order model. The algorithm for one step of the simulation
is:")
+uf.desc[-1].add_item_list_element("1", "Generate a random vector in 3D.")
+uf.desc[-1].add_item_list_element("2", "Construct a rotation matrix from the
random vector and the fixed rotation angle.")
+uf.desc[-1].add_item_list_element("3", "Pre-multiply the current state by the
rotation matrix.")
+uf.desc[-1].add_item_list_element("4", "Decompose the new state into the
torsion-tilt angles.")
+uf.desc[-1].add_item_list_element("5", "If theta or sigma are greater than
model parameter values, set them to these maximum values.")
+uf.desc[-1].add_item_list_element("6", "Back convert the modified torsion-tilt
angles to a rotation matrix - this is the current state.")
+uf.desc[-1].add_item_list_element("7", "Store a snapshot if the correct number
of iterations has been reached. This consists of rotating a new model about
the pivot(s), as defined by the frame order model.")
+uf.desc[-1].add_item_list_element("8", "Terminate the loop if the maximum
number of snapshots has been reached.")
+uf.desc[-1].add_paragraph("The setting of the steps outside of the
distribution to the maximum parameter values is specifically to allow for
models with parameter values close to zero. Without this, the simulation would
take a huge amount of time to complete.")
+uf.desc[-1].add_paragraph("As the simulation consists of one model per
snapshot, if an ensemble of structures has been analysed, only one model from
the ensemble can be used for the representation. This defaults to model number
1, but this can be changed.")
+uf.backend = simulate
+uf.menu_text = "simula&te"
+uf.gui_icon = "oxygen.actions.document-save"
+uf.wizard_height_desc = 420
+uf.wizard_size = (1000, 750)
+uf.wizard_image = WIZARD_IMAGE_PATH + 'frame_order.png'
+
+
# The frame_order.sobol_setup user function.
uf = uf_info.add_uf('frame_order.sobol_setup')
uf.title = "Set up the quasi-random Sobol' sequence points for numerical PCS
integration."
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits