• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版be782b1a140325741bf03b960ea0fc07c3ca00de (tree)
时间2011-11-25 00:50:07
作者Mikiya Fujii <mikiya.fujii@gmai...>
CommiterMikiya Fujii

Log Message

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

更改概述

差异

--- a/src/mndo/Mndo.cpp
+++ b/src/mndo/Mndo.cpp
@@ -1858,18 +1858,20 @@ void Mndo::CalcForce(vector<int> elecStates){
18581858 b,
18591859 twoElecTwoCoreFirstDeriv);
18601860 // 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+ }
18701873 }
18711874 }
1872-
18731875 // excited state potential
18741876 for(int n=0; n<elecStates.size(); n++){
18751877 if(0<elecStates[n]){
@@ -1910,13 +1912,16 @@ void Mndo::CalcForce(vector<int> elecStates){
19101912 b,
19111913 twoElecTwoCoreFirstDeriv);
19121914 // 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+ }
19201925 }
19211926
19221927 }