Skip to content

Commit d0a3886

Browse files
committed
Cluster move: larger clusters allowed but limited to translation, only.
Travis script cleanup
1 parent 577a1f3 commit d0a3886

File tree

6 files changed

+28
-35
lines changed

6 files changed

+28
-35
lines changed

.travis.yml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: cpp
2-
dist: xenial # trusty
2+
dist: xenial
33
sudo: required
44
group: edge
55
compiler: clang
@@ -14,11 +14,6 @@ matrix:
1414
# Linux / Clang
1515
- os: linux
1616
env: [COMPILER=clang++, CXX=clang++, CC=clang]
17-
#env: [COMPILER=clang++-5.0, CXX=clang++, CC=clang]
18-
#addons:
19-
# apt:
20-
# sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-5.0']
21-
# packages: ['g++-7', 'clang-5.0']
2217

2318
install:
2419
- |
@@ -39,17 +34,6 @@ install:
3934
4035
script:
4136
- |
42-
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
43-
#conda install cmake openmpi=1.6.3 python=3
44-
# CXX=clang++ CC=clang cmake . -DENABLE_MPI=on
45-
# make faunus
46-
# make tests
47-
# make test
48-
cd scripts/
49-
conda config --set anaconda_upload yes
50-
conda-build --user teokem --token "${CONDA_UPLOAD_TOKEN}" .
51-
else
52-
cd scripts/
53-
conda config --set anaconda_upload yes
54-
conda-build --user teokem --token "${CONDA_UPLOAD_TOKEN}" .
55-
fi
37+
cd scripts/
38+
conda config --set anaconda_upload yes
39+
conda-build --user teokem --token "${CONDA_UPLOAD_TOKEN}" .

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ install(FILES
386386
${CMAKE_SOURCE_DIR}/examples/README.md
387387
${CMAKE_SOURCE_DIR}/examples/bulk.yml
388388
${CMAKE_SOURCE_DIR}/examples/cluster.yml
389+
${CMAKE_SOURCE_DIR}/examples/cluster.agr
389390
${CMAKE_SOURCE_DIR}/examples/cluster.out.json
390391
${CMAKE_SOURCE_DIR}/examples/cluster.state.json
391392
${CMAKE_SOURCE_DIR}/examples/seawater.yml
@@ -402,6 +403,7 @@ install(FILES
402403
${CMAKE_SOURCE_DIR}/examples/membrane.state.json
403404
${CMAKE_SOURCE_DIR}/examples/lipid.xyz
404405
${CMAKE_SOURCE_DIR}/examples/penalty.yml
406+
${CMAKE_SOURCE_DIR}/examples/penalty.ipynb
405407
${CMAKE_SOURCE_DIR}/examples/pythontest.py
406408
${CMAKE_SOURCE_DIR}/examples/isochoric.yml
407409
${CMAKE_SOURCE_DIR}/examples/isochoric.xyz

examples/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ demonstrating features of Faunus. It is assumed that Faunus has
55
already been installed.
66

77
Example | Description
8-
--------------- | --------------------------------------------------------
8+
--------------- | ---------------------------------------------------------
9+
`bulk` | Melted NaCl using Ewald summation and isobaric moves
10+
`cluster` | Illustration of molecular cluster moves
911
`isochoric` | Bending modulus via penalty function and isochoric moves
1012
`membrane` | Coarse-grained lipid bilayer under zero tension
1113
`minimal` | A simple Lennard-Jones particle system
12-
`penalty` | Wang-Landau sampling along a 2D reaction coordinate
13-
`water` | SPC/E water using Ewald or other electrostatic methods
14+
`penalty` | 2D Wang-Landau - see also Jupyter Notebook
15+
`water` | SPC/E water in the NPT ensemble
1416

1517
Each example consists of a YAML input file and, potentially,
1618
other files such as previously generated states (`.state.json`) or

examples/water.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
temperature: 300
2-
random: {seed: default}
2+
random: {seed: fixed}
33
geometry: {length: 18.6}
44
mcloop: {macro: 10, micro: 100}
55

@@ -17,7 +17,7 @@ energy:
1717
- isobaric: {P/atm: 1}
1818
- nonbonded_coulomblj:
1919
lennardjones: {mixing: LB}
20-
coulomb: {type: fanourgakis, epsr: 1, cutoff: 9, alpha: 0.21, kcutoff: 7.3}
20+
coulomb: {type: fanourgakis, epsr: 1, cutoff: 9}
2121
cutoff_g2g: 10
2222

2323
moves:

scripts/meta.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ requirements:
1313
- librsvg
1414
- numpy
1515
- matplotlib
16-
#- cmake >=3.9
1716
- python {{ python }}
1817
- ruamel_yaml
1918
- nbconvert
2019
- notebook
2120
- jupyter
2221
- openmpi 1.6.3 # [osx]
2322
- openmpi 3.1.* # [linux64]
24-
#- clangdev >=5 # [linux64]
2523
#- pandoc >=1.19 # [linux64]
2624
run:
2725
- openmpi 1.6.3 # [osx]

src/move.h

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,7 @@ namespace Faunus {
759759
Average<double> msqd, msqd_angle, N;
760760
double thresholdsq=0, dptrans=0, dprot=0, angle=0, _bias=0;
761761
size_t bias_rejected=0;
762+
bool rotate; // true if cluster should be rotated
762763
Point dir={1,1,1}, dp;
763764
std::vector<std::string> names; // names of molecules to be considered
764765
std::vector<int> ids; // molecule id's of molecules to be considered
@@ -804,7 +805,7 @@ namespace Faunus {
804805
* @param first Index of initial molecule (randomly selected)
805806
* @param index w. all molecules clustered around first (first included)
806807
*/
807-
void findCluster(Tspace &spc, size_t first, std::set<size_t>& cluster) const {
808+
void findCluster(Tspace &spc, size_t first, std::set<size_t>& cluster) {
808809
assert(first < spc.p.size());
809810
std::set<size_t> pool(index.begin(), index.end());
810811
assert(pool.count(first)>0);
@@ -838,11 +839,13 @@ namespace Faunus {
838839
for (auto j : cluster)
839840
if (j>i)
840841
if (spc.geo.sqdist(spc.groups.at(i).cm, spc.groups.at(j).cm)>=max*max)
841-
throw std::runtime_error(name+": cluster larger than half box length");
842+
rotate=false; // skip rotation if cluster larger than half the box length
842843
}
843844

844845
void _move(Change &change) override {
845-
if (thresholdsq>0 && !index.empty()) {
846+
_bias=0;
847+
rotate=true;
848+
if (thresholdsq>0 and not index.empty()) {
846849
std::set<size_t> cluster; // all group index in cluster
847850
size_t first = *slump.sample(index.begin(), index.end()); // random molecule (nuclei)
848851
findCluster(spc, first, cluster); // find cluster around first
@@ -852,6 +855,8 @@ namespace Faunus {
852855
d.all=true;
853856
dp = 0.5*ranunit(slump).cwiseProduct(dir) * dptrans;
854857
angle = dprot * (slump()-0.5);
858+
if (not rotate)
859+
angle=0;
855860

856861
Point COM = Geometry::trigoCom(spc, cluster); // cluster center
857862
Eigen::Quaterniond Q;
@@ -860,11 +865,13 @@ namespace Faunus {
860865
for (auto i : cluster) { // loop over molecules in cluster
861866
auto &g = spc.groups[i];
862867

863-
Geometry::rotate(g.begin(), g.end(), Q, spc.geo.boundaryFunc, -COM);
864-
g.cm = g.cm-COM;
865-
spc.geo.boundary(g.cm);
866-
g.cm = Q*g.cm+COM;
867-
spc.geo.boundary(g.cm);
868+
if (rotate) {
869+
Geometry::rotate(g.begin(), g.end(), Q, spc.geo.boundaryFunc, -COM);
870+
g.cm = g.cm-COM;
871+
spc.geo.boundary(g.cm);
872+
g.cm = Q*g.cm+COM;
873+
spc.geo.boundary(g.cm);
874+
}
868875

869876
g.translate( dp, spc.geo.boundaryFunc );
870877
d.index=i;

0 commit comments

Comments
 (0)