Revisão | be782b1a140325741bf03b960ea0fc07c3ca00de (tree) |
---|---|
Hora | 2011-11-25 00:50:07 |
Autor | Mikiya Fujii <mikiya.fujii@gmai...> |
Commiter | Mikiya Fujii |
Bugfix: Mndo::CalcForce becomes threadsafe. #26396 #26626 #26630
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/MolDS/trunk@316 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -1858,18 +1858,20 @@ void Mndo::CalcForce(vector<int> elecStates){ | ||
1858 | 1858 | b, |
1859 | 1859 | twoElecTwoCoreFirstDeriv); |
1860 | 1860 | // sum up contributions from each part (ground state) |
1861 | - for(int n=0; n<elecStates.size(); n++){ | |
1862 | - for(int i=0; i<CartesianType_end; i++){ | |
1863 | - this->matrixForce[n][a][i] -= coreRepulsion[i]; | |
1864 | - this->matrixForce[n][a][i] += forceElecCoreAttPart[i]; | |
1865 | - this->matrixForce[n][a][i] += forceOverlapPart[i]; | |
1866 | - this->matrixForce[n][a][i] += forceTwoElecPart[i]; | |
1867 | - this->matrixForce[n][b][i] -= forceElecCoreAttPart[i]; | |
1868 | - this->matrixForce[n][b][i] -= forceOverlapPart[i]; | |
1869 | - this->matrixForce[n][b][i] -= forceTwoElecPart[i]; | |
1861 | + #pragma omp critical | |
1862 | + { | |
1863 | + for(int n=0; n<elecStates.size(); n++){ | |
1864 | + for(int i=0; i<CartesianType_end; i++){ | |
1865 | + this->matrixForce[n][a][i] -= coreRepulsion[i]; | |
1866 | + this->matrixForce[n][a][i] += forceElecCoreAttPart[i]; | |
1867 | + this->matrixForce[n][a][i] += forceOverlapPart[i]; | |
1868 | + this->matrixForce[n][a][i] += forceTwoElecPart[i]; | |
1869 | + this->matrixForce[n][b][i] -= forceElecCoreAttPart[i]; | |
1870 | + this->matrixForce[n][b][i] -= forceOverlapPart[i]; | |
1871 | + this->matrixForce[n][b][i] -= forceTwoElecPart[i]; | |
1872 | + } | |
1870 | 1873 | } |
1871 | 1874 | } |
1872 | - | |
1873 | 1875 | // excited state potential |
1874 | 1876 | for(int n=0; n<elecStates.size(); n++){ |
1875 | 1877 | if(0<elecStates[n]){ |
@@ -1910,13 +1912,16 @@ void Mndo::CalcForce(vector<int> elecStates){ | ||
1910 | 1912 | b, |
1911 | 1913 | twoElecTwoCoreFirstDeriv); |
1912 | 1914 | // sum up contributions from response part (excited state) |
1913 | - for(int i=0; i<CartesianType_end; i++){ | |
1914 | - this->matrixForce[n][a][i] += forceExcitedElecCoreAttPart[i]; | |
1915 | - this->matrixForce[n][a][i] += forceExcitedOverlapPart[i]; | |
1916 | - this->matrixForce[n][a][i] += forceExcitedTwoElecPart[i]; | |
1917 | - this->matrixForce[n][b][i] -= forceExcitedElecCoreAttPart[i]; | |
1918 | - this->matrixForce[n][b][i] -= forceExcitedOverlapPart[i]; | |
1919 | - this->matrixForce[n][b][i] -= forceExcitedTwoElecPart[i]; | |
1915 | + #pragma omp critical | |
1916 | + { | |
1917 | + for(int i=0; i<CartesianType_end; i++){ | |
1918 | + this->matrixForce[n][a][i] += forceExcitedElecCoreAttPart[i]; | |
1919 | + this->matrixForce[n][a][i] += forceExcitedOverlapPart[i]; | |
1920 | + this->matrixForce[n][a][i] += forceExcitedTwoElecPart[i]; | |
1921 | + this->matrixForce[n][b][i] -= forceExcitedElecCoreAttPart[i]; | |
1922 | + this->matrixForce[n][b][i] -= forceExcitedOverlapPart[i]; | |
1923 | + this->matrixForce[n][b][i] -= forceExcitedTwoElecPart[i]; | |
1924 | + } | |
1920 | 1925 | } |
1921 | 1926 | |
1922 | 1927 | } |