Re: numeric values of d and c
Thanks Troels, this also works! Stefano On Mar 18, 2014, at 5:22 PM, Troels Emtekær Linnet wrote: > Or open the relax prompt > Ctrl+p > > And write: > script("script.py") > > OUT COME - > > script = 'script.py' > > # Python module imports. > from numpy import float64, zeros > > # relax module imports. > from lib.auto_relaxation.ri_comps import calc_fixed_csa, > calc_fixed_dip, comp_csa_const_func, comp_dip_const_func > from lib.physical_constants import h_bar, mu0, return_gyromagnetic_ratio > > > class Data: >"""Dummy class for storing data.""" > > # Initialise the data container. > data = Data() > > # The spectrometer frequency (Hz). > frq = 500e6 > > # The dynamically averaged bond length (m) and chemical shift tensor > anisotropy. > r = 1.02e-10 > csa = -172e-6 > > # Add the needed physical constants to the data storage. > data.gx = return_gyromagnetic_ratio('15N') > data.gh = return_gyromagnetic_ratio('1H') > data.mu0 = mu0 > data.h_bar = h_bar > > # The number of frequencies. > data.num_frq = 1 > > # Initialise dipolar and CSA data structures. > data.dip_const_fixed = 0.0 > data.csa_const_fixed = [0.0] > data.dip_const_func = 0.0 > data.csa_const_func = zeros(1, float64) > > # Nuclear frequencies. > frq = frq * 2 * pi > frqX = frq * data.gx / data.gh > > # Calculate the five frequencies which cause R1, R2, and NOE relaxation. > data.frq_list = zeros((1, 5), float64) > data.frq_list[0, 1] = frqX > data.frq_list[0, 2] = frq - frqX > data.frq_list[0, 3] = frq > data.frq_list[0, 4] = frq + frqX > data.frq_sqrd_list = data.frq_list ** 2 > > # Calculate the fixed component of the dipolar and CSA constants. > calc_fixed_dip(data) > calc_fixed_csa(data) > > # Calculate the dipolar and CSA constants. > comp_dip_const_func(data, r) > comp_csa_const_func(data, csa) > > # Rename the dipolar and CSA constants. > d = data.dip_const_func > c = data.csa_const_func[0] > > # Printout. > print("d: %s" % d) > print("c: %s" % c) > > -- > d: 1300116668.53 > c: 1000661534.67 > > 2014-03-18 17:15 GMT+01:00 Edward d'Auvergne : >> Hi Stefano, >> >> When running relax, you should avoid putting any files in the relax >> source code directories. These should be kept separate at all times - >> otherwise the result could be severe problems that are very difficult >> to understand. To see the output of the script when running in GUI >> mode, you will have to open the relax controller window were all >> messages are displayed. To do this, perform one of: >> >> - Select the 'View->Controller' menu item. >> - Click on the 'relax controller' button in the toolbar. >> - Type Ctrl-Z. >> >> The two numbers should be printed at the bottom. If you see errors, >> then there is likely to be word wrapping problems - one line has been >> split into two in the email text. >> >> Regards, >> >> Edward >> >> >> On 18 March 2014 17:06, Stefano Luciano Ciurli >> wrote: >>> Hi Edward, >>> thank you for the exhaustive answer. >>> I have saved the script as a filename.py file in the >>> /relax/Contents/Resources/user_functions directory and tried to run in from >>> within relax using the menu user functions (n-z) -> script >>> However, it does not appear to do anything. >>> Any hint? >>> Stefano >>> >>> On Mar 18, 2014, at 10:04 AM, Edward d'Auvergne wrote: >>> >>> # Python module imports. >>> from numpy import float64, zeros >>> >>> # relax module imports. >>> from lib.auto_relaxation.ri_comps import calc_fixed_csa, >>> calc_fixed_dip, comp_csa_const_func, comp_dip_const_func >>> from lib.physical_constants import h_bar, mu0, return_gyromagnetic_ratio >>> >>> >>> class Data: >>> """Dummy class for storing data.""" >>> >>> # Initialise the data container. >>> data = Data() >>> >>> # The spectrometer frequency (Hz). >>> frq = 500e6 >>> >>> # The dynamically averaged bond length (m) and chemical shift tensor >>> anisotropy. >>> r = 1.02e-10 >>> csa = -172e-6 >>> >>> # Add the needed physical constants to the data storage. >>> data.gx = return_gyromagnetic_ratio('15N') >>> data.gh = return_gyromagnetic_ratio('1H') >>> data.mu0 = mu0 >>> data.h_bar = h_bar >>> >>> # The number of frequencies. >>> data.num_frq = 1 >>> >>> # Initialise dipolar and CSA data structures. >>> data.dip_const_fixed = 0.0 >>> data.csa_const_fixed = [0.0] >>> data.dip_const_func = 0.0 >>> data.csa_const_func = zeros(1, float64) >>> >>> # Nuclear frequencies. >>> frq = frq * 2 * pi >>> frqX = frq * data.gx / data.gh >>> >>> # Calculate the five frequencies which cause R1, R2, and NOE relaxation. >>> data.frq_list = zeros((1, 5), float64) >>> data.frq_list[0, 1] = frqX >>> data.frq_list[0, 2] = frq - frqX >>> data.frq_list[0, 3] = frq >>> data.frq_list[0, 4] = frq + frqX >>> data.frq_sqrd_list = data.frq_list ** 2 >
Re: numeric values of d and c
Hi Edward, > The two numbers should be printed at the bottom. If you see errors, > then there is likely to be word wrapping problems - one line has been > split into two in the email text. it worked! Thanks!!! Stefano ___ relax (http://www.nmr-relax.com) This is the relax-users mailing list relax-users@gna.org 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-users
Re: numeric values of d and c
Or open the relax prompt Ctrl+p And write: script("script.py") OUT COME - script = 'script.py' # Python module imports. from numpy import float64, zeros # relax module imports. from lib.auto_relaxation.ri_comps import calc_fixed_csa, calc_fixed_dip, comp_csa_const_func, comp_dip_const_func from lib.physical_constants import h_bar, mu0, return_gyromagnetic_ratio class Data: """Dummy class for storing data.""" # Initialise the data container. data = Data() # The spectrometer frequency (Hz). frq = 500e6 # The dynamically averaged bond length (m) and chemical shift tensor anisotropy. r = 1.02e-10 csa = -172e-6 # Add the needed physical constants to the data storage. data.gx = return_gyromagnetic_ratio('15N') data.gh = return_gyromagnetic_ratio('1H') data.mu0 = mu0 data.h_bar = h_bar # The number of frequencies. data.num_frq = 1 # Initialise dipolar and CSA data structures. data.dip_const_fixed = 0.0 data.csa_const_fixed = [0.0] data.dip_const_func = 0.0 data.csa_const_func = zeros(1, float64) # Nuclear frequencies. frq = frq * 2 * pi frqX = frq * data.gx / data.gh # Calculate the five frequencies which cause R1, R2, and NOE relaxation. data.frq_list = zeros((1, 5), float64) data.frq_list[0, 1] = frqX data.frq_list[0, 2] = frq - frqX data.frq_list[0, 3] = frq data.frq_list[0, 4] = frq + frqX data.frq_sqrd_list = data.frq_list ** 2 # Calculate the fixed component of the dipolar and CSA constants. calc_fixed_dip(data) calc_fixed_csa(data) # Calculate the dipolar and CSA constants. comp_dip_const_func(data, r) comp_csa_const_func(data, csa) # Rename the dipolar and CSA constants. d = data.dip_const_func c = data.csa_const_func[0] # Printout. print("d: %s" % d) print("c: %s" % c) -- d: 1300116668.53 c: 1000661534.67 2014-03-18 17:15 GMT+01:00 Edward d'Auvergne : > Hi Stefano, > > When running relax, you should avoid putting any files in the relax > source code directories. These should be kept separate at all times - > otherwise the result could be severe problems that are very difficult > to understand. To see the output of the script when running in GUI > mode, you will have to open the relax controller window were all > messages are displayed. To do this, perform one of: > > - Select the 'View->Controller' menu item. > - Click on the 'relax controller' button in the toolbar. > - Type Ctrl-Z. > > The two numbers should be printed at the bottom. If you see errors, > then there is likely to be word wrapping problems - one line has been > split into two in the email text. > > Regards, > > Edward > > > On 18 March 2014 17:06, Stefano Luciano Ciurli > wrote: >> Hi Edward, >> thank you for the exhaustive answer. >> I have saved the script as a filename.py file in the >> /relax/Contents/Resources/user_functions directory and tried to run in from >> within relax using the menu user functions (n-z) -> script >> However, it does not appear to do anything. >> Any hint? >> Stefano >> >> On Mar 18, 2014, at 10:04 AM, Edward d'Auvergne wrote: >> >> # Python module imports. >> from numpy import float64, zeros >> >> # relax module imports. >> from lib.auto_relaxation.ri_comps import calc_fixed_csa, >> calc_fixed_dip, comp_csa_const_func, comp_dip_const_func >> from lib.physical_constants import h_bar, mu0, return_gyromagnetic_ratio >> >> >> class Data: >>"""Dummy class for storing data.""" >> >> # Initialise the data container. >> data = Data() >> >> # The spectrometer frequency (Hz). >> frq = 500e6 >> >> # The dynamically averaged bond length (m) and chemical shift tensor >> anisotropy. >> r = 1.02e-10 >> csa = -172e-6 >> >> # Add the needed physical constants to the data storage. >> data.gx = return_gyromagnetic_ratio('15N') >> data.gh = return_gyromagnetic_ratio('1H') >> data.mu0 = mu0 >> data.h_bar = h_bar >> >> # The number of frequencies. >> data.num_frq = 1 >> >> # Initialise dipolar and CSA data structures. >> data.dip_const_fixed = 0.0 >> data.csa_const_fixed = [0.0] >> data.dip_const_func = 0.0 >> data.csa_const_func = zeros(1, float64) >> >> # Nuclear frequencies. >> frq = frq * 2 * pi >> frqX = frq * data.gx / data.gh >> >> # Calculate the five frequencies which cause R1, R2, and NOE relaxation. >> data.frq_list = zeros((1, 5), float64) >> data.frq_list[0, 1] = frqX >> data.frq_list[0, 2] = frq - frqX >> data.frq_list[0, 3] = frq >> data.frq_list[0, 4] = frq + frqX >> data.frq_sqrd_list = data.frq_list ** 2 >> >> # Calculate the fixed component of the dipolar and CSA constants. >> calc_fixed_dip(data) >> calc_fixed_csa(data) >> >> # Calculate the dipolar and CSA constants. >> comp_dip_const_func(data, r) >> comp_csa_const_func(data, csa) >> >> # Rename the dipolar and CSA constants. >> d = data.dip_const_func >> c = data.csa_const_func[0] >> >> # Printout. >> print("
Re: numeric values of d and c
Hi Stefano, When running relax, you should avoid putting any files in the relax source code directories. These should be kept separate at all times - otherwise the result could be severe problems that are very difficult to understand. To see the output of the script when running in GUI mode, you will have to open the relax controller window were all messages are displayed. To do this, perform one of: - Select the 'View->Controller' menu item. - Click on the 'relax controller' button in the toolbar. - Type Ctrl-Z. The two numbers should be printed at the bottom. If you see errors, then there is likely to be word wrapping problems - one line has been split into two in the email text. Regards, Edward On 18 March 2014 17:06, Stefano Luciano Ciurli wrote: > Hi Edward, > thank you for the exhaustive answer. > I have saved the script as a filename.py file in the > /relax/Contents/Resources/user_functions directory and tried to run in from > within relax using the menu user functions (n-z) -> script > However, it does not appear to do anything. > Any hint? > Stefano > > On Mar 18, 2014, at 10:04 AM, Edward d'Auvergne wrote: > > # Python module imports. > from numpy import float64, zeros > > # relax module imports. > from lib.auto_relaxation.ri_comps import calc_fixed_csa, > calc_fixed_dip, comp_csa_const_func, comp_dip_const_func > from lib.physical_constants import h_bar, mu0, return_gyromagnetic_ratio > > > class Data: >"""Dummy class for storing data.""" > > # Initialise the data container. > data = Data() > > # The spectrometer frequency (Hz). > frq = 500e6 > > # The dynamically averaged bond length (m) and chemical shift tensor > anisotropy. > r = 1.02e-10 > csa = -172e-6 > > # Add the needed physical constants to the data storage. > data.gx = return_gyromagnetic_ratio('15N') > data.gh = return_gyromagnetic_ratio('1H') > data.mu0 = mu0 > data.h_bar = h_bar > > # The number of frequencies. > data.num_frq = 1 > > # Initialise dipolar and CSA data structures. > data.dip_const_fixed = 0.0 > data.csa_const_fixed = [0.0] > data.dip_const_func = 0.0 > data.csa_const_func = zeros(1, float64) > > # Nuclear frequencies. > frq = frq * 2 * pi > frqX = frq * data.gx / data.gh > > # Calculate the five frequencies which cause R1, R2, and NOE relaxation. > data.frq_list = zeros((1, 5), float64) > data.frq_list[0, 1] = frqX > data.frq_list[0, 2] = frq - frqX > data.frq_list[0, 3] = frq > data.frq_list[0, 4] = frq + frqX > data.frq_sqrd_list = data.frq_list ** 2 > > # Calculate the fixed component of the dipolar and CSA constants. > calc_fixed_dip(data) > calc_fixed_csa(data) > > # Calculate the dipolar and CSA constants. > comp_dip_const_func(data, r) > comp_csa_const_func(data, csa) > > # Rename the dipolar and CSA constants. > d = data.dip_const_func > c = data.csa_const_func[0] > > # Printout. > print("d: %s" % d) > print("c: %s" % c) > ___ relax (http://www.nmr-relax.com) This is the relax-users mailing list relax-users@gna.org 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-users
Re: numeric values of d and c
Hi Edward, thank you for the exhaustive answer. I have saved the script as a filename.py file in the /relax/Contents/Resources/user_functions directory and tried to run in from within relax using the menu user functions (n-z) -> script However, it does not appear to do anything. Any hint? Stefano On Mar 18, 2014, at 10:04 AM, Edward d'Auvergne wrote: # Python module imports. from numpy import float64, zeros # relax module imports. from lib.auto_relaxation.ri_comps import calc_fixed_csa, calc_fixed_dip, comp_csa_const_func, comp_dip_const_func from lib.physical_constants import h_bar, mu0, return_gyromagnetic_ratio class Data: """Dummy class for storing data.""" # Initialise the data container. data = Data() # The spectrometer frequency (Hz). frq = 500e6 # The dynamically averaged bond length (m) and chemical shift tensor anisotropy. r = 1.02e-10 csa = -172e-6 # Add the needed physical constants to the data storage. data.gx = return_gyromagnetic_ratio('15N') data.gh = return_gyromagnetic_ratio('1H') data.mu0 = mu0 data.h_bar = h_bar # The number of frequencies. data.num_frq = 1 # Initialise dipolar and CSA data structures. data.dip_const_fixed = 0.0 data.csa_const_fixed = [0.0] data.dip_const_func = 0.0 data.csa_const_func = zeros(1, float64) # Nuclear frequencies. frq = frq * 2 * pi frqX = frq * data.gx / data.gh # Calculate the five frequencies which cause R1, R2, and NOE relaxation. data.frq_list = zeros((1, 5), float64) data.frq_list[0, 1] = frqX data.frq_list[0, 2] = frq - frqX data.frq_list[0, 3] = frq data.frq_list[0, 4] = frq + frqX data.frq_sqrd_list = data.frq_list ** 2 # Calculate the fixed component of the dipolar and CSA constants. calc_fixed_dip(data) calc_fixed_csa(data) # Calculate the dipolar and CSA constants. comp_dip_const_func(data, r) comp_csa_const_func(data, csa) # Rename the dipolar and CSA constants. d = data.dip_const_func c = data.csa_const_func[0] # Printout. print("d: %s" % d) print("c: %s" % c) ___ relax (http://www.nmr-relax.com) This is the relax-users mailing list relax-users@gna.org 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-users
Re: numeric values of d and c
Hi Stefano, For this, you need to become a power-user and dive into the relax library itself! Once you start playing with the relax library, you'll discover a huge range of analysis opportunities. The relax data store combined with the relax library creates a development environment rivalling Mathematica, Matlab, Maxima, Octave, etc. but with a strong focus on NMR. This includes support for handling 3D molecular structures (or no structure), spectral data input, NMR phenomenon and many mathematics functions specific for NMR, and data visualization. I have written a quick script, which I have copied and pasted below, that will perform the calculation for you. This code comes mainly from the specific_analyses.jw_mapping.__init__ and target_functions.jw_mapping modules. Note that when copying these for yourself that you have to be careful about newlines introduced by the email text wrapping of 80 characters - you will have to fix these yourself. Regards, Edward P. S. Here is the script: # Python module imports. from numpy import float64, zeros # relax module imports. from lib.auto_relaxation.ri_comps import calc_fixed_csa, calc_fixed_dip, comp_csa_const_func, comp_dip_const_func from lib.physical_constants import h_bar, mu0, return_gyromagnetic_ratio class Data: """Dummy class for storing data.""" # Initialise the data container. data = Data() # The spectrometer frequency (Hz). frq = 500e6 # The dynamically averaged bond length (m) and chemical shift tensor anisotropy. r = 1.02e-10 csa = -172e-6 # Add the needed physical constants to the data storage. data.gx = return_gyromagnetic_ratio('15N') data.gh = return_gyromagnetic_ratio('1H') data.mu0 = mu0 data.h_bar = h_bar # The number of frequencies. data.num_frq = 1 # Initialise dipolar and CSA data structures. data.dip_const_fixed = 0.0 data.csa_const_fixed = [0.0] data.dip_const_func = 0.0 data.csa_const_func = zeros(1, float64) # Nuclear frequencies. frq = frq * 2 * pi frqX = frq * data.gx / data.gh # Calculate the five frequencies which cause R1, R2, and NOE relaxation. data.frq_list = zeros((1, 5), float64) data.frq_list[0, 1] = frqX data.frq_list[0, 2] = frq - frqX data.frq_list[0, 3] = frq data.frq_list[0, 4] = frq + frqX data.frq_sqrd_list = data.frq_list ** 2 # Calculate the fixed component of the dipolar and CSA constants. calc_fixed_dip(data) calc_fixed_csa(data) # Calculate the dipolar and CSA constants. comp_dip_const_func(data, r) comp_csa_const_func(data, csa) # Rename the dipolar and CSA constants. d = data.dip_const_func c = data.csa_const_func[0] # Printout. print("d: %s" % d) print("c: %s" % c) On 17 March 2014 19:44, Stefano Luciano Ciurli wrote: > Hi, > as a self check: could anyone tell me the exact numerical values used by > relax for the d and c constants, expressed in rad^2 s^-2? > Thanks, > Stefano ___ relax (http://www.nmr-relax.com) This is the relax-users mailing list relax-users@gna.org 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-users
numeric values of d and c
Hi, as a self check: could anyone tell me the exact numerical values used by relax for the d and c constants, expressed in rad^2 s^-2? Thanks, Stefano ___ relax (http://www.nmr-relax.com) This is the relax-users mailing list relax-users@gna.org 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-users