Re: numeric values of d and c

2014-03-18 Thread Stefano Luciano Ciurli
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

2014-03-18 Thread 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 stefano.ciu...@unibo.it 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

2014-03-18 Thread Troels Emtekær Linnet
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 edw...@nmr-relax.com:
 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 stefano.ciu...@unibo.it 
 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 

Re: numeric values of d and c

2014-03-18 Thread Stefano Luciano Ciurli
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

2014-03-18 Thread Stefano Luciano Ciurli
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 edw...@nmr-relax.com:
 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 stefano.ciu...@unibo.it 
 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 =