Dear AMBER developers,
I have some questions regarding the NAB language. First, let me
introduce my situation.
I have a small MD code written in fortran, which uses external
procedures to obtain forces and energies needed to popagate dynamics.
I want to use NAB for this purpose, specifically the mme2 function (i
need Hessian). Right now, i'm doing this by calling external bash
script.
Here is my NAB code.
************************************************************************
// Program - Get gradient and hessian
molecule m;
float x[2000],g[2000],h[2000],mass[2000],grad[2000],fret;
float fac,energy;
int natom,i;
string names[200];
file file1,file2;
m = getpdb( "input.pdb");
readparm(m, "input.top");
mme_init( m, NULL, "::Z", x, NULL);
setxyz_from_mol( m, NULL, x );
energy=mme2(x,g,h,mass,grad,1,1,1,1,1,1,1,natom,1,names);
file1 = fopen("../forces.dat","w");
file2 = fopen("../hessian.dat","a");
//forces are in kcal/mol/Angstrom
fac=(627.50*1.89);
for (i=1;i<3*m.natoms;i=i+3) {
fprintf(file1,"% .10f % .10f % .10f \n", g[i]/fac, g[i+1]/fac, g[i+2]/fac);
}
fprintf(file1,"% .10f \n",energy/627.5 );
for (i=1;i<9*m.natoms*m.natoms;i=i+3) {
fprintf(file2,"% .10f % .10f % .10f\n", h[i]/fac/1.89,
h[i+1]/fac/1.89, h[i+2]/fac/1.89);
}
fclose(file1);
fclose(file2);
******************************************************************************
However, I noticed that a considerable amount of time is spent on file
I/O. So here are my questions.
1) Is it somehow possible to access the nab functions in the fortran
code directly? What would be the best way to do this?
2) If the first task is too complex, is it at leat possible to do some
binary output from nab, which would be readable by fortran? (netcdf
maybe?)
Thank you very much for your help.
Daniel Hollas
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Mon Feb 06 2012 - 03:30:03 PST