[gmx-users] C6-C12 table potential

Alex alexanderwien2k at gmail.com
Wed May 16 20:59:28 CEST 2018


Hi,
Suppose that the C6 and C12 for the nonbonded interaction between two beads
of P4 and SNa in the Martini force fields are as following:
                                    C6                   C12
P4    SNda    1       0.17246E-00     0.18590E-02 ; semi attractive

Now, I was wondering how I can generate a table potential
(table_P4_SNda.xvg) using the above C6 and C12 parameters?

I guess the general below C code provided in the gromacs tabulated
potential does the job, but I am not sure if the columns of -1/r6(-1/r7)
and 1/r12(1/r13) should be multiplied by the above C6 and C12 parameters!?

#include <stdio.h>
#include <math.h>

main()
{
    FILE    *fout;
    double  r;

    fout = fopen("table_example.xvg", "w");
    fprintf(fout, "#\n# Example LJ 6-12 Potential\n#\n");

    for (r=0; r<=2.4; r+=0.002) {

        double f = 1/r;
        double fprime = 1/(pow(r,2));

        double g = -1/(pow(r,6));
/*   *C6   ? */
        double gprime = -6/(pow(r,7));                                /*
*C6   ? */

        double h = 1/(pow(r,12));
/*   *C12   ? */
        double hprime = 12/(pow(r,13));                             /*
*C12   ? */

        /* print output */
        if (r<0.001) {
            fprintf(fout, "%12.10e   %12.10e %12.10e   %12.10e %12.10e
%12.10e %12.10e\n", r,0.0,0.0,0.0,0.0,0.0,0.0);
        } else {
            fprintf(fout, "%12.10e   %12.10e %12.10e   %12.10e %12.10e
%12.10e %12.10e\n", r,f,fprime,g,gprime,h,hprime);
        }
    }

    fclose(fout);
    return(0);
}

Regards,
Alex


More information about the gromacs.org_gmx-users mailing list