Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tempering update #441

Merged
merged 21 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
"utility": "cpp",
"stop_token": "cpp",
"tensorsymmetry": "cpp",
"core": "cpp"
}
"core": "cpp",
"shared_mutex": "cpp",
"cfenv": "cpp"
},
"C_Cpp.errorSquiggles": "disabled"
}
4 changes: 2 additions & 2 deletions docs/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -849,8 +849,8 @@ properties:
default: isotropic
format:
type: string
enum: [XYZQI, XYZQ, XYZ]
default: XYZQI
enum: [xyzqi, xyzq, xyz]
default: xyzqi
description: "Which particle properties to exchange (I=atom id, Q=charge)"
IVinterbladh marked this conversation as resolved.
Show resolved Hide resolved

additionalProperties: false
Expand Down
8 changes: 8 additions & 0 deletions src/move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,11 @@ void ParallelTempering::_to_json(json& j) const {
auto id = fmt::format("{} <-> {}", pair.first, pair.second);
exchange_json[id] = {{"attempts", acceptance.size()}, {"acceptance", acceptance.avg()}};
}
auto& exchange_json2 = j["exchangesmpi"] = json::object();
for (const auto& [mpI, exchange] : exchange_map) {
IVinterbladh marked this conversation as resolved.
Show resolved Hide resolved
auto id = fmt::format("{}", mpI);
exchange_json2[id] = {{"exchanges", exchange }};
}
}

/**
Expand Down Expand Up @@ -762,9 +767,12 @@ double ParallelTempering::bias([[maybe_unused]] Change& change, double uold, dou

void ParallelTempering::_accept([[maybe_unused]] Change& change) {
acceptance_map[partner->getPair(mpi.world)] += 1.0;
exchange_map[mpi.world.rank()].push_back(partner->getPair(mpi.world));

}
void ParallelTempering::_reject([[maybe_unused]] Change& change) {
acceptance_map[partner->getPair(mpi.world)] += 0.0;
exchange_map[mpi.world.rank()].push_back(std::minmax({-1, -1}));
IVinterbladh marked this conversation as resolved.
Show resolved Hide resolved
}

void ParallelTempering::_from_json(const json& j) {
Expand Down
1 change: 1 addition & 0 deletions src/move.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ class ParallelTempering : public Move {
std::unique_ptr<MPI::Partner> partner; //!< Policy for finding MPI partners
Geometry::VolumeMethod volume_scaling_method = Geometry::VolumeMethod::ISOTROPIC; //!< How to scale volumes
std::map<MPI::Partner::PartnerPair, Average<double>> acceptance_map; //!< Exchange statistics
std::map<int, std::vector<MPI::Partner::PartnerPair>> exchange_map; //!< Exchange statistics
IVinterbladh marked this conversation as resolved.
Show resolved Hide resolved
Random slump; // static instance of Random (shared for all in ParallelTempering)
void _to_json(json& j) const override;
void _from_json(const json& j) override;
Expand Down
Loading