supp239.doc 79KB Jun 05 2011 09:30:51 PM

Molecular Mechanics-Based Measures of Steric Effects: Customized Code to
Compute Ligand Repulsive Energies

Robert J. Bubela, Warthen Douglass, and David P. White*b

Department of Chemistry, University of North Carolina at Wilmington, 601 South
College Road, Wilmington, NC 28403-3297

a

Undergraduate student from the State University of New York at New Paltz

b

Email address: whitedp@uncwil.edu
1

Supplementary Material: ERCODE.CPP
#include
#include
#include

#include
#include
#define TRUE 1
#define FALSE 0
/**********************GLOBAL VARIABLES*******************************/
struct nodetag
{

// each atom or LP in the molecule has one of
int number;

// these structures dedicated to them

float x, y, z;

// coordinates

char type[10];

// forcefield type


float r0, d0;

// constants from parameter file

int side;

// parameter indicating side ligand side = 0
//

fragment side = 1

struct nodetag *next;
};
typedef nodetag *nodeptr;
nodeptr bgf_list;

// global pointer to beginning of data

char rlist[230][100];


// 2d char array of parameter file

int cons[100][25];

// replica of connectivity table in interger form

int m[100][100];

// this is the binary array, may want to make it
// bigger in case of molecules with more than
// 99 atoms

float unitx, unity, unitz; // unit vector of re bond
float re;

// length of re bond

/***********************END GLOBAL VARIABLES*******************************/
void init_ref(void)

