Skip to content

Commit

Permalink
Merge pull request #55 from GOMC-WSU/development
Browse files Browse the repository at this point in the history
Version 2.1
  • Loading branch information
Younes Nejahi authored Sep 4, 2017
2 parents 6e2a24b + 18fcb32 commit cba14c1
Show file tree
Hide file tree
Showing 150 changed files with 1,556 additions and 1,279 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

#Versioning
set (GOMC_VERSION_MAJOR 2)
set (GOMC_VERSION_MINOR 00)
set (GOMC_VERSION_MINOR 10)

IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release CACHE STRING
Expand All @@ -35,9 +35,14 @@ configure_file(
)
include_directories("${PROJECT_BINARY_DIR}")

if(CMAKE_COMPILER_IS_CNUCXX)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -stdlib=libstdc++")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -stdlib=libstdc++")
endif()

if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
elseif(MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
set(CMAKE_CXX_FLAGS_DEBUG_INIT "${CMAKE_CXX_FLAGS_DEBUG_INIT} /D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
Expand Down
9 changes: 9 additions & 0 deletions Change log
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Change Log
All notable changes to this project will be documented in this file.

## [2.1] - 9/4/2017
+ Adsorption
+ Fixed the bug where GPU and CPU total energy calculations where slighty different.
+ Removed some unused variables
+ Removed some warnings
+ Fixed pow function ambiguity in some compilers like clang
+ Fixed compiling bug for Clock.h when using clang (mac users)
+ Set a maximum of 9999999999 for output energies

## [2.0] - 6/11/2017
+ NPT added
+ GPU implementation has been added to the project
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Current Release: 2.0 (6/11/2017)
Current Release: 2.1 (9/4/2017)

[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/GOMC_WSU/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link)

Expand Down
2 changes: 1 addition & 1 deletion lib/BasicTypes.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down
2 changes: 1 addition & 1 deletion lib/BitLib.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down
2 changes: 1 addition & 1 deletion lib/GeomLib.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down
2 changes: 1 addition & 1 deletion lib/NumLib.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down
2 changes: 1 addition & 1 deletion lib/StrLib.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down
2 changes: 1 addition & 1 deletion lib/StrStrmLib.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down
2 changes: 1 addition & 1 deletion lib/VectorLib.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down
1 change: 1 addition & 0 deletions metamake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
mkdir -p bin
cd bin
cmake ..
make
57 changes: 46 additions & 11 deletions src/BlockOutput.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down Expand Up @@ -54,15 +54,24 @@ void BlockAverage::Sum(void)
block[b] += *dblSrc[b] * scl;
}

void BlockAverage::DoWrite(const ulong step)
void BlockAverage::DoWrite(const ulong step, uint precision)
{
if (tot >= 1)
{
if (outBlock0->is_open())
{
(*outBlock0) << left << std::fixed << std::setprecision(4) <<
std::setw(OUTPUTWIDTH);
(*outBlock0) << block[0];
if(abs(block[0]) > 9999999999.9999)
{
(*outBlock0) << left << std::fixed << std::setprecision(0) <<
std::setw(OUTPUTWIDTH);
(*outBlock0) << 9999999999;
}
else
{
(*outBlock0) << left << std::fixed << std::setprecision(precision) <<
std::setw(OUTPUTWIDTH);
(*outBlock0) << block[0];
}
}
else
std::cerr << "Unable to write to Box_0 output file" << std::endl;
Expand All @@ -71,9 +80,18 @@ void BlockAverage::DoWrite(const ulong step)
{
if (outBlock1->is_open())
{
(*outBlock1) << left << std::fixed << std::setprecision(4) <<
std::setw(OUTPUTWIDTH);
(*outBlock1) << block[1];
if(abs(block[0]) > 9999999999.9999)
{
(*outBlock1) << left << std::fixed << std::setprecision(0) <<
std::setw(OUTPUTWIDTH);
(*outBlock1) << 9999999999;
}
else
{
(*outBlock1) << left << std::fixed << std::setprecision(precision) <<
std::setw(OUTPUTWIDTH);
(*outBlock1) << block[1];
}
}
else
std::cerr << "Unable to write to Box_1 output file" << std::endl;
Expand Down Expand Up @@ -124,17 +142,22 @@ void BlockAverages::DoOutput(const ulong step)
outBlock0 << left << std::fixed << std::setw(OUTPUTWIDTH) << nextStep;
outBlock1 << left << std::fixed << std::setw(OUTPUTWIDTH) << nextStep;
for (uint v = 0; v < totalBlocks; ++v)
blocks[v].Write(nextStep, firstPrint);
{
if(v < out::TOTAL_SINGLE)
blocks[v].Write(nextStep, firstPrint);
else
blocks[v].Write(nextStep, firstPrint, 8);
}
outBlock0 << std::endl;
if(outBlock1.is_open())
outBlock1 << std::endl;
}

void BlockAverages::InitWatchSingle(config_setup::TrackedVars const& tracked)
{
outBlock0 << left << std::fixed << std::setw(OUTPUTWIDTH) << "STEPS";
outBlock0 << left << std::fixed << std::setw(OUTPUTWIDTH) << "#STEPS";
if(outBlock1.is_open())
outBlock1 << left << std::fixed << std::setw(OUTPUTWIDTH) << "STEPS";
outBlock1 << left << std::fixed << std::setw(OUTPUTWIDTH) << "#STEPS";
//Note: The order of Init should be same as order of SetRef
blocks[out::ENERGY_TOTAL_IDX].Init(&outBlock0, &outBlock1, tracked.energy.block, invSteps, out::ENERGY_TOTAL, BOXES_WITH_U_NB);
blocks[out::ENERGY_INTER_IDX].Init(&outBlock0, &outBlock1, tracked.energy.block, invSteps, out::ENERGY_INTER, BOXES_WITH_U_NB);
Expand Down Expand Up @@ -217,13 +240,25 @@ void BlockAverages::InitWatchMulti(config_setup::TrackedVars const& tracked)
void BlockAverage::printTitle(std::string output, uint boxes)
{
if(tot>=1)
{
if((*outBlock0).is_open())
{
(*outBlock0) << left << std::fixed << std::setw(OUTPUTWIDTH) << output;
}
else
{
std::cerr << "Unable to write to Block_0 output file!" << std::endl;
}
}
if(tot>=2)
{
if((*outBlock1).is_open())
{
(*outBlock1) << left << std::fixed << std::setw(OUTPUTWIDTH) << output;
}
else
{
std::cerr << "Unable to write to Block_1 output file!" << std::endl;
}
}
}
16 changes: 11 additions & 5 deletions src/BlockOutput.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down Expand Up @@ -63,11 +63,11 @@ struct BlockAverage
dblSrc[b] = NULL;
}
void Sum(void);
void Write(const ulong step, const bool firstPrint)
void Write(const ulong step, const bool firstPrint, uint precision = 4)
{
first = firstPrint;
if (enable)
DoWrite(step);
DoWrite(step, precision);
}

private:
Expand All @@ -77,7 +77,7 @@ struct BlockAverage
block[b] = 0.0;
samples = 0;
}
void DoWrite(const ulong step);
void DoWrite(const ulong step, uint precision);
void printTitle(std::string output, uint boxes);

std::ofstream* outBlock0;
Expand All @@ -93,9 +93,12 @@ struct BlockAverage
/**********************************************************************/
struct BlockAverages : OutputableBase
{
BlockAverages(): blocks(NULL) {}

BlockAverages(OutputVars & v)
{
this->var = &v;
blocks = NULL;
}

~BlockAverages(void)
Expand All @@ -108,7 +111,10 @@ struct BlockAverages : OutputableBase
{
outBlock1.close();
}
if ( blocks != NULL ) delete[] blocks;
if ( blocks != NULL )
{
delete[] blocks;
}
}
//No additional init.
virtual void Init(pdb_setup::Atoms const& atoms,
Expand Down
2 changes: 1 addition & 1 deletion src/BoxDimensions.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down
2 changes: 1 addition & 1 deletion src/BoxDimensions.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down
2 changes: 1 addition & 1 deletion src/CBMC.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down
2 changes: 1 addition & 1 deletion src/CBMC.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down
2 changes: 1 addition & 1 deletion src/COM.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down
2 changes: 1 addition & 1 deletion src/CPUSide.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down
2 changes: 1 addition & 1 deletion src/CPUSide.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
GPU OPTIMIZED MONTE CARLO (GOMC) 2.0
GPU OPTIMIZED MONTE CARLO (GOMC) 2.1
Copyright (C) 2016 GOMC Group
A copy of the GNU General Public License can be found in the COPYRIGHT.txt
along with this program, also can be found at <http://www.gnu.org/licenses/>.
Expand Down
Loading

0 comments on commit cba14c1

Please sign in to comment.