Netiquette · Download · News · Gallery · Homepage · DSSR · Web-DSSR · DSSR Manual · Reproduce DSSR · DSSR-Jmol · DSSR-PyMOL · Web-SNAP

Author Topic: SCHNArP/SCHNAaP c source code  (Read 4781 times)

Offline clarebonk

  • regular
  • *
  • Posts: 9
    • View Profile
SCHNArP/SCHNAaP c source code
« on: March 11, 2009, 07:59:11 pm »
I am working on an RMSD minimization procedure.  I create (with my own c code) an initial RNA helix from a reduced pdb file, then I use 3DNA's analyze and rebuild to make a new helix.  I find the RMSD between the original helix and the one created with rebuild.  I use Powell's minimizatoin method to find bp_step parameters that give the minimum RMSD between the original helix and the one created with 3DNA's rebuild.

My problem is that the minimization procedure calls 3DNA's rebuild many, many times and I have no way of integrating the executables into my c code.  Since I do many other calculations, I need the code to be fast and efficient.

I've read both SCHNAaP and SCHNArP papers, and both conclusions state the source code is available upon request from the authors.

May I access the c code?  I, of course, will be happy to cite the authors' work and take no credit for that particular portion of the methodology.  It would save me a lot of time if I didn't have to rewrite the code myself.

Offline admin

  • administrator
  • Administrator
  • regular
  • *****
  • Posts: 15
    • View Profile
Re: SCHNArP/SCHNAaP c source code
« Reply #1 on: March 15, 2009, 01:13:46 am »
I have just went through the code (it was a piece of work 10+ year ago!), and made some minor changes to make the code compile happily with today's gcc. A separate email I am sending to you contains download instructions. Please share with the community by posting back here any issues you have with the code.

Xiang-Jun
Xiang-Jun Lu [Administrator of the 3DNA Forum]
3DNA Forum: http://forum.x3dna.org/
3DNA Homepage: http://x3dna.org/
Personal Blog: http://xiang-jun.blogspot.com/

Offline clarebonk

  • regular
  • *
  • Posts: 9
    • View Profile
Re: SCHNArP/SCHNAaP c source code
« Reply #2 on: March 17, 2009, 12:25:07 pm »
I successfully compiled the code after making the additional changes, which were very easy to do from the helpful comments.  I changed the floats to doubles, and also changed free_vector to free_dvector.

However, when I run one of the examples, I get an error message:
$ schnaap ../Examples/1bna.inp
*** glibc detected *** schnaap: free(): invalid next size (normal): 0x0000000000637910 ***

I think there is a malloc/free issue somewhere in the code.  I will diligently look through the code to try to find the error, but in the meantime I was wondering if you had seen this before.

Relevant info:
Linux version 2.6.22.14-72.fc6
(gcc version 4.1.2 20070626 (Red Hat 4.1.2-13)) #1 SMP

Thanks.

Offline xiangjun

  • Administrator
  • regular
  • *****
  • Posts: 1220
    • View Profile
    • 3DNA homepage
Re: SCHNArP/SCHNAaP c source code
« Reply #3 on: March 17, 2009, 10:18:33 pm »
Very strange. It should work -:)

What OS and compiler are you using? Is it 'gcc'? Did you change all four NR functions? For verification purpose, please send me your finished 'cmn_fncs.c' file by email.

Xiang-Jun
Dr. Xiang-Jun Lu [律祥俊]
Email: xiangjun@x3dna.org
Homepage: http://x3dna.org/
Forum: http://forum.x3dna.org/

Offline clarebonk

  • regular
  • *
  • Posts: 9
    • View Profile
Re: SCHNArP/SCHNAaP c source code
« Reply #4 on: March 18, 2009, 09:51:10 pm »
This problem is seen only on 64 bit machines, but this fix should be applied to nrutil.c regardless of architecture:

nrutil.c:18:    v = (long *) malloc((size_t) ((nh - nl + 1 + NR_END) * sizeof(int)));
nrutil.c:80:    m = (long **) malloc((size_t) ((nrow + NR_END) * sizeof(int *)));
nrutil.c:87:    m[nrl] = (long *) malloc((size_t) ((nrow * ncol + NR_END) * sizeof(int)));

Change sizeof(int) to sizeof(long) on lines 18, 80, and 87 in nrutil.c.

Also, this line:

 #include "cmn_fncs.h"

should be added to pdb2inp.c (thanks Xiang-Jun).

Offline xiangjun

  • Administrator
  • regular
  • *****
  • Posts: 1220
    • View Profile
    • 3DNA homepage
Re: SCHNArP/SCHNAaP c source code
« Reply #5 on: March 18, 2009, 11:59:27 pm »
All bug fixes / changes have been incorporated into the code base from the download site. Thanks to 'clarebonk' for reporting and testing!

As always, bug reports and comments are gratefully received.

Xiang-Jun
Dr. Xiang-Jun Lu [律祥俊]
Email: xiangjun@x3dna.org
Homepage: http://x3dna.org/
Forum: http://forum.x3dna.org/

Offline clarebonk

  • regular
  • *
  • Posts: 9
    • View Profile
Re: SCHNArP/SCHNAaP c source code
« Reply #6 on: March 20, 2009, 10:36:29 am »
To satisfy my curiosity, I wrote a c program that prints out variable byte sizes.  I ran it on the 32 bit machine, and the 64 bit machine.  

Results for 64 bit:
float:  4
double: 8
char:   1
int:    4
long:   8

Results for 32 bit:
float:  4
double: 8
char:   1
int:    4
long:   4

As you can see, the long data type is twice as big in the 64 as in the 32.  In the 64 bit machine, it is not the same size as an int, which is why I was getting the memory error on the 64 bit machine.

 

Created and maintained by Dr. Xiang-Jun Lu [律祥俊], Principal Investigator of the NIH grant R01GM096889
Dr. Lu is currently affiliated with the Bussemaker Laboratory at the Department of Biological Sciences, Columbia University.