// opens the parameter file and stores the constants in the rlist
{
int i=0;
int j=0;

2

char buf[45]="Forcefields

(R0 / D0)\n";

FILE *stream;
stream=fopen("param_r.set","rt");

//open parameter file

if (!stream)
{printf("File not opened! \n");
exit(1);


//program will not work

}
do
{ fgets(rlist[i], 100, stream);

// useless info(top of file)

i++;
}
while(strcmp(buf, rlist[i-1]));

// until we get to first line

do
{ fgets(rlist[j], 100, stream);

// save these data to rlist

//

j++;
}while(rlist[j-1][0] != 'E');

// ends at END

}/*end init_ref*/
/*****************************************************************/
void menu(void)
{
printf( "==========================================================\n"
"Available commands are:\n"
"



calculate for *.bgf(start or continue)\n"

"




quit

\n"

"=========================================================\n");
}/*end menu*/
/**********************************************************************/
void getcomm(int &command)
{
printf("Enter command:
scanf("%d",&command);

");
// get the command

}/*end getcomm
/******************************************************************/
void connections(char conect[], int cons[])
//receives one line of chars from connectivity table translates it to ints

{
int i, j , k, l;
l=0;
k=9;
char cx[6];

//store 1 char # translated into int

i = strlen(conect);

3

do{

j=0;

do{

cx[j]=conect[k];


k++; j++;
}while (jwhich atoms make up ligand side? fragment side?
// returns a 1 on success, returns 0 if numbers given by user are bad
{
int side_array[100];
int lig, frag, i;
nodeptr t;
int number;
number = bgf_list->number;

// number of atoms on list

printf("Which atom number is on"
" the ligand side of the re bond (donor atom):
scanf("%d", &lig);

");

// prompt user for atom #'s


printf("Which atom number is on the fragment side of the re bond:

");

scanf("%d", &frag);
if (lig>numatoms || frag>numatoms)
{

printf("You have entered one of the numbers incorrectly! \n");
return 0;

}

// too high a number
// prevents program from crashing

else
if (!connected(lig-1, frag))
{


// checks to see if atoms are connected

printf("These atoms are not connected! \n");

6

return 0;
}
else
{

for(i=0; iside == 1)
{

coord1[0] = (factor*unitx) + t1->x; //if the atom is on the fragment
coord1[1] = (factor*unity) + t1->y; //side->move it by move it along
coord1[2] = (factor*unitz) + t1->z; //unit vector a distace of factor

}
else
{

coord1[0] = t1->x;
coord1[1] = t1->y;

// then it is on the ligand side so
// we use the same coordinates

coord1[2] = t1->z;
}
if(t2->side == 1)
{

coord2[0] = (factor*unitx) + t2->x;
coord2[1] = (factor*unity) + t2->y;
coord2[2] = (factor*unitz) + t2->z;

}
else
{

coord2[0] = t2->x;
coord2[1] = t2->y;
coord2[2] = t2->z;

}
dis=dist_form(coord1[0], coord1[1], coord1[2],
coord2[0], coord2[1], coord2[2]);
vander_out = (d0 * exp(12.5*(1 - (dis/r0))));

// get distance
// EvdW,R formula

return vander_out;
}/*end vander*/
/*************************************************************************/
void vdw_formula(nodeptr p, int atom1, int atom2, float vdw[])
// receive two atom #'s, lookup info on them calculate 7 different Evdw,R
// for the pair, add it to the total
{

float d0, r0;
nodeptr t1=p, t2=p;
while(t1->number != atom1)

// look up info on each atom

t1 = t1->next;
while(t2->number != atom2)
t2 = t2->next;
d0 = sqrt(t1->d0 * t2->d0);

// D0-geometric mean of both constants

r0 = (t1->r0 + t2->r0)/2;

// R0-arithmetic mean of "

10

"

vdw[0] = vdw[0] + vander(t1, t2, 0, r0, d0);

// EvdW,R with no change

// in re bond length
vdw[1] = vdw[1] + vander(t1, t2, .01, r0, d0);

// EvdW,R with bond lenth

// increased by .01 angstroms
vdw[2] = vdw[2] + vander(t1, t2, -.01, r0, d0); // EvdW,R with bond lenth
// decreased by .01 angstroms
vdw[3] = vdw[3] + vander(t1, t2, .02, r0, d0);

// increased .02

vdw[4] = vdw[4] + vander(t1, t2, -.02, r0, d0); // decreased .02
vdw[5] = vdw[5] + vander(t1, t2, .03, r0, d0);
vdw[6] = vdw[6] + vander(t1, t2, -.03, r0, d0);
}/*end vdw_formula*/
/******************************************************************/
void vanderwahls(nodeptr p, float vdw[])
// examines binary array searching for 1's, sends two atom #'s
// for which seven Evdw,R values are going to be calculated
{

int number, i, j;
number = p->number;

// last atom number

i=0; j=0;
while(inumber;
atom2 = cons[atom1-1][1];

// if it finds one identify the H
// and the C

while(t2->number != atom2)
t2 = t2->next;

//lookup info about C atom

distance = dist_form(t1->x, t1->y, t1->z, t2->x, t2->y, t2->z);
ux = ((t1->x - t2->x)/distance);
uy = ((t1->y - t2->y)/distance); // find unit vector from C to H
uz = ((t1->z - t2->z)/distance);
n_distance = distance * .915;

// decrease distance by 0.915

t1->x = n_distance*ux + t2->x;
t1->y = n_distance*uy + t2->y;

// add new vector to C coordinates

t1->z = n_distance*uz + t2->z;
}
t1 = t1->next;

// go on looking for more

t2 = bgf_list;
}
}/*end bond_shrinkage*/
/*************************************************************************/
void find_er(float vdw[], char filename[], FILE *out)
//calculates Ligand Repulsive Energy
{

float sxx, sxy, slope, er, avg;
avg = (vdw[0] + vdw[1] + vdw[2] + vdw[3] + vdw[4] + vdw[5] + vdw[6])/7;
sxx = .0028;
sxy = (.01*(vdw[1]-avg))+(-.01*(vdw[2]-avg))+(.02*(vdw[3]-avg))+
(-.02*(vdw[4]-avg))+(.03*(vdw[5]-avg))+(-.03*(vdw[6]-avg));
slope = sxy/sxx;

// average slope formula

er = re*slope;
fprintf(out,"%s

", filename);

// sends filename to outfile

fprintf(out,"%f

\n", er);

// sends Er to outfile

}/*end find_er*/
/*********************************************************************/
void free_mem(void)
// traverses through list deleting all nodes to get mem back
{

nodeptr t1,t2;
t1=bgf_list;
t2=bgf_list->next;
while(t2->next != NULL)
{ free (t1);
t1 = t2;

12

t2 = t2->next;
}
}/*end free_mem*/
/********************************************************************/
void adjust_filename(char filename[])
// receives user input file name, checks and adds *.bgf extension
{

int len;
len = strlen(filename);
if (toupper(filename[len-1]) == 'F' &&

//if user entered file extension

toupper(filename[len-2]) == 'G' &&
toupper(filename[len-3]) == 'B' &&
filename[len-4] == '.')
;

// do nothing

else
{
char end[4] = ".bgf";
strncat(filename, end, 4);

// attach .bgf to end if filename

}
}/*end adjust_filename*/
/********************************************************************/
void bfg(FILE *out, int on_off)
// essentially bgf file driver
{

int done=0;
while(!done)

// this while loop allows user to calc
// several files without having to go
// back to menu

{
char filename[50];
char buf[30]="FORMAT CONECT (a6,12i6)\n";// when to stop reading
char input[100];

// holds data temporarily

int numatoms;
int i;
float vdw[7];

// to find Er we need seven different
// values for Evdw

for(i=0; inext = bgf_list;
bgf_list = p;

// bgf_list is the real list we use

}
}while(strcmp(buf, input));
numatoms = bgf_list->number;
find_connections(stream);

//function uses connectivity table to
// create binary array

if(find_side(numatoms))

// this function is used to tell which
// side of the re each atom is on

{
if (on_off == 1)
bond_shrinkage();//allows for C__H bond shrinkage
vanderwahls(bgf_list, vdw);

// simultaneously solves
// for seven values of repulsive
// vanderwahls energy by
// adjusting xyz coordinates of
// individual atoms

find_er(vdw, filename, out);// calculates Er and sends it to ouput
// file along with file name
}
free_mem();

//clears up memory so we can do it again

fclose(stream);

//close the current input file stream

}
}
}/*end bfg()*/

14

void driver()
// gets the ouput filename, options...
{

int done;

//finish flag

int command;
int on_off = -1;
char shrink[1];
char outfile[20];

// file for data output

printf("Please enter a filename for the data:

");

scanf("%s",outfile);
FILE *out;
if ((out = fopen(outfile, "wt"))
== NULL)
{
fprintf(stderr, "Cannot open output file.\n");
exit(1);
}
done = FALSE;
do {
printf("Do you want SHRINK_CH_BONDS on? (y/n) \n");
scanf("%s",&shrink);
if(toupper(shrink[0]) == 'Y')
on_off = 1;
else
if(toupper(shrink[0]) == 'N')
on_off =0;
}while (on_off == -1);
menu();
while (!done)
{

getcomm (command);
if (command == 1)
{ bfg(out, on_off);

}

else
if (command == 0)
done = TRUE;
menu();
}
fclose(out);
}/*end driver*/
/*********************************************************************/
void main()

15

{

printf("ERCODE. \n"
"When using this work, please reference \n"
"Robert J. Bubel \n"
"T. Warthen Douglass

and \n"

"David P. White \n"
"Journal of Computational Chemistry \n"
"submitted for publication, 1999 \n");
init_ref();//this fills up char rlist[155][100] with information in
//parameter file
driver();

//this is the main part of the program

printf("Bye ! \n");
}

16

Dokumen yang terkait

ANALISIS FAKTOR YANGMEMPENGARUHI FERTILITAS PASANGAN USIA SUBUR DI DESA SEMBORO KECAMATAN SEMBORO KABUPATEN JEMBER TAHUN 2011

2 53 20

EFEKTIVITAS PENDIDIKAN KESEHATAN TENTANG PERTOLONGAN PERTAMA PADA KECELAKAAN (P3K) TERHADAP SIKAP MASYARAKAT DALAM PENANGANAN KORBAN KECELAKAAN LALU LINTAS (Studi Di Wilayah RT 05 RW 04 Kelurahan Sukun Kota Malang)

45 393 31

FAKTOR – FAKTOR YANG MEMPENGARUHI PENYERAPAN TENAGA KERJA INDUSTRI PENGOLAHAN BESAR DAN MENENGAH PADA TINGKAT KABUPATEN / KOTA DI JAWA TIMUR TAHUN 2006 - 2011

1 35 26

A DISCOURSE ANALYSIS ON “SPA: REGAIN BALANCE OF YOUR INNER AND OUTER BEAUTY” IN THE JAKARTA POST ON 4 MARCH 2011

9 161 13

Pengaruh kualitas aktiva produktif dan non performing financing terhadap return on asset perbankan syariah (Studi Pada 3 Bank Umum Syariah Tahun 2011 – 2014)

6 101 0

Pengaruh pemahaman fiqh muamalat mahasiswa terhadap keputusan membeli produk fashion palsu (study pada mahasiswa angkatan 2011 & 2012 prodi muamalat fakultas syariah dan hukum UIN Syarif Hidayatullah Jakarta)

0 22 0

05 BHS JEPANG

0 14 16

Pendidikan Agama Islam Untuk Kelas 3 SD Kelas 3 Suyanto Suyoto 2011

4 108 178

HUBUNGAN ANTARA KELENTUKAN DAN KESEIMBANGAN DENGAN KEMAMPUAN BACK OVER DALAM SENAM PADA SISWA SMA NEGERI 05 BANDAR LAMPUNG

0 42 1

KOORDINASI OTORITAS JASA KEUANGAN (OJK) DENGAN LEMBAGA PENJAMIN SIMPANAN (LPS) DAN BANK INDONESIA (BI) DALAM UPAYA PENANGANAN BANK BERMASALAH BERDASARKAN UNDANG-UNDANG RI NOMOR 21 TAHUN 2011 TENTANG OTORITAS JASA KEUANGAN

3 32 52