Skip to content

Commit

Permalink
Merge pull request #119 from Bondoki/master
Browse files Browse the repository at this point in the history
Patch LeMonADE Version 2.2.0
  • Loading branch information
MartinWenge authored Oct 5, 2020
2 parents d16ef40 + 3cf531d commit e5812ca
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 32 deletions.
31 changes: 18 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# o\.|./o e xtensible | LeMonADE: An Open Source Implementation of the
# o\.\|/./o Mon te-Carlo | Bond-Fluctuation-Model for Polymers
# oo---0---oo A lgorithm and |
# o/./|\.\o D evelopment | Copyright (C) 2013-2015 by
# o/./|\.\o D evelopment | Copyright (C) 2013-2020 by
# o/.|.\o E nvironment | LeMonADE Principal Developers (see AUTHORS)
# ooo |
# ---------------------------------------------------------------------------------
Expand Down Expand Up @@ -31,25 +31,22 @@ CMAKE_MINIMUM_REQUIRED (VERSION 2.6.2)
PROJECT (LeMonADE)
SET (APPLICATION_NAME "LeMonADE")
SET (APPLICATION_CODENAME "${PROJECT_NAME}")
SET (APPLICATION_COPYRIGHT_YEARS "2019")
SET (APPLICATION_VERSION_MAJOR 2)
SET (APPLICATION_VERSION_MINOR 1)
SET (APPLICATION_VERSION_PATCH 0)
SET (APPLICATION_VERSION_TYPE SNAPSHOT)
SET (APPLICATION_VERSION_STRING "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}-${APPLICATION_VERSION_TYPE}")
SET (APPLICATION_ID "${APPLICATION_VENDOR_ID}.${PROJECT_NAME}")
SET (APPLICATION_COPYRIGHT_YEARS "2013-2020")
SET (APPLICATION_VERSION_MAJOR "2")
SET (APPLICATION_VERSION_MINOR "2")
SET (APPLICATION_VERSION_PATCH "0")


#
# Compile options
#

