Update 2D coordinate generation and Windows build

This commit is contained in:
Chris Morley
2008-11-22 14:37:03 +00:00
parent a2eb4aa78a
commit c91c4b8134
6 changed files with 115 additions and 7 deletions
+9
View File
@@ -1,3 +1,12 @@
2008-11-22 Chris Morley
* src/mcdlutil.cpp: Small bug fixes from Sergei Trepalin
* windows-vc2005/babelconfig.h, windows-vc2005/OBDLL/OBDLL.vcproj,
windows-vc2005/OBMCDL/MCDL.vcproj,
windows-vc2005/OBUtilFormats/OBUtilFormats.vcproj: Windows
build updated to make groupRedraw() callable.
2008-11-22 Chris Morley
* src/ops/loader.cpp: do not remove comments after 4th line of
+62 -3
View File
@@ -2406,12 +2406,12 @@ void TSimpleMolecule::redraw(const std::vector<int>listAtomClean, const std::vec
ly=getBond(sCHB1)->at[1];
if (ly == sCHA1) {
lx=getBond(sCHB1)->at[1];
lx=getBond(sCHB1)->at[0];
ly=getBond(sCHB1)->at[0];
};
atomSecond=ly;
//for group it is necessary to calculate unit vector direction
uvX=getAtom(ly)->rx-getAtom(lx)->rx;
uvX=getAtom(ly)->ry-getAtom(lx)->ry;
uvY=getAtom(ly)->ry-getAtom(lx)->ry;
bondLengthOld=sqrt(uvX*uvX+uvY*uvY);
if (bondLengthOld<0.01) bondLengthOld=1;
uvX=uvX/bondLengthOld;
@@ -2760,7 +2760,7 @@ void TSimpleMolecule::getMolfile(std::ostream & data) {
default: charge=0; break;
}
snprintf(buff, BUFF_SIZE, "%10.4f%10.4f%10.4f %-3s%2d%3d%3d%3d%3d",
sa->rx, sa->ry, 0.0, (aSymb[sa->na]), 0,charge,0,0,0);
sa->rx, sa->ry, 0.0, (aSymb[sa->na]).c_str(), 0,charge,0,0,0);
data << buff << endl;
};
for (int i=0; i<nBonds(); i++) {
@@ -7159,6 +7159,65 @@ void implementBondStereo(const std::vector<int> iA1, const std::vector<int> iA2,
};
};
//****************************************************************************
//Group redraw - generate 2D coordinates for chemical group
//****************************************************************************
int OBMCDL groupRedraw(OBMol * pmol, int bondN, int atomN) {
//bondN - index of acyclic bond in pmol (zero-based). atomN - index of atom attached to bond bondN to start redraw from it (1-based)
//returns 0 - all OK, =1 - number of atoms or bond are outside defined, = 2-cyclic bond
TSimpleMolecule sm;
int result=0;
std::vector<int> allAtomList(NATOMSMAX);
std::vector<int> atomList(NATOMSMAX);
std::vector<int> bondList(NBONDSMAX);
OBAtom * atom;
int i,n,at,atEx,na,nb;
sm.readOBMol(pmol);
atomN--; //TSimpleMolecule: numeration of atoms is started from 0, while for OBMOl from 1;
if ((bondN >= sm.nBonds()) || (bondN < 0) || (atomN >= sm.nAtoms()) || (atomN < 0)) {
result=1;
return result;
};
if (sm.getBond(bondN)->db > 0) {
result=2;
return result;
};
for (i=0; i<sm.nAtoms(); i++) allAtomList[i]=0;
n=0;
if (sm.getBond(bondN)->at[0] == atomN) {
at=sm.getBond(bondN)->at[0];
atEx=sm.getBond(bondN)->at[1];
} else {
at=sm.getBond(bondN)->at[1];
atEx=sm.getBond(bondN)->at[0];
};
na=0;
if (sm.makeFragment(na,atomList,at,atEx)) {
for (i=0; i<na; i++) allAtomList[atomList[i]]=1;
nb=0;
for (i=0; i<sm.nBonds(); i++) if ((allAtomList[sm.getBond(i)->at[0]] == 1) && (allAtomList[sm.getBond(i)->at[1]] == 1)) {
bondList[nb]=i;
nb++;
};
sm.redraw(atomList,bondList,na,nb,3,atomN,bondN,false);
//Setting OBMOL coordinates
for (int i=0; i<na; i++) {
n=atomList[i];
atom=pmol->GetAtom(n+1); //1-based
atom->SetVector(sm.getAtom(n)->rx,sm.getAtom(n)->ry,0.0);
};
} else result=3; //unknown error
return result;
};
//****************************************************************************
//assept a lot of structures on input and remove duplicates and non-connected
//****************************************************************************
int canonizeMCDL(const std::string atomBlock, std::vector<std::string> & structureList) {
return 0;
};
//****************************************************************************
//*******************Tested routines, wiil be deleted*************************
+4
View File
@@ -998,6 +998,10 @@
RelativePath="..\..\include\openbabel\math\spacegroup.h"
>
</File>
<File
RelativePath="..\..\include\openbabel\text.h"
>
</File>
<File
RelativePath="..\..\include\openbabel\math\transform3d.h"
>
+15 -3
View File
@@ -51,8 +51,8 @@
Name="VCCLCompilerTool"
UseUnicodeResponseFiles="false"
Optimization="0"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;INCHI_LINK_AS_DLL;USING_OBDLL;HAVE_CONFIG_H;USING_DYNAMIC_LIBS;OBMore_EXPORTS"
AdditionalIncludeDirectories="../../include;../../src/formats/MCDL;."
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;INCHI_LINK_AS_DLL;USING_OBDLL;HAVE_CONFIG_H;USING_DYNAMIC_LIBS;OBMCDL_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -156,7 +156,7 @@
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="NDEBUG;USING_DYNAMIC_LIBS;WIN32;_WINDOWS;_USRDLL;INCHI_LINK_AS_DLL;HAVE_CONFIG_H;OBMore_EXPORTS"
PreprocessorDefinitions="NDEBUG;USING_DYNAMIC_LIBS;WIN32;_WINDOWS;_USRDLL;INCHI_LINK_AS_DLL;HAVE_CONFIG_H;OBMCDL_EXPORTS"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
@@ -225,10 +225,18 @@
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="..\..\src\ops\gen2D.cpp"
>
</File>
<File
RelativePath="..\..\src\formats\MCDLformat.cpp"
>
</File>
<File
RelativePath="..\..\src\mcdlutil.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
@@ -238,6 +246,10 @@
RelativePath="..\..\include\openbabel\babelconfig.h"
>
</File>
<File
RelativePath="..\..\include\openbabel\mcdlutil.h"
>
</File>
<File
RelativePath="..\..\include\openbabel\mol.h"
>
@@ -233,6 +233,18 @@
RelativePath="..\..\src\formats\molreport.cpp"
>
</File>
<File
RelativePath="..\..\src\formats\xml\NewSVGformat.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ShowIncludes="false"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\formats\pngformat.cpp"
>
@@ -254,6 +266,10 @@
RelativePath="..\..\src\formats\reportformat.cpp"
>
</File>
<File
RelativePath="..\..\src\formats\textformat.cpp"
>
</File>
<File
RelativePath="..\..\src\formats\titleformat.cpp"
>
+9 -1
View File
@@ -74,6 +74,7 @@
#define OBCOMMON __declspec(dllexport)
#define OBFPRT __declspec(dllexport)
#define EXTERN __declspec(dllexport) extern
#define OBMCDL __declspec(dllexport)
#elif defined(USING_DYNAMIC_LIBS)
//builds with multiple DLLs like OBDLL.dll, OBConv.dll , *.obf
#pragma warning (disable : 4251) //no dll interface for some templated classes
@@ -120,6 +121,13 @@
#else
#define OBERROR __declspec(dllimport)
#endif
#if defined(OBMCDL_EXPORTS)
//OBMCDL being built
#define OBMCDL __declspec(dllexport)
#else
#define OBMCDL __declspec(dllimport)
#endif
#else
//builds without DLLs
#define EXTERN extern
@@ -128,6 +136,6 @@
#define OBERROR
#define OBCOMMON
#define OBFPRT
#define OBMCDL
#endif
#endif //OB_BCONFIG_H