88#include <libxml/xmlreader.h>
90extern xmlNodePtr
findnode (xmlNodePtr startnode,
char * nname);
161 "charmm-prot_metals_22",
168 "charmm-prot_metals_36",
179 "Assisted Model Building with Energy Refinement 96",
180 "Assisted Model Building with Energy Refinement 98",
181 "Assisted Model Building with Energy Refinement 99",
182 "Chemistry at HARvard Macromolecular Mechanics 22 Proteins",
183 "Chemistry at HARvard Macromolecular Mechanics 22 Proteins and metals",
184 "Chemistry at HARvard Macromolecular Mechanics 35 Ethers",
185 "Chemistry at HARvard Macromolecular Mechanics 36 Carbohydrates",
186 "Chemistry at HARvard Macromolecular Mechanics 36 General",
187 "Chemistry at HARvard Macromolecular Mechanics 36 Lipids",
188 "Chemistry at HARvard Macromolecular Mechanics 36 Nucleid acids",
189 "Chemistry at HARvard Macromolecular Mechanics 36 Proteins",
190 "Chemistry at HARvard Macromolecular Mechanics 36 proteins and metals",
191 "Chemistry at HARvard Macromolecular Mechanics Silicates",
192 "Consistent Valence Force Field",
193 "Consistent Valence Force Field Augmented",
194 "Consistent Force Field 91",
195 "Polymer Consistent Force Field",
196 "Condensed-phase Optimized Molecular Potentials for Atomistic Simulation Studies",
197 "Optimized Potentials for Liquid Simulation All-atoms for Proteins",
198 "Optimized Potentials for Liquid Simulation All-atoms for Proteins, Nucleosides, and Nucleotides"};
204 "CHARMM 22 Proteins",
205 "CHARMM 22 Proteins and metals",
207 "CHARMM 36 Carbohydrates",
210 "CHARMM 36 Nucleid acids",
211 "CHARMM 36 Proteins",
212 "CHARMM 36 Proteins and metals",
219 "OPLS All-atoms for proteins",
220 "OPLS All-atoms for RNA"};
244gchar *
ffo_file[21]={
"parm94.dat",
"parm96.dat",
"parm98.dat",
"parm99.dat",
245 "par_all22_prot.prm",
"par_all22_prot_metals.prm",
"par_all35_ethers.prm",
246 "par_all36_carb.prm",
"par_all36_cgenff.prm",
"par_all36_lipid.prm",
"par_all36_na.prm",
247 "par_all36_prot.prm",
"par_all36m_prot.prm",
"par_all_silicates.prm",
248 "CVFF.frc",
"CVFF_aug.frc",
"CFF91.frc",
"PCFF.frc",
"compass.frc",
"par_opls_aam.inp",
"par_opls_rna.inp"};
250gchar *
prop_name[11]= {
"Quadratic bonds",
"Quartic bonds",
"Morse bonds",
"Quadratic angles",
"Quartic angles",
251 "Dihedrals",
"Torsions 3",
"Inversions",
"Impropers",
"Non-bonded",
"Bond increments"};
253gchar *
table_name[11]= {
"qbonds",
"sbonds",
"mbonds",
"qangles",
"sangles",
"dih",
"tor",
"inv",
"imp",
"vdw",
"bdi"};
255int ffdim[14][2] = {{1, 0}, {1, 1}, {1, 1}, {2, 2}, {2, 4}, {2, 3}, {3, 2}, {3, 4}, {4, 3}, {4, 4}, {4, 2}, {4, 3}, {1, 2}, {2, 0}};
257int ffpot[
N_FIELDS][10]={{1, 0, 0, 1, 0, 1, 0, 1, 0, 1},
258 {1, 0, 0, 1, 0, 1, 0, 1, 0, 1},
259 {1, 0, 0, 1, 0, 1, 0, 1, 0, 1},
260 {1, 0, 0, 1, 0, 1, 0, 1, 0, 1},
261 {1, 0, 0, -1, 0, 1, 0, 2, 0, -1},
262 {1, 0, 0, -1, 0, 1, 0, 2, 0, -1},
263 {1, 0, 0, -1, 0, 1, 0, 2, 0, -1},
264 {1, 0, 0, -1, 0, 1, 0, 2, 0, -1},
265 {1, 0, 0, -1, 0, 1, 0, 2, 0, -1},
266 {1, 0, 0, -1, 0, 1, 0, 2, 0, -1},
267 {1, 0, 0, -1, 0, 1, 0, 2, 0, -1},
268 {1, 0, 0, -1, 0, 1, 0, 2, 0, -1},
269 {1, 0, 0, -1, 0, 1, 0, 2, 0, -1},
270 {1, 0, 0, -1, 0, 1, 0, 2, 0, -1},
271 {1, 0, 2, 1, 0, 1, -4, 1, 0, 1},
272 {1, 0, 2, 1, 0, 1, -4, 1, 0, 0},
273 {1, 6, 0, 0, 2, 1, -4, 0, 2, 0},
274 {1, 6, 0, 1, 2, 1, -4, 0, 2, 0},
275 {0, 6, 0, 0, 2, 0, -4, 0, 2, -2},
276 {1, 0, 0, 1, 0, 1, 0, 1, 0, 1},
277 {1, 0, 0, 1, 0, 1, 0, 1, 0, 1}};
313void allocate_field_data (
int *
objects,
int * dim,
316 char * angles[
objects[6]][dim[6]],
char * q_angles[
objects[7]][dim[7]],
317 char * dihedrals[
objects[8]][dim[8]],
char * q_dihedrals[
objects[9]][dim[9]],
318 char * inversions[
objects[10]][dim[10]],
char * impropers[
objects[11]][dim[11]],
319 char * vdw[
objects[12]][dim[12]],
char * bond_inc[
objects[13]][dim[13]])
479void associate_pointers_to_field_data (
int id)
617 if (g_strcmp0 (keyw,
field_atoms[i][2]) == 0)
return i;
619 if (g_strcmp0 (keyw,
"X") == 0)
return -1;
620 if (g_strcmp0 (keyw,
"*") == 0)
return -1;
622 if (print) g_debug (
"ID:: -10:: key= '%s'", keyw);
659 g_debug (
"Nothing found in equi:: prop= %d, keyw= %s", prop, keyw);
684 for (j=1; j<120; j++)
691 if (g_strcmp0 (keyw,
"X") == 0)
return -1;
692 if (g_strcmp0 (keyw,
"*") == 0)
return -1;
693 if (g_strcmp0 (keyw,
"L") == 0 || g_strcmp0 (keyw,
"lp") == 0 || g_strcmp0 (keyw,
"LP") == 0 || g_strcmp0 (keyw,
"LPH") == 0)
return -2;
694 if (g_strcmp0 (keyw,
"EP") == 0)
return -3;
695 if (g_strcmp0 (keyw,
"DUM") == 0)
return -4;
697 g_debug (
"Z:: -10:: key= '%s'", keyw);
711 gchar * nodes[11]={
"atoms",
"bonds-h",
"bonds-q",
"bonds-m",
"angles-h",
"angles-q",
712 "dihedrals-c",
"dihedrals-ccc",
"impropers",
"inversions",
"non-bonded"};
713 fprintf (
fp,
" <ff-data>\n");
714 int i, j, k, l, n, m;
718 if (i != 1 && i != 2)
721 j = (i == 10) ? 11 : (i == 11) ? 10 : i;
750 fprintf (
fp,
" </ff-data>\n");
793 for (i=0; i<120; i++)
1015 int h, i, j, k, l, m, n, o, p, q, r, s;
1016 j = k = l = m = n = o = p = q = r = s = 0;
1022 for (h=0; h<3; h++) k +=
get_bond (i, h);
1023 for (h=0; h<2; h++) l +=
get_angle(i, h);
1024 for (h=0; h<2; h++) m +=
get_apex(i, h);
1025 for (h=0; h<2; h++) n +=
get_torsion (i, h, 0, 3);
1026 for (h=0; h<2; h++) o +=
get_torsion (i, h, 1, 2);
1035 fprintf (
fp,
"{%3i,%3i,%3i,%3i,%3i,%3i,%3i,%3i,%3i,%3i}", j, k, l, m, n, o, p, q, r, s);
1048 gchar * nodes[4]={
"label",
"mass",
"key",
"info"};
1049 fprintf (
fp,
" <atoms>\n");
1052 fprintf (
fp,
" <at");
1057 fprintf (
fp,
"/>\n");
1059 fprintf (
fp,
" </atoms>\n");
1109void print_this_bond (
int eid,
int h,
int fid,
int inum,
char * at_a,
char * at_b,
char ** the_bond)
1112 gchar * node[3] = {
"bd-h",
"bd-q",
"bd-m"};
1113 gchar * aaa = g_strdup_printf (
"%s",
find_atom_key(fid, 2, at_a));
1114 gchar * bbb = g_strdup_printf (
"%s",
find_atom_key(fid, 2, at_b));
1123 tmpbd -> next = g_malloc0(
sizeof*
tmpbd -> next);
1134 tmpbd -> v[0] = atof (the_bond[2]);
1135 tmpbd -> v[1] = atof (the_bond[3]);
1137 fprintf (
fp,
" <%s a=\"%d\" b=\"%d\" z_a=\"%d\" z_b=\"%d\"",
1145 fprintf (
fp,
" K=\"%f\" R_zero=\"%f\"", atof (the_bond[3]), atof (the_bond[2]));
1149 fprintf (
fp,
" K=\"%f\" R_zero=\"%f\"", atof (the_bond[2]), atof (the_bond[3]));
1154 fprintf (
fp,
" K=\"%f\" R_zero=\"%f\" KK=\"%f\" KKK=\"%f\"", atof (the_bond[3]), atof (the_bond[2]), atof (the_bond[4]), atof (the_bond[5]));
1158 fprintf (
fp,
" D=\"%f\" R_zero=\"%f\" Alpha=\"%f\"", atof (the_bond[3]), atof (the_bond[2]), atof (the_bond[4]));
1164 fprintf (
fp,
" info=\"%s\"", the_bond[j]);
1166 fprintf (
fp,
"/>\n");
1170 g_debug (
"Done:: tmpbd -> a= %d, tmpbd -> b= %d, tmpbd -> v[0]= %f, tmpbd -> v[1]= %f, this.v[0]= %f, this.v[1]=%f",
1188 gchar * bode[3] = {
"bonds-h",
"bonds-q",
"bonds-m"};
1189 gchar * desc[3] = {
"Quadratic bonds:\n\n V(R) = K x (R - R0)^2\n"
1190 " With:\n - K = spring constant (kcal mol^-1 A^-2)\n - R = bond distance (A)\n - R0 = equilibrium distance (A)\n",
1191 "Quartic bonds:\n\n V(R) = K x (R - R0)^2 + K' x (R - R0)^3 + K'' x (R - R0)^4\n"
1192 " With:\n - K, K' and K'' = nth order spring constants (kcal mol^-1 A^-2)\n"
1193 " - R = bond distance (A)\n - R0 = equilibrium distance (A)",
1194 "Morse bonds:\n\n V(R) = D x (1 - exp(-ALPHA x (R - R0)))^2\n"
1195 " With:\n - D = well depth\n - ALPHA = well width\n - R = bond distance\n - R0 = equilibrium distance (A)"};
1201 fprintf (
fp,
" <%s>\n", bode[h]);
1202 fprintf (
fp,
" <!-- %s -->\n", desc[h]);
1280 fprintf (
fp,
" </%s>\n", bode[h]);
1353void print_this_angle (
int eid,
int h,
int fid,
int inum,
int ub,
char * at_a,
char * at_b,
char * at_c,
char ** the_angle)
1356 gchar * node[2] = {
"ang-h",
"ang-q"};
1357 gchar * aaa = g_strdup_printf (
"%s",
find_atom_key(fid, 3, at_a));
1358 gchar * bbb = g_strdup_printf (
"%s",
find_atom_key(fid, 3, at_b));
1359 gchar * ccc = g_strdup_printf (
"%s",
find_atom_key(fid, 3, at_c));
1368 tmpan -> next = g_malloc0(
sizeof*
tmpan -> next);
1380 tmpan -> v[0] = atof (the_angle[3]);
1381 tmpan -> v[1] = atof (the_angle[4]);
1383 fprintf (
fp,
" <%s a=\"%d\" b=\"%d\" c=\"%d\" z_a=\"%d\" z_b=\"%d\" z_c=\"%d\"",
1391 fprintf (
fp,
" K=\"%f\" Theta_zero=\"%f\"", atof (the_angle[4]), atof (the_angle[3]));
1395 fprintf (
fp,
" K=\"%f\" Theta_zero=\"%f\"", atof (the_angle[3]), atof (the_angle[4]));
1399 fprintf (
fp,
" Kub=\"%f\" S_zero=\"%f\"", atof (the_angle[5]), atof (the_angle[6]));
1404 fprintf (
fp,
" K=\"%f\" Theta_zero=\"%f\" KK=\"%f\" KKK=\"%f\"", atof (the_angle[4]), atof (the_angle[3]),
1405 atof (the_angle[5]), atof (the_angle[6]));
1411 fprintf (
fp,
" info=\"%s\"", the_angle[j]);
1413 fprintf (
fp,
"/>\n");
1417 g_debug (
"Done:: tmpan -> a= %d, tmpan -> b= %d, tmpan -> c= %d, tmpan -> v[0]= %f, tmpan -> v[1]= %f, this.v[0]= %f, this.v[1]=%f",
1437 gchar * aode[2] = {
"angles-h",
"angles-q"};
1439 gchar * desc[3] = {
"Quadratic angles:\n\n V(Theta) = K x (Theta - Theta0)^2\n"
1440 " With:\n - K = spring constant (kcal mol^-1 rad^-2)\n - Theta = angle (°)\n - Theta0 = equilibrium angle (°)",
1441 "Quartic angles:\n\n V(Theta) = K x (Theta - Theta0)^2 + K' x (Theta - Theta0)^3 + K' x (Theta - Theta0)^4\n"
1442 " With:\n - K, K' and K'' = nth order spring constant (kcal mol^-1 rad^-nth)\n - Theta = angle (°)\n - Theta0 = equilibrium angle (°)",
1443 "Quadratic angles + Urey-Bradley (UB) parameters:\n\n V(Theta) = K x (Theta - Theta0)^2\n"
1444 " With:\n - K = spring constant (kcal mol^-1 rad^-2)\n - Theta = angle (°)\n - Theta0 = equilibrium angle(°)\n"
1445 " V(S) = Kub x (R - Rub)^2\n"
1446 " With:\n - Kub = spring constant (kcal mol^-1 A^-2)\n - S = distance 1-3 (A)\n - S0 = equilibrium distance 1-3 (A)"};
1452 fprintf (
fp,
" <%s>\n", aode[h]);
1453 fprintf (
fp,
" <!-- %s -->\n", desc[h+ub]);
1670 fprintf (
fp,
" </%s>\n", aode[h]);
1686 gchar * dode[2] = {
"dihedrals-c",
"dihedrals-ccc"};
1687 gchar * node[2] = {
"dih-c",
"dih-ccc"};
1688 gchar * desc[2] = {
"Dihedrals / torsions:\n\n V(Phi) = K x (1 + cos(n x Phi - Phi0))\n"
1689 " With:\n - K = spring constant (kcal mol^-1 rad^-2)\n - Phi = dihedral angle (°)\n - n = multiplicity\n - Phi0 = phase shift angle (°)",
1690 "Dihedrals / torsions\n\n V(Phi) = K x (Phi - Phi0)^2 + K' x (Phi - Phi0)^3 + K'' x (Phi - Phi0)^4\n"
1691 " With:\n - K, K' and K'' = nth order spring constant (kcal mol^-1 rad^-nth)\n - Phi = dihedral angle (°)\n - Phi0 = phase shift angle (°)"};
1696 fprintf (
fp,
" <%s>\n", dode[h]);
1697 fprintf (
fp,
" <!-- %s -->\n", desc[h]);
1704 fprintf (
fp,
" <%s a=\"%d\" b=\"%d\" c=\"%d\" d=\"%d\" z_a=\"%d\" z_b=\"%d\" z_c=\"%d\" z_d=\"%d\"",
1737 fprintf (
fp,
"/>\n");
1739 fprintf (
fp,
" </%s>\n", dode[h]);
1755 gchar * desc[2] = {
"Impropers:\n\n V(Phi) = K x (1 + cos(n x Phi - Phi0))\n"
1756 " With:\n - K = spring constant (kcal mol^-1 rad^-2)\n - Phi = angle (°)\n - n = multiplicity\n - Phi0 = equilibrium angle (°)",
1757 "Impropers: V(Phi) = K x (Phi - Phi0)^2\n\n"
1758 " With:\n - K = spring constant (kcal mol^-1 rad^-2)\n - Phi = angle (°)\n - Phi0 = equilibrium angle (°)"};
1762 fprintf (
fp,
" <impropers>\n");
1763 fprintf (
fp,
" <!-- %s -->\n", desc[wid == 3 ? 0 : 1]);
1770 fprintf (
fp,
" <imp a=\"%d\" b=\"%d\" c=\"%d\" d=\"%d\" z_a=\"%d\" z_b=\"%d\" z_c=\"%d\" z_d=\"%d\"",
1801 fprintf (
fp,
"/>\n");
1803 fprintf (
fp,
" </impropers>\n");
1818 gchar * desc = {
"Inversions\n 0= Key_a, 1= Key_b, 2= Key_c, 3= Key_d, 4= K, 5= Phi0, 7= FF info\n\n V(φ) = K x (Phi - Phi0)^2\n"
1819 " With:\n - K = spring constant (kcal mol^-1 rad^-2)\n - Phi = angle (°)\n - Phi0 = equilibrium angle (°)"};
1822 fprintf (
fp,
" <inversions>\n");
1823 fprintf (
fp,
" <!-- %s -->\n", desc);
1830 fprintf (
fp,
" <inv a=\"%d\" b=\"%d\" c=\"%d\" d=\"%d\" z_a=\"%d\" z_b=\"%d\" z_c=\"%d\" z_d=\"%d\" K=\"%f\" Phi_zero=\"%f\"",
1842 fprintf (
fp,
"/>\n");
1844 fprintf (
fp,
" </inversions>\n");
1859 gchar * desc[3] = {
"Non-bonded 12-6\n 0= Key_a, 1= Epslion, 2= R0 (A), 3= FF info\n\n Non-bonded (12-6): V(rij) = Epslion(ij) x [(R0(ij)/rij)^12 - 2 x (R0(ij)/rij)^6]\n"
1861 " Epslion(ij) = sqrt(Epslion(i) x Epslion(j)) and Epslion(i) (kcal mol^-1)\n"
1862 " R0(ij)= (R0(i) + R0(j))/2 and R0(i) (A)\n",
1863 "Non-bonded 12-6\n 0= Key_a, 1= A, 2= B, 3= FF info\n\n Non-bonded (12-6): V(rij) = A(ij)/rij^12 - B(ij)/rij^6\n"
1865 " A(ij) = sqrt(Ai x Aj)\n"
1866 " B(ij) = sqrt(Bi x Bj)\n",
1867 "Non-bonded 9-6\n 0= Key_a, 1= Epslion, 2= R0 (A), 3= FF info\n\n Non-bonded (9-6): V(rij) = Epslion(ij) x [2 x (R0(ij)/rij)^9 - 3 x (R0(ij)/rij)^6]\n"
1869 " Epslion(ij) = 2 x sqrt(Epslion(i) x Epslion(j)) x R0(i)^3 x R0(j)^3 / [ R0(i)^6 + R0(j)^6 ] and Epslion(i) (kcal mol^-1)\n"
1870 " R0(ij)= ((R0(i)^6 + R0(j)^6)/2) ^ 1/6 and R0(i) (A)\n"};
1873 int did = (fid <= CHARMMSI || fid >=
OPLSAAP) ? 0 : (fid ==
CVFF || fid ==
CVFF_AUG) ? 1 : 2;
1874 int cid = (fid >
COMPASS) ? 1 : 0;
1875 int wdi[2] = {2, 4};
1878 fprintf (
fp,
" <non-bonded>\n");
1879 fprintf (
fp,
" <!-- %s -->\n", desc[did]);
1901 fprintf (
fp,
" Eii=\"%f\" Rii=\"%f\"", atof (
field_vdw[i][3+2*cid]), atof (
field_vdw[i][4+2*cid]));
1904 j = wdi[wid]+1+2*cid;
1910 fprintf (
fp,
"/>\n");
1919 if(g_strcmp0 (
field_equi[0][k][l],
" ") != 0)
1925 fprintf (
fp,
" info=\"Equi. to %s\"",
field_vdw[i][0]);
1927 fprintf (
fp,
"/>\n");
1934 fprintf (
fp,
" </non-bonded>\n");
1970 for (i=0; i<
tmp_proj -> nspec; i++)
1985 for (i=0; i<
tmp_proj -> nspec; i++)
1988 g_debug (
"For spec: %d, number of match = %d", i,
atoms_id[i]);
2021 for (i=0; i<num; i++)
2024 if (data[i] !=
val[i] && data[i] != -1)
return FALSE;
2046void find_object_ijkl (
int hid,
int foid,
int oid,
int sa,
int za,
int sb,
int zb,
int sc,
int zc,
int sd,
int zd)
2054 gboolean do_this_id, save_this_id;
2056 for (h=0; h<2+hid; h++)
2089 save_this_id = TRUE;
2093 while (test_obj_id != NULL)
2095 if (test_obj_id -> type == h && test_obj_id -> oid == i)
2097 save_this_id = FALSE;
2100 test_obj_id = test_obj_id -> next;
2142 for (i=0; i<
tmp_proj -> nspec-1; i++)
2146 for (j=i+1; j<
tmp_proj -> nspec; j++)
2152 find_object_ijkl (1, 1, 0, i, k, j, l, -1, -1, -1, -1);
2153 find_object_ijkl (1, 1, 0, j, l, i, k, -1, -1, -1, -1);
2158 for (i=0; i<
tmp_proj -> nspec; i++)
2163 find_object_ijkl (1, 1, 0, i, k, i, k, -1, -1, -1, -1);
2175 int i, j, k, l, m, n;
2176 for (i=0; i<
tmp_proj -> nspec; i++)
2181 for (j=0; j<
tmp_proj -> nspec; j++)
2186 for (k=0; k<
tmp_proj -> nspec; k++)
2191 find_object_ijkl (0, 4, 1, i, l, j, m, k, n, -1, -1);
2209 int i, j, k, l, m, n, o, p, q;
2210 for (i=0; i<
tmp_proj -> nspec; i++)
2215 for (j=0; j<
tmp_proj -> nspec; j++)
2220 for (k=0; k<
tmp_proj -> nspec; k++)
2225 for (l=0; l<
tmp_proj -> nspec; l++)
2231 find_object_ijkl (-q, 6+q*2+q*(
id-1), 2+
id, i, m, j, n, k, o, l, p);
2250 for (i=0; i<
tmp_proj -> nspec; i++)
2255 find_object_ijkl (-1, 10, 5, i, j, -1, -1, -1, -1, -1, -1);
2269void print_all (
int oid)
2271 gchar * prop[7] = {
"atom",
"bond",
"angle",
"dihedral",
"improper",
"inversion",
"vdw"};
2272 g_debug (
"Field %s found: %d", prop[oid-1],
tmp_obj_id ->
id+1);
2291 g_debug (
"sp= %d, atoms_id[%d]= %d, num= %d", sp, sp,
atoms_id[sp], num);
2377 xmlTextReaderPtr reader;
2378 xmlNodePtr racine, f_node;
2379 xmlNodePtr n_node, m_node, o_node;
2382 const xmlChar fml[7]=
"ff-xml";
2383 gchar * data_nodes[11]={
"atoms",
"bonds-h",
"bonds-q",
"bonds-m",
"angles-h",
"angles-q",
2384 "dihedrals-c",
"dihedrals-ccc",
"impropers",
"inversions",
"non-bonded"};
2385 gchar * data_n[11]={
"at",
"bd-h",
"bd-q",
"bd-m",
"ang-h",
"ang-q",
2386 "dih-c",
"dih-ccc",
"imp",
"inv",
"non-bd"};
2394 gchar * force_field_name;
2396 int odim[10] = {2, 2, 2, 3, 3, 4, 4, 4, 4, 1};
2402 filetoread = g_strdup_printf (
"%s\\force_fields\\%s.ffl", PACKAGE_LIB_DIR,
field_ffl[field]);
2404 filetoread = g_strdup_printf (
"%s/force_fields/%s.ffl", PACKAGE_LIB_DIR,
field_ffl[field]);
2407 reader = xmlReaderForFile(
filetoread, NULL, 0);
2410 g_warning (
"Error reading FF file %s, reader error ?!",
filetoread);
2418 g_warning (
"Error reading FF file %s, xmlParsing error ?!",
filetoread);
2422 racine = xmlDocGetRootElement(doc);
2425 g_warning (
"Error reading FF file %s, missing XML root node ?!",
filetoread);
2429 if (g_strcmp0 ((
char *)(racine -> name), (
char *)fml) != 0)
2431 g_warning (
"Error reading FF file %s, missing ff-xml node ?!",
filetoread);
2436 f_node =
findnode (racine -> children,
"force-field");
2439 g_warning (
"Error reading FF file %s, missing force field node ?!",
filetoread);
2443 force_field_name = g_strdup_printf (
"%s", (gchar *)xmlNodeGetContent(f_node));
2444 f_node =
findnode (racine -> children,
"units");
2447 g_warning (
"Error reading FF file %s, missing units node ?!",
filetoread);
2451 str = g_strdup_printf (
"%s", (gchar *)xmlNodeGetContent(f_node));
2462 g_warning (
"Error reading FF file %s, units, ff_unit = %d < 0 ?!",
filetoread,
ff_unit);
2466 f_node =
findnode (racine -> children,
"ff-data");
2469 g_warning (
"Error reading FF file %s, missing ff-data node ?!",
filetoread);
2477 for (i=0; i<11; i++)
2479 m_node =
findnode (f_node -> children, data_nodes[i]);
2482 g_warning (
"Error reading FF file %s, ff-data, i= %d, missing node ?!",
filetoread, i);
2486 ff_objects[i] = (int)atof((
char *)xmlNodeGetContent(m_node));
2489 g_warning (
"Error reading FF file %s, ff-data, ff_objects[%d] = %d < 0 ?!",
filetoread, i,
ff_objects[i]);
2495 prop = m_node -> properties;
2498 g_warning (
"Error reading FF file %s, ff-data, i= %d, missing node prop ?!",
filetoread, i);
2504 o_node = prop -> children;
2507 g_warning (
"Error reading FF file %s, ff-data, i= %d, missing prop data ?!",
filetoread, i);
2511 if (g_strcmp0 (
"dim",(
char *)prop -> name) == 0)
2513 ff_dim[i] = (int) atof((
char *)xmlNodeGetContent(o_node));
2519 else if (g_strcmp0 (
"pot",(
char *)prop -> name) == 0)
2521 ff_key[i-1] = (int)atof((
char *)xmlNodeGetContent(o_node));
2523 prop = prop -> next;
2527 for (i=0; i<11; i++)
2531 f_node =
findnode (racine -> children, data_nodes[i]);
2534 g_warning (
"Error reading FF file %s, i= %d, missing node ?!",
filetoread, i);
2538 n_node = f_node -> children;
2541 g_warning (
"Error reading FF file %s, i= %d, missing child node ?!",
filetoread, i);
2592 ff_data -> atoms_z[j] = g_malloc0 (odim[i-1]*
sizeof*
ff_data -> atoms_z[j]);
2601 n_node =
findnode (n_node, data_n[i]);
2604 g_warning (
"Error reading FF file %s, i= %d, j= %d, missing node ?!",
filetoread, i, j);
2608 prop = n_node -> properties;
2611 g_warning (
"Error reading FF file %s, i= %d, j= %d, missing prop ?!",
filetoread, i, j);
2617 o_node = prop -> children;
2620 g_warning (
"Error reading FF file %s, i= %d, j= %d, missing prop node ?!",
filetoread, i, j);
2627 if (g_strcmp0 (
"label",(
char *)prop -> name) == 0)
2629 ff_atoms[j][0] = g_strdup_printf (
"%s", (
char *)xmlNodeGetContent(o_node));
2631 else if (g_strcmp0 (
"mass",(
char *)prop -> name) == 0)
2633 ff_atoms[j][1] = g_strdup_printf (
"%s", (
char *)xmlNodeGetContent(o_node));
2635 else if (g_strcmp0 (
"key",(
char *)prop -> name) == 0)
2637 ff_atoms[j][2] = g_strdup_printf (
"%s", (
char *)xmlNodeGetContent(o_node));
2639 else if (g_strcmp0 (
"info",(
char *)prop -> name) == 0)
2641 ff_atoms[j][3] = g_strdup_printf (
"%s", (
char *)xmlNodeGetContent(o_node));
2645 g_warning (
"Error reading FF file %s, i= %d, j= %d, unexpected node ?!",
filetoread, i, j);
2651 if (g_strcmp0 (
"a",(
char *)prop -> name) == 0)
2653 ff_data ->
atoms_id[j][0] = (int) atof((
char *)xmlNodeGetContent(o_node));
2655 else if (g_strcmp0 (
"b",(
char *)prop -> name) == 0)
2657 ff_data ->
atoms_id[j][1] = (int) atof((
char *)xmlNodeGetContent(o_node));
2659 else if (g_strcmp0 (
"c",(
char *)prop -> name) == 0)
2661 ff_data ->
atoms_id[j][2] = (int) atof((
char *)xmlNodeGetContent(o_node));
2663 else if (g_strcmp0 (
"d",(
char *)prop -> name) == 0)
2665 ff_data ->
atoms_id[j][3] = (int) atof((
char *)xmlNodeGetContent(o_node));
2667 else if (g_strcmp0 (
"z_a",(
char *)prop -> name) == 0)
2669 ff_data -> atoms_z[j][0] = (int) atof((
char *)xmlNodeGetContent(o_node));
2671 else if (g_strcmp0 (
"z_b",(
char *)prop -> name) == 0)
2673 ff_data -> atoms_z[j][1] = (int) atof((
char *)xmlNodeGetContent(o_node));
2675 else if (g_strcmp0 (
"z_c",(
char *)prop -> name) == 0)
2677 ff_data -> atoms_z[j][2] = (int) atof((
char *)xmlNodeGetContent(o_node));
2679 else if (g_strcmp0 (
"z_d",(
char *)prop -> name) == 0)
2681 ff_data -> atoms_z[j][3] = (int) atof((
char *)xmlNodeGetContent(o_node));
2683 else if (i > 0 && g_strcmp0 (
"info",(
char *)prop -> name) == 0)
2685 ff_data -> info[j] = g_strdup_printf (
"%s", (
char *)xmlNodeGetContent(o_node));
2693 if (g_strcmp0 (
"Ei",(
char *)prop -> name) == 0)
2695 ff_data ->
param[j][0] = atof((
char *)xmlNodeGetContent(o_node));
2697 else if (g_strcmp0 (
"Ri",(
char *)prop -> name) == 0)
2699 ff_data ->
param[j][1] = atof((
char *)xmlNodeGetContent(o_node));
2701 else if (g_strcmp0 (
"Eii",(
char *)prop -> name) == 0)
2703 ff_data ->
param[j][2] = atof((
char *)xmlNodeGetContent(o_node));
2705 else if (g_strcmp0 (
"Rii",(
char *)prop -> name) == 0)
2707 ff_data ->
param[j][3] = atof((
char *)xmlNodeGetContent(o_node));
2709 else if (g_strcmp0 (
"A",(
char *)prop -> name) == 0)
2711 ff_data ->
param[j][0] = atof((
char *)xmlNodeGetContent(o_node));
2713 else if (g_strcmp0 (
"B",(
char *)prop -> name) == 0)
2715 ff_data ->
param[j][1] = atof((
char *)xmlNodeGetContent(o_node));
2719 g_warning (
"Error reading FF file %s, i= %d, j= %d, unexpected node ?! node name= %s",
filetoread, i, j, (
char *)prop -> name);
2734 if (g_strcmp0 (
"K",(
char *)prop -> name) == 0)
2736 ff_data ->
param[j][0] = atof((
char *)xmlNodeGetContent(o_node));
2738 else if (g_strcmp0 (
"R_zero",(
char *)prop -> name) == 0)
2740 ff_data ->
param[j][1] = atof((
char *)xmlNodeGetContent(o_node));
2742 else if (g_strcmp0 (
"Theta_zero",(
char *)prop -> name) == 0)
2744 ff_data ->
param[j][1] = atof((
char *)xmlNodeGetContent(o_node));
2746 else if (g_strcmp0 (
"Phi_zero",(
char *)prop -> name) == 0)
2748 ff_data ->
param[j][1] = atof((
char *)xmlNodeGetContent(o_node));
2750 else if (g_strcmp0 (
"KK",(
char *)prop -> name) == 0)
2752 ff_data ->
param[j][2] = atof((
char *)xmlNodeGetContent(o_node));
2754 else if (g_strcmp0 (
"KKK",(
char *)prop -> name) == 0)
2756 ff_data ->
param[j][3] = atof((
char *)xmlNodeGetContent(o_node));
2758 else if (g_strcmp0 (
"Kub",(
char *)prop -> name) == 0)
2760 ff_data ->
param[j][2] = atof((
char *)xmlNodeGetContent(o_node));
2762 else if (g_strcmp0 (
"S_zero",(
char *)prop -> name) == 0)
2764 ff_data ->
param[j][3] = atof((
char *)xmlNodeGetContent(o_node));
2766 else if (g_strcmp0 (
"n",(
char *)prop -> name) == 0)
2768 ff_data ->
param[j][2] = atof((
char *)xmlNodeGetContent(o_node));
2770 else if (g_strcmp0 (
"D",(
char *)prop -> name) == 0)
2772 ff_data ->
param[j][0] = atof((
char *)xmlNodeGetContent(o_node));
2774 else if (g_strcmp0 (
"Alpha",(
char *)prop -> name) == 0)
2776 ff_data ->
param[j][2] = atof((
char *)xmlNodeGetContent(o_node));
2780 g_warning (
"Error reading FF file %s, i= %d, j= %d, unexpected node ?! node name= %s",
filetoread, i, j, (
char *)prop -> name);
2788 prop = prop -> next;
2790 n_node = n_node -> next;
2792 if (i > 0 && ! setinfo)
2808 xmlFreeTextReader(reader);
2810 return force_field_name;
2852 if (spf < tmp_proj -> nspec)
2918 g_debug (
"\n\nField id= %d, name= %s", i,
field_keyw[i]);
2919 associate_pointers_to_field_data (i);
2921 str = g_strdup_printf (
"%s/force_fields/%s.ffl", PACKAGE_LIB_DIR,
field_ffl[i]);
2922 fp = fopen (str,
"w");
2923 fprintf (
fp,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
2924 fprintf (
fp,
"<!-- Force Field Library XML file -->\n");
2925 fprintf (
fp,
"<ff-xml>\n");
2926 fprintf (
fp,
" <force-field>%s</force-field>\n",
field_acro[i]);
2927 fprintf (
fp,
" <!-- data adapted from the file: %s -->\n",
ffo_file[i]);
2928 fprintf (
fp,
" <units>k-calories per mol</units>\n");
2940 fprintf (
fp,
"</ff-xml>\n");
integer(kind=c_int) function chemistry()
void label(cairo_t *cr, double val, int axe, int p, project *this_proj)
draw axis label
gchar * fnames[2][16][21]
classical_field * tmp_field
Variable declarations for the creation of the DL_POLY input file(s)
void set_data(int pid, int obj, int oid, int faid)
save retrieved force field data
void field_find_dihedrals(int id)
retrieve available dihedral parameters in force field database
field_data * ff_angles[2]
int get_z(int faid)
get field atom Z
gboolean is_a_match(int *data, int num, int val[4])
is this a match ?
int get_angle(int faid, int aid)
retrieve all angle parameter(s) for this field atom
int get_bond(int faid, int bid)
retrieve all bonding parameter(s) for this field atom
char *** field_inversions
void print_improper_table(int fid, int inum)
print improper(s) table to file
int get_fkey(int fid, int prop, int col)
retrieve key for property in force field database
gchar * find_atom_key(int fid, int prop, char *keyw)
retrieve property key in force field database for atom
void print_this_bond(int eid, int h, int fid, int inum, char *at_a, char *at_b, char **the_bond)
print this bond to file
xmlNodePtr findnode(xmlNodePtr startnode, char *nname)
find XML node
void print_dihedral_table(int fid, int inum)
print dihedral(s) table to file
void find_object_ijkl(int hid, int foid, int oid, int sa, int za, int sb, int zb, int sc, int zc, int sd, int zd)
retrieve parameter from force field database
float get_force_field_atom_mass(int sp, int num)
get force field atomic mass
int get_pdim(int fid, int prop, int col)
retrieve number of parameters for property in force field database
gchar * open_field_file(int field)
open force field XML file
void field_find_angles()
retrieve available angle parameters in force field database
void print_atom_table(int fid)
print force field atom data to file
G_MODULE_EXPORT void setup_this_force_field(int id)
setup force field parameters
int find_atom_id(int print, char *keyw)
find atom id in force field database
void clean_this_field_data(xmlDoc *doc, xmlTextReaderPtr reader)
free force field XML file data
void print_this_angle(int eid, int h, int fid, int inum, int ub, char *at_a, char *at_b, char *at_c, char **the_angle)
print this angle to file
void print_inversion_table(int fid, int inum)
print inversion(s) table to file
int get_torsion(int faid, int tid, int a, int b)
retrieve all torsion parameter(s) for this field atom
field_object_match ** all_data[10]
void field_has_element(int aid)
retrieve force field parameters for this atom
char * field_ffl[N_FIELDS]
char * field_acro[N_FIELDS]
field_object_match * field_objects_id[6]
char * field_name[N_FIELDS]
gboolean not_done(int eid, int a, int b)
was this case already considered ?
void field_find_vdw()
retrieve available VdW parameters in force field database
int get_improper(int faid, int a, int b)
retrieve all improper parameter(s) for this field atom
int clean_xml_data(xmlDoc *doc, xmlTextReaderPtr reader)
free XML data
char * field_keyw[N_FIELDS]
void print_object_dim_and_key_tables(int fid)
print tables dimensions and keys to file
void print_angle_table(int fid, int inum)
print angle(s) table to file
field_object_match * om_tmp
void field_find_bonds()
retrieve available bond parameters in force field database
int find_atom_z(char *keyw)
find atom Z
field_object_match * tmp_obj_id
void print_bond_table(int fid, int inum)
print force field bond table to file
int get_atoms(int z)
retrieve all field atom(s) with matching Z
int get_apex(int faid, int aid)
retrieve all angle apex parameter(s) for this field atom
int field_find_atoms()
retrieve matching atom from force field data base
gboolean not_done_an(int eid, int a, int b, int c)
was this case already considered ?
char *** field_dihedrals[2]
int get_vdw(int faid)
retrieve all VdW parameter(s) for this field atom
void print_vdw_table(int fid, int inum)
print VdW table to file
Variable declarations for the creation of the force field database.
int charmm36_cgenff_objects[14]
char * charmm36_prot_impropers[35][8]
char * amber99_vdw[42][4]
char * charmm_silicates_dihedrals[34][8]
char * CVFF_aug_atoms[172][5]
char * Compass_angles[94][8]
char * charmm_silicates_vdw[13][6]
int charmm35_ethers_dim[14]
char * amber98_atoms[2][4]
char * charmm36m_prot_angles[364][8]
char * amber99_atoms[2][5]
char * CVFF_torsions_auto[295][8]
int charmm36m_prot_objects[14]
char * charmm36_prot_bonds[132][5]
char * PCFF_inversions[83][7]
char * OPLSAAR_dihedrals[2482][7]
char * charmm22_prot_vdw[47][6]
char * Compass_bonds[54][7]
char * amber94_vdw[34][4]
char * charmm36_prot_vdw[53][6]
char * CFF91_inversions[70][7]
char * charmm36_carb_vdw[57][6]
char * OPLSAAR_bonds[242][5]
char * charmm22_prot_metals_bonds[139][5]
char * amber99_bonds[116][5]
int charmm36_na_objects[14]
char * amber94_impropers[31][8]
char * CVFF_aug_angles_auto[640][6]
char * charmm36_cgenff_vdw[156][6]
char * Compass_torsions[95][11]
char * charmm36_na_bonds[89][5]
char * charmm36_prot_angles[364][8]
char * charmm36_na_vdw[42][6]
char * charmm35_ethers_bonds[22][5]
char * CVFF_aug_torsions_auto[342][8]
char * CVFF_impropers[41][8]
char * amber98_bonds[83][5]
char * amber99_equi[2][15]
char * amber98_vdw[35][4]
char * CVFF_aug_equivalence_auto[162][11]
char * charmm36_na_dihedrals[502][8]
int charmm36_prot_dim[14]
char * CFF91_atoms[93][5]
char * charmm36_cgenff_bonds[506][5]
char * charmm36_lipid_atoms[29][5]
int charmm35_ethers_objects[14]
char * PCFF_angles[302][8]
char * charmm35_ethers_atoms[13][5]
char * charmm22_prot_dihedrals[445][8]
char * CVFF_aug_impropers[41][8]
char * charmm36_lipid_dihedrals[180][8]
char * charmm36_prot_dihedrals[705][8]
char * charmm36m_prot_dihedrals[706][8]
char * charmm_silicates_bonds[14][5]
char * OPLSAAR_vdw[145][7]
char * charmm36_cgenff_dihedrals[3937][8]
char * charmm36_carb_atoms[59][5]
char * PCFF_angles_auto[329][6]
char * CVFF_equivalence[129][7]
char * amber96_atoms[2][4]
char * CVFF_aug_vdw[86][4]
int charmm36m_prot_dim[14]
char * CVFF_angles_auto[563][6]
char * CFF91_equivalence_auto[97][11]
char * charmm35_ethers_vdw[13][6]
char * charmm36_carb_dihedrals[1354][8]
char * charmm35_ethers_angles[55][8]
int charmm36_carb_dim[14]
int charmm36_prot_objects[14]
char * charmm22_prot_metals_impropers[43][8]
char * charmm22_prot_metals_atoms[98][5]
char * charmm22_prot_metals_dihedrals[452][8]
char * CVFF_equivalence_auto[123][11]
int charmm22_prot_dim[14]
char * PCFF_equivalence[134][7]
char * charmm36_lipid_vdw[29][6]
char * OPLSAAR_impropers[131][7]
char * Compass_equivalence[46][7]
char * PCFF_equivalence_auto[108][11]
char * charmm36_cgenff_angles[1561][8]
char * OPLSAAM_atoms[78][4]
char * CVFF_aug_equivalence[168][7]
char * CFF91_angles_auto[330][6]
char * CFF91_equivalence[95][7]
char * PCFF_torsions[492][11]
char * charmm36_lipid_angles[131][8]
char * OPLSAAR_angles[593][5]
char * amber96_vdw[35][4]
char * CVFF_aug_bonds_auto[798][5]
char * charmm36_prot_atoms[53][5]
char * charmm36m_prot_impropers[35][8]
char * CVFF_bonds_auto[776][5]
char * charmm_silicates_atoms[13][5]
char * amber94_atoms[2][4]
char * CFF91_torsions_auto[216][8]
char * charmm22_prot_angles[324][8]
char * CFF91_angles[155][8]
char * charmm22_prot_atoms[47][5]
char * amber96_equi[2][15]
char * amber99_angles[281][6]
char * PCFF_torsions_auto[216][8]
char * CFF91_bonds_auto[667][5]
char * amber99_impropers[38][8]
int charmm22_prot_metals_dim[14]
char * OPLSAAM_dihedrals[1446][7]
char * CFF91_bonds[58][7]
char * CVFF_atoms[133][5]
char * charmm36_cgenff_atoms[163][5]
char * amber98_equi[2][15]
char * amber94_dihedrals[81][9]
char * amber94_equi[2][15]
char * CVFF_aug_morse_bonds[752][6]
char * amber98_dihedrals[83][9]
char * charmm36_carb_impropers[14][8]
char * amber96_bonds[83][5]
char * CFF91_torsions[294][11]
char * OPLSAAM_vdw[78][7]
char * amber94_bonds[83][5]
char * charmm35_ethers_dihedrals[106][8]
int charmm22_prot_metals_objects[14]
char * CVFF_morse_bonds[775][6]
char * charmm36_carb_angles[438][8]
char * amber99_dihedrals[164][9]
char * charmm36_na_atoms[42][5]
int charmm36_lipid_objects[14]
char * charmm36m_prot_vdw[53][6]
char * charmm36_lipid_bonds[50][5]
char * charmm36m_prot_atoms[53][5]
int charmm_silicates_objects[14]
char * Compass_vdw[46][4]
char * charmm22_prot_impropers[34][8]
char * charmm36_lipid_impropers[4][8]
char * OPLSAAR_atoms[145][4]
char * OPLSAAM_bonds[159][5]
char * charmm36_cgenff_impropers[125][8]
char * amber96_dihedrals[81][9]
char * charmm_silicates_angles[27][8]
char * charmm36_na_impropers[15][8]
char * amber96_impropers[31][8]
char * PCFF_atoms[133][5]
char * charmm36m_prot_bonds[132][5]
int charmm36_carb_objects[14]
char * charmm22_prot_metals_angles[345][8]
char * charmm22_prot_metals_vdw[98][6]
char * Compass_atoms[45][5]
char * amber98_impropers[31][8]
char * amber98_angles[191][6]
char * OPLSAAM_impropers[105][7]
int charmm36_cgenff_dim[14]
int charmm22_prot_objects[14]
char * OPLSAAM_angles[437][5]
int charmm_silicates_dim[14]
char * amber96_angles[191][6]
char * Compass_inversions[22][7]
int charmm36_lipid_dim[14]
char * PCFF_bonds_auto[627][5]
char * PCFF_bonds[126][7]
char * charmm22_prot_bonds[122][5]
char * charmm36_na_angles[226][8]
char * amber94_angles[191][6]
char * charmm36_carb_bonds[153][5]
int ** allocdint(int xal, int yal)
allocate an int ** pointer
int * allocint(int val)
allocate an int * pointer
Global variable declarations Global convenience function declarations Global data structure defin...
element_data periodic_table_info[]
gchar * exact_name(gchar *name)
short cut to print string without spaces
Messaging function declarations.