#define possible flags
SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -msse2 -mssse3 -std=c++11 -fexpensive-optimizations ")
SET (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -msse2 -mssse3 -std=c++11 -fexpensive-optimizations ")
SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -msse2 -mssse3 -std=c++11 -fexpensive-optimizations -Wno-error=narrowing")
SET (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -msse2 -mssse3 -std=c++11 -fexpensive-optimizations -Wno-error=narrowing")

SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -std=c++11 -Wall -Wextra -DDEBUG ")
SET (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -std=c++11 -Wall -Wextra -DDEBUG ")
SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -std=c++11 -Wall -Wextra -DDEBUG -Wno-error=narrowing")
SET (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -std=c++11 -Wall -Wextra -DDEBUG -Wno-error=narrowing")

#define value of CMAKE_BUILD_TYPE depending on input
IF(NOT CMAKE_BUILD_TYPE)
Expand Down Expand Up @@ -84,14 +81,22 @@ SET (LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
SET (LEMONADE_INCLUDE_DIR "${LEMONADE_DIR}/include")
SET (LEMONADE_LIBRARY_DIR ${LIBRARY_OUTPUT_PATH})

#
# Configure and replace Version.h with updated cmake info
#
SET (APPLICATION_VERSION_TYPE "${CMAKE_BUILD_TYPE}")
SET (APPLICATION_VERSION_STRING "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}-(C)${APPLICATION_COPYRIGHT_YEARS}-${APPLICATION_VERSION_TYPE}")
SET (APPLICATION_ID "${APPLICATION_NAME}.${PROJECT_NAME}")
configure_file( ${LEMONADE_DIR}/include/LeMonADE/Version.h.in ${LEMONADE_DIR}/include/LeMonADE/Version.h @ONLY)


#
# Project Search Paths
#
LIST (APPEND CMAKE_PREFIX_PATH "${LEMONADE_DIR}")
INCLUDE_DIRECTORIES("${LEMONADE_DIR}/include")



#
# add Build Targets
#
Expand Down
39 changes: 37 additions & 2 deletions include/LeMonADE/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
o\.|./o e xtensible | LeMonADE: An Open Source Implementation of the
o\.\|/./o Mon te-Carlo | Bond-Fluctuation-Model for Polymers
oo---0---oo A lgorithm and |
o/./|\.\o D evelopment | Copyright (C) 2013-2015 by
o/./|\.\o D evelopment | Copyright (C) 2013-2020 by
o/.|.\o E nvironment | LeMonADE Principal Developers (see AUTHORS)
ooo |
----------------------------------------------------------------------------------
Expand All @@ -25,9 +25,44 @@ along with LeMonADE. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------------*/

/*
* AUTO-GENERATION WARNING:
* "Version.h" has been automatically generated from "Version.h.in".
* DO NOT edit "Version.h", as any changes will be automatically discarded.
*/


#ifndef LEMONADE_VERSION_H
#define LEMONADE_VERSION_H

const double LEMONADE_VERSION = 2.0;
#define APPLICATION_NAME "LeMonADE"
#define APPLICATION_CODENAME "LeMonADE"
#define APPLICATION_COPYRIGHT_YEARS "2013-2020"
#define APPLICATION_VERSION_MAJOR 2
#define APPLICATION_VERSION_MINOR 2
#define APPLICATION_VERSION_PATCH 0
#define APPLICATION_VERSION_TYPE "Release"
#define APPLICATION_VERSION_STRING "2.2.0-(C)2013-2020-Release"
#define APPLICATION_ID "LeMonADE.LeMonADE"

#ifndef APPLICATION_VERSION_MAJOR
# define APPLICATION_VERSION_MAJOR 0
#endif

#ifndef APPLICATION_VERSION_MINOR
# define APPLICATION_VERSION_MINOR 0
#endif

#ifndef APPLICATION_VERSION_PATCH
# define APPLICATION_VERSION_PATCH 0
#endif

#ifndef APPLICATION_VERSION_TYPE
# define APPLICATION_VERSION_TYPE "RELEASE"
#endif

#define APPLICATION_VERSION_MAJOR_MINOR 2.2

const double LEMONADE_VERSION = APPLICATION_VERSION_MAJOR_MINOR;

#endif
68 changes: 68 additions & 0 deletions include/LeMonADE/Version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*--------------------------------------------------------------------------------
ooo L attice-based |
o\.|./o e xtensible | LeMonADE: An Open Source Implementation of the
o\.\|/./o Mon te-Carlo | Bond-Fluctuation-Model for Polymers
oo---0---oo A lgorithm and |
o/./|\.\o D evelopment | Copyright (C) 2013-2020 by
o/.|.\o E nvironment | LeMonADE Principal Developers (see AUTHORS)
ooo |
----------------------------------------------------------------------------------

This file is part of LeMonADE.

LeMonADE is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

LeMonADE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with LeMonADE. If not, see <http://www.gnu.org/licenses/>.

--------------------------------------------------------------------------------*/

/*
* AUTO-GENERATION WARNING:
* "Version.h" has been automatically generated from "Version.h.in".
* DO NOT edit "Version.h", as any changes will be automatically discarded.
*/


#ifndef LEMONADE_VERSION_H
#define LEMONADE_VERSION_H

#cmakedefine APPLICATION_NAME "@APPLICATION_NAME@"
#cmakedefine APPLICATION_CODENAME "@APPLICATION_CODENAME@"
#cmakedefine APPLICATION_COPYRIGHT_YEARS "@APPLICATION_COPYRIGHT_YEARS@"
#define APPLICATION_VERSION_MAJOR @APPLICATION_VERSION_MAJOR@
#define APPLICATION_VERSION_MINOR @APPLICATION_VERSION_MINOR@
#define APPLICATION_VERSION_PATCH @APPLICATION_VERSION_PATCH@
#cmakedefine APPLICATION_VERSION_TYPE "@APPLICATION_VERSION_TYPE@"
#cmakedefine APPLICATION_VERSION_STRING "@APPLICATION_VERSION_STRING@"
#cmakedefine APPLICATION_ID "@APPLICATION_ID@"

#ifndef APPLICATION_VERSION_MAJOR
# define APPLICATION_VERSION_MAJOR 0
#endif

#ifndef APPLICATION_VERSION_MINOR
# define APPLICATION_VERSION_MINOR 0
#endif

#ifndef APPLICATION_VERSION_PATCH
# define APPLICATION_VERSION_PATCH 0
#endif

#ifndef APPLICATION_VERSION_TYPE
# define APPLICATION_VERSION_TYPE "RELEASE"
#endif

#define APPLICATION_VERSION_MAJOR_MINOR @APPLICATION_VERSION_MAJOR@.@APPLICATION_VERSION_MINOR@

const double LEMONADE_VERSION = APPLICATION_VERSION_MAJOR_MINOR;

#endif
4 changes: 2 additions & 2 deletions include/LeMonADE/feature/FeatureWall.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Wall
}

//! setter function for the base vector of the wall
VectorInt3 setBase(uint32_t baseX_, uint32_t baseY_, uint32_t baseZ_) {
void setBase(uint32_t baseX_, uint32_t baseY_, uint32_t baseZ_) {
base.setAllCoordinates(baseX_,baseY_,baseZ_);
}

Expand All @@ -78,7 +78,7 @@ class Wall
}

//! setter function for the normal vector of the wall
VectorInt3 setNormal(uint32_t norX_, uint32_t norY_, uint32_t norZ_) {
void setNormal(uint32_t norX_, uint32_t norY_, uint32_t norZ_) {
VectorInt3 test(norX_, norY_, norZ_);
if(test==VectorInt3(1,0,0) || test==VectorInt3(0,1,0) || test==VectorInt3(0,0,1) ){
normal.setAllCoordinates(norX_,norY_,norZ_);
Expand Down
8 changes: 4 additions & 4 deletions include/LeMonADE/utility/AttributeTags.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class MonomerLabel
/**
* @brief assignment operator
*/
MonomerLabel& operator= ( const MonomerLabel &Label )
void operator= ( const MonomerLabel &Label )
{
chainID = Label.chainID;
nLabels = Label.nLabels;
Expand Down Expand Up @@ -132,17 +132,17 @@ class MonomerLabel
//! set the chain ID the Label belongs to
void setchainID(const uint32_t chainID_){chainID=chainID_ ;}
//! get the chain ID the Label belongs to
const uint32_t& getchainID( ) const { return chainID ;}
const uint32_t getchainID( ) const { return chainID ;}

//! set the number of labels sitting on the monomer
void setnLabels(const uint32_t nLabels_){nLabels=nLabels_ ;}
//! get the number of labels sitting on the monomer
const uint32_t& getnLabels( ) const { return nLabels ;}
const uint32_t getnLabels( ) const { return nLabels ;}

//! set the ID of the label(s) on the monomer
void setlabelID(const uint32_t labelID_){labelID=labelID_ ;}
//! get the ID of the label(s) on the monomer
const uint32_t& getlabelID( ) const { return labelID ;}
const uint32_t getlabelID( ) const { return labelID ;}

//! set the chain ID, number of labels and label id
void setAll(const uint32_t chainID_,const uint32_t nLabels_,const uint32_t labelID_)
Expand Down
17 changes: 17 additions & 0 deletions projects/SimpleSimulator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <LeMonADE/utility/TaskManager.h>
#include <LeMonADE/updater/UpdaterReadBfmFile.h>
#include <LeMonADE/updater/UpdaterSimpleSimulator.h>
#include <LeMonADE/Version.h>

int main(int argc, char* argv[])
{
Expand Down Expand Up @@ -46,6 +47,22 @@ int main(int argc, char* argv[])
if(argc==5) outfile=argv[4];
else outfile=argv[1];
}

std::cout << APPLICATION_NAME " is free software: you can redistribute it and/or modify" << std::endl
<< "it under the terms of the GNU General Public License as published by" << std::endl
<< "the Free Software Foundation, either version 3 of the License, or" << std::endl
<< "(at your option) any later version." << std::endl
<< APPLICATION_NAME " is distributed in the hope that it will be useful," << std::endl
<< "but WITHOUT ANY WARRANTY; without even the implied warranty of" << std::endl
<< "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" << std::endl
<< "GNU General Public License for more details." << std::endl
<< "You should have received a copy of the GNU General Public License" << std::endl
<< "along with " << APPLICATION_NAME << ". If not, see <http://www.gnu.org/licenses/>." << std::endl << std::endl;

std::cout << APPLICATION_NAME << " " << APPLICATION_VERSION_STRING << std::endl
<< "Copyright (C) " << APPLICATION_COPYRIGHT_YEARS << std::endl
<< "LeMonADE Version " << LEMONADE_VERSION << std::endl << std::endl;


//seed the globally available random number generators
RandomNumberGenerators rng;
Expand Down
29 changes: 24 additions & 5 deletions tests/core/TestIngredients.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,26 @@ along with LeMonADE. If not, see <http://www.gnu.org/licenses/>.

using namespace std;

TEST(IngredientsTest, Constructors){
class IngredientsTest: public ::testing::Test{

public:
//redirect cout output
virtual void SetUp(){
originalBuffer=cout.rdbuf();
cout.rdbuf(tempStream.rdbuf());
};

//restore original output
virtual void TearDown(){
cout.rdbuf(originalBuffer);
};

private:
std::streambuf* originalBuffer;
std::ostringstream tempStream;
};

TEST_F(IngredientsTest, Constructors){

typedef LOKI_TYPELIST_2(FeatureBox, FeatureBondset<>) Features;
typedef ConfigureSystem<VectorInt3,Features,3> Config;
Expand All @@ -61,7 +80,7 @@ TEST(IngredientsTest, Constructors){
EXPECT_STREQ("new_lemonade" ,ingredientsWithOutName.getName().c_str());
}

TEST(IngredientsTest, GetterAndSetter){
TEST_F(IngredientsTest, GetterAndSetter){

typedef LOKI_TYPELIST_2(FeatureBox, FeatureBondset<>) Features;
typedef ConfigureSystem<VectorInt3,Features,3> Config;
Expand All @@ -82,7 +101,7 @@ TEST(IngredientsTest, GetterAndSetter){

}

TEST(IngredientsTest, printMetaData){
TEST_F(IngredientsTest, printMetaData){
typedef LOKI_TYPELIST_2(FeatureBox, FeatureBondset<>) Features;
typedef ConfigureSystem<VectorInt3,Features,3> Config;
typedef Ingredients < Config> MyIngredients;
Expand All @@ -100,7 +119,7 @@ TEST(IngredientsTest, printMetaData){
}


TEST(IngredientsTest, synchronize_noargument){
TEST_F(IngredientsTest, synchronize_noargument){
typedef LOKI_TYPELIST_2(FeatureBox, FeatureBondset<>) Features1;
typedef ConfigureSystem<VectorInt3,Features1,3> Config1;
typedef Ingredients < Config1> MyIngredients1;
Expand Down Expand Up @@ -185,7 +204,7 @@ TEST(IngredientsTest, synchronize_noargument){
EXPECT_NO_THROW(ingredients2.synchronize());
}

TEST(IngredientsTest, synchronize_withargument){
TEST_F(IngredientsTest, synchronize_withargument){
typedef LOKI_TYPELIST_2(FeatureBox, FeatureBondset<>) Features1;
typedef ConfigureSystem<VectorInt3,Features1,3> Config1;
typedef Ingredients < Config1> MyIngredients1;
Expand Down
14 changes: 8 additions & 6 deletions tests/feature/TestFeatureAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ class FeatureAttributesTest: public ::testing::Test{
cout.rdbuf(originalBuffer);
};

private:
std::streambuf* originalBuffer;
std::ostringstream tempStream;
private:
std::streambuf* originalBuffer;
std::ostringstream tempStream;
};

TEST_F(FeatureAttributesTest,MonomerAttributeTag)
Expand Down Expand Up @@ -248,16 +248,19 @@ TEST_F(FeatureAttributesTest,MonomerLabel)
typedef MyIngredientsTags::molecules_type MyMolecules1;
MyMolecules1 molecules9;

//check if attributes are copied corriectly by copy constructor
//check if attributes are copied correctly by copy constructor
molecules9.resize(3);

//if it runs throught then there is no error in the assign constructor
molecules9[0].setAttributeTag(MonomerLabel(1,23,45));

EXPECT_EQ( molecules9[0].getAttributeTag().getchainID(), 1);
EXPECT_EQ( molecules9[0].getAttributeTag().getnLabels(),23);
EXPECT_EQ( molecules9[0].getAttributeTag().getlabelID(),45);

molecules9[1].setAttributeTag(MonomerLabel(3,2,4));

//negative falues do not make much sense
//negative values do not make much sense
EXPECT_THROW(molecules9[2].setAttributeTag(MonomerLabel(12,5,-1)), std::runtime_error);
EXPECT_THROW(molecules9[2].setAttributeTag(MonomerLabel(12,-5,1)), std::runtime_error);
EXPECT_THROW(molecules9[2].setAttributeTag(MonomerLabel(-12,5,1)), std::runtime_error);
Expand Down Expand Up @@ -307,7 +310,6 @@ TEST_F(FeatureAttributesTest,ReadAttributesClassForMonomerLabels)
stream5<<"\n1-5:c\n";
EXPECT_THROW(read.execute(),std::runtime_error);


}


Expand Down
1 change: 1 addition & 0 deletions tests/feature/TestFeatureWall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ TEST(TestFeatureWall,Moves)

//build wall in y-z-plane at x=2 -> x=1 should be forbidden
Wall wall1;

wall1.setBase(2,0,0);
// check forbidden nomal vector: must be a unit vector! P(1,0,0)
EXPECT_ANY_THROW(wall1.setNormal(2,0,0));
Expand Down

0 comments on commit e5812ca

Please sign in to comment.