Re: [AMBER] Small NAB program: Not getting desired output

From: Himanshu Joshi <himanshuphy87.gmail.com>
Date: Fri, 17 Oct 2014 13:15:39 +0530

Dear Dac,
Thanks for your help,

n="" does not work for wc_helix giving segmentation fault.
So I have to go with n =NULL;

Somehow wc_helix returns the complimentary string to the other
sting if one is giviven NULL value as it is clear by output of this
program.

//
molecule m1;
string n;
n=NULL;
printf ("%s\n",n);
m1=wc_helix(n,"","dna","gc","","dna",2.25,-4.96,0.,0.,"");
printf ("%s\n",n);
//

Output

(null)
cg






On Thu, Oct 16, 2014 at 5:41 PM, David A Case <case.biomaps.rutgers.edu>
wrote:

> On Thu, Oct 16, 2014, Himanshu Joshi wrote:
>
> > When I redefine n=NULL before executing the wc_helix
> > for molecule m2 again in the program it works fine,
> >
> > But I don't understand why it doesn't take the NULL value
> > when I define it once.
>
> nab uses the Fortran convention for passing arguments to subroutines: it
> always passes arguments by reference, so they might be changed in the
> underlying routine (wc_helix, in this case). You should print out "n"
> after
> the first call, and see what is there.
>
> If you want an empty string, use: n = ""; in place of n=NULL;
> (although I guess the latter will work, but you are relying the details of
> how
> the nab compiler implements strings.)
>
> ...hope this helps...dac
>
>
> _______________________________________________
> AMBER mailing list
> AMBER.ambermd.org
> http://lists.ambermd.org/mailman/listinfo/amber
>



-- 
*With Regards,HIMANSHU JOSHI Graduate Scholar, Center for Condense Matter
TheoryDepartment of Physics IISc.,Bangalore India 560012*
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Fri Oct 17 2014 - 01:00:01 PDT
Custom Search