// ############################## START FUNC ############################################ // Here is a function which aims to achieve the conformations of all in d_conn listed double bonds. // d_conn is the direct output from function "determine_muliple_bonds" while the atoms involved are // in the string dump (= chirstring in the over_all1 function) in the form of paths; example: // "0.06 0.08 &5 0.08 0.06 &1 0.06 0.08 &5 0.08 0.06 &1 0.06 0.06 &1 /1//7/#" fallowed by other // strings. So the function begin with checking all double bonded atoms with their respective // opponent atom over each C´=C´´ bond. This means that the constellation /C´//neighbour a/; // /C´//neighbour b/; /C´´//neighbour c/ and /C´´//neighbour d/ is searched in the string dump. // Strings with higher priority are already placed far back in the string, while low priority strings // can be found in the front of the string. So branch (a against b in priority order) will occupy the // first two variables comb1[0] + comb1[1] and branch (c against d in priority order) the two // two last variables comb1[2] + comb1[3]. function cis_trans(d_conn, dump, atom_sorts, mconn, x, y, z, arom_list) { var number_of_atoms=atom_sorts.length; var comb1=new Array(0); var n=0; var saml2=""; var avst1=0; var avst2=0; var coll=""; var opp=0; var acx = 0; var bdx = 0; var acy = 0; var bcy = 0; var acz = 0; var bdz = 0; var adx = 0; var bcx = 0; var ady = 0; var bcy = 0; var adz = 0; var bcz = 0; var sx=0; var sy=0; var sz=0; for(w=0;ww) continue; // Do not count twice comb1=new Array(dump.length*2); // The loop below, under=0-1 is assigned to get the two branches a and b before c and d // independent of relative priority between for instance a and c. b can be before a according // to priority but c can not be before a, because it belongs to the opposite atom C´´ while // a is a neighbour to C´. for(under=0;under<2;under++){ n=w; if(under==1){ n=opp; // opp means opponent to atom n (not w). opp=w; } for(q=0;q-1 || arom_list.indexOf(" "+opp+" ")>-1) continue; // no arom. rings temp="/"+n+"//"+mconn[n][q]+"/"; thjalp=dump.lastIndexOf(temp); if(thjalp>-1){ if(under==1) thjalp=thjalp+dump.length; // To have the branches sorted with respect to C=C atoms comb1[thjalp]=mconn[n][q]+" "; } else{ // Hydrogen branches are not listed in dump. if(atom_sorts[mconn[n][q]]==1 && under==0) comb1[0]=mconn[n][q]+" "; if(atom_sorts[mconn[n][q]]==1 && under==1) comb1[dump.length]=mconn[n][q]+" "; } } } // end under loop saml2=comb1.join(""); // The last " " from branch 4 is chopped off. saml2=saml2.substring(0,saml2.length-1); comb1=saml2.split(" "); if(comb1.length<4) continue; // The fallowing expression calculates the distance between the two average points between // branchatom a+d and b+c. Of course the division with 2 is just there to show the strategi. // Because of the consequtive comparisation, it can be let out. acx=(parseFloat(x[comb1[0]])+parseFloat(x[comb1[2]]))/2; // average x between branch atom a & c bdx=(parseFloat(x[comb1[1]])+parseFloat(x[comb1[3]]))/2; // average x between branch atom b & d acy=(parseFloat(y[comb1[0]])+parseFloat(y[comb1[2]]))/2; // average y between branch atom a & c bdy=(parseFloat(y[comb1[1]])+parseFloat(y[comb1[3]]))/2; acz=(parseFloat(z[comb1[0]])+parseFloat(z[comb1[2]]))/2; bdz=(parseFloat(z[comb1[1]])+parseFloat(z[comb1[3]]))/2; adx=(parseFloat(x[comb1[0]])+parseFloat(x[comb1[3]]))/2; // average x between branch atom a & d bcx=(parseFloat(x[comb1[1]])+parseFloat(x[comb1[2]]))/2; // average x between branch atom b & c ady=(parseFloat(y[comb1[0]])+parseFloat(y[comb1[3]]))/2; // average y between branch atom a & d bcy=(parseFloat(y[comb1[1]])+parseFloat(y[comb1[2]]))/2; adz=(parseFloat(z[comb1[0]])+parseFloat(z[comb1[3]]))/2; bcz=(parseFloat(z[comb1[1]])+parseFloat(z[comb1[2]]))/2; avst1=Math.pow(acx-bdx,2)+Math.pow(acy-bdy,2)+Math.pow(acz-bdz,2); avst2=Math.pow(adx-bcx,2)+Math.pow(ady-bcy,2)+Math.pow(adz-bcz,2); // If avst2 > avst -> cis (Which is theoretically safe if the bond angle beween a & b on the // same base atom (and c, d) is >90 degrees. Determine the 6 molecular plane and checking cross // point beween branch diagonales is of course even safer, but also more tricky. One can also // normalize the bond lengths. Then already the distance ac vs ad and bd vs bc must be enough.) // The simple picture below is for the extreme where the bonds lengths for b, d are 0. Then // C=C hides in the C at the bottom and distance ca = distance ii. If the molecule is badly // optimized, however, there can be errors. // a..x..c // p p // C sx = (parseFloat(x[w])+parseFloat(x[opp]))/2; sy = (parseFloat(y[w])+parseFloat(y[opp]))/2; sz = (parseFloat(z[w])+parseFloat(z[opp]))/2; if(avst1