#include "matio.h"
#include "gmx_ana.h"
#include "names.h"
-#include "sfactor.h"
-
static void check_box_c(matrix box)
{
"Note that all atoms in the selected groups are used, also the ones",
"that don't have Lennard-Jones interactions.[PAR]",
"Option [TT]-cn[tt] produces the cumulative number RDF,",
- "i.e. the average number of particles within a distance r.[PAR]",
- "To bridge the gap between theory and experiment structure factors can",
- "be computed (option [TT]-sq[tt]). The algorithm uses FFT, the grid",
- "spacing of which is determined by option [TT]-grid[tt]."
+ "i.e. the average number of particles within a distance r.[PAR]"
};
static gmx_bool bCM=FALSE,bXY=FALSE,bPBC=TRUE,bNormalize=TRUE;
- static real cutoff=0,binwidth=0.002,grid=0.05,fade=0.0,lambda=0.1,distance=10;
- static int npixel=256,nlevel=20,ngroups=1;
- static real start_q=0.0, end_q=60.0, energy=12.0;
+ static real cutoff=0,binwidth=0.002,fade=0.0;
+ static int ngroups=1;
static const char *closet[]= { NULL, "no", "mol", "res", NULL };
static const char *rdft[]={ NULL, "atom", "mol_com", "mol_cog", "res_com", "res_cog", NULL };
{ "-ng", FALSE, etINT, {&ngroups},
"Number of secondary groups to compute RDFs around a central group" },
{ "-fade", FALSE, etREAL, {&fade},
- "From this distance onwards the RDF is tranformed by g'(r) = 1 + [g(r)-1] exp(-(r/fade-1)^2 to make it go to 1 smoothly. If fade is 0.0 nothing is done." },
- { "-grid", FALSE, etREAL, {&grid},
- "[HIDDEN]Grid spacing (in nm) for FFTs when computing structure factors" },
- { "-npixel", FALSE, etINT, {&npixel},
- "[HIDDEN]# pixels per edge of the square detector plate" },
- { "-nlevel", FALSE, etINT, {&nlevel},
- "Number of different colors in the diffraction image" },
- { "-distance", FALSE, etREAL, {&distance},
- "[HIDDEN]Distance (in cm) from the sample to the detector" },
- { "-wave", FALSE, etREAL, {&lambda},
- "[HIDDEN]Wavelength for X-rays/Neutrons for scattering. 0.1 nm corresponds to roughly 12 keV" },
-
- {"-startq", FALSE, etREAL, {&start_q},
- "Starting q (1/nm) "},
- {"-endq", FALSE, etREAL, {&end_q},
- "Ending q (1/nm)"},
- {"-energy", FALSE, etREAL, {&energy},
- "Energy of the incoming X-ray (keV) "}
+ "From this distance onwards the RDF is tranformed by g'(r) = 1 + [g(r)-1] exp(-(r/fade-1)^2 to make it go to 1 smoothly. If fade is 0.0 nothing is done." }
};
#define NPA asize(pa)
- const char *fnTPS,*fnNDX,*fnDAT=NULL;
- gmx_bool bSQ,bRDF;
+ const char *fnTPS,*fnNDX;
output_env_t oenv;
t_filenm fnm[] = {
{ efTRX, "-f", NULL, ffREAD },
{ efTPS, NULL, NULL, ffOPTRD },
{ efNDX, NULL, NULL, ffOPTRD },
- { efDAT, "-d", "sfactor", ffOPTRD },
- { efXVG, "-o", "rdf", ffOPTWR },
- { efXVG, "-sq", "sq", ffOPTWR },
+ { efXVG, "-o", "rdf", ffWRITE },
{ efXVG, "-cn", "rdf_cn", ffOPTWR },
{ efXVG, "-hq", "hq", ffOPTWR },
-/* { efXPM, "-image", "sq", ffOPTWR }*/
};
#define NFILE asize(fnm)
-
+
CopyRight(stderr,argv[0]);
parse_common_args(&argc,argv,PCA_CAN_VIEW | PCA_CAN_TIME | PCA_BE_NICE,
- NFILE,fnm,NPA,pa,asize(desc),desc,0,NULL,&oenv);
+ NFILE,fnm,NPA,pa,asize(desc),desc,0,NULL,&oenv);
- bSQ = opt2bSet("-sq",NFILE,fnm);
- if (bSQ)
- please_cite(stdout,"Cromer1968a");
-
- bRDF = opt2bSet("-o",NFILE,fnm) || !bSQ;
- if (bSQ || bCM || closet[0][0]!='n' || rdft[0][0]=='m' || rdft[0][6]=='m') {
- fnTPS = ftp2fn(efTPS,NFILE,fnm);
- fnDAT = ftp2fn(efDAT,NFILE,fnm);
+ if (bCM || closet[0][0]!='n' || rdft[0][0]=='m' || rdft[0][6]=='m') {
+ fnTPS = ftp2fn(efTPS,NFILE,fnm);
} else {
- fnTPS = ftp2fn_null(efTPS,NFILE,fnm);
+ fnTPS = ftp2fn_null(efTPS,NFILE,fnm);
}
fnNDX = ftp2fn_null(efNDX,NFILE,fnm);
+ if (!fnTPS && !fnNDX)
+ gmx_fatal(FARGS,"Neither index file nor topology file specified\n"
+ "Nothing to do!");
+
if (closet[0][0] != 'n') {
if (bCM) {
gmx_fatal(FARGS,"Can not have both -com and -surf");
}
}
- if (!bSQ && (!fnTPS && !fnNDX))
- gmx_fatal(FARGS,"Neither index file nor topology file specified\n"
- "Nothing to do!");
-
- if (bSQ)
- do_scattering_intensity(fnTPS,fnNDX,opt2fn("-sq",NFILE,fnm),
- ftp2fn(efTRX,NFILE,fnm),fnDAT,
- start_q, end_q, energy, ngroups,oenv);
-
- if (bRDF)
- do_rdf(fnNDX,fnTPS,ftp2fn(efTRX,NFILE,fnm),
- opt2fn("-o",NFILE,fnm),opt2fn_null("-cn",NFILE,fnm),
- opt2fn_null("-hq",NFILE,fnm),
- bCM,closet[0],rdft,bXY,bPBC,bNormalize,cutoff,binwidth,fade,ngroups,
- oenv);
+ do_rdf(fnNDX,fnTPS,ftp2fn(efTRX,NFILE,fnm),
+ opt2fn("-o",NFILE,fnm),opt2fn_null("-cn",NFILE,fnm),
+ opt2fn_null("-hq",NFILE,fnm),
+ bCM,closet[0],rdft,bXY,bPBC,bNormalize,cutoff,binwidth,fade,ngroups,
+ oenv);
thanx(stderr);
-
+
return 0;
}
--- /dev/null
+/*
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * VERSION 3.2.0
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2004, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ *
+ * And Hey:
+ * Green Red Orange Magenta Azure Cyan Skyblue
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <math.h>
+#include <ctype.h>
+#include "string2.h"
+#include "sysstuff.h"
+#include "typedefs.h"
+#include "macros.h"
+#include "vec.h"
+#include "pbc.h"
+#include "xvgr.h"
+#include "copyrite.h"
+#include "futil.h"
+#include "statutil.h"
+#include "tpxio.h"
+#include "physics.h"
+#include "index.h"
+#include "smalloc.h"
+#include "calcgrid.h"
+#include "nrnb.h"
+#include "coulomb.h"
+#include "gstat.h"
+#include "matio.h"
+#include "gmx_ana.h"
+#include "names.h"
+#include "sfactor.h"
+
+int gmx_saxs(int argc,char *argv[])
+{
+ const char *desc[] = {
+ "g_saxs calculates SAXS structure factors for given index groups based on Cromer's method.",
+ "Both topology and trajectory files are required."
+ };
+
+ static real start_q=0.0, end_q=60.0, energy=12.0;
+ static int ngroups=1;
+
+ t_pargs pa[] = {
+ { "-ng", FALSE, etINT, {&ngroups},
+ "Number of groups to compute SAXS" },
+ {"-startq", FALSE, etREAL, {&start_q},
+ "Starting q (1/nm) "},
+ {"-endq", FALSE, etREAL, {&end_q},
+ "Ending q (1/nm)"},
+ {"-energy", FALSE, etREAL, {&energy},
+ "Energy of the incoming X-ray (keV) "}
+ };
+#define NPA asize(pa)
+ const char *fnTPS,*fnTRX,*fnNDX,*fnDAT=NULL;
+ output_env_t oenv;
+
+ t_filenm fnm[] = {
+ { efTRX, "-f", NULL, ffREAD },
+ { efTPS, NULL, NULL, ffREAD },
+ { efNDX, NULL, NULL, ffOPTRD },
+ { efDAT, "-d", "sfactor", ffOPTRD },
+ { efXVG, "-sq", "sq", ffWRITE },
+ };
+#define NFILE asize(fnm)
+
+ CopyRight(stderr,argv[0]);
+ parse_common_args(&argc,argv, PCA_CAN_TIME | PCA_BE_NICE,
+ NFILE,fnm,NPA,pa,asize(desc),desc,0,NULL,&oenv);
+
+ fnTPS = ftp2fn(efTPS,NFILE,fnm);
+ fnTRX = ftp2fn(efTRX,NFILE,fnm);
+ fnDAT = ftp2fn(efDAT,NFILE,fnm);
+ fnNDX = ftp2fn_null(efNDX,NFILE,fnm);
+
+ do_scattering_intensity(fnTPS,fnNDX,opt2fn("-sq",NFILE,fnm),
+ fnTRX,fnDAT,
+ start_q, end_q, energy, ngroups,oenv);
+
+ please_cite(stdout,"Cromer1968a");
+
+ thanx(stderr);
+
+ return 0;
+}