Skip to content

Commit

Permalink
Further elimination of InputMap
Browse files Browse the repository at this point in the history
  • Loading branch information
mlund committed Jan 27, 2017
1 parent a586a18 commit f69faca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 2 additions & 4 deletions include/faunus/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ namespace Faunus
{
js << f;
}
catch (...)
catch(std::exception& e)
{
std::cerr << "Error loading json file '" << file
<< "'. Carefully check the syntax." << endl;
std::exit(1);
throw std::runtime_error("Error loading json file " + file + ": " + e.what());
}
}
return js;
Expand Down
8 changes: 4 additions & 4 deletions src/examples/minimal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ typedef Potential::LennardJonesLB Tpair; // and pair potential

int main()
{
InputMap in("minimal.json"); // open parameter file for user input
Tmjson in = openjson("minimal.json"); // open parameter file for user input
Tspace spc(in); // Simulation space, particles etc.
Energy::Nonbonded<Tspace, Tpair> pot(in);// Hamiltonian, non-bonded only
Move::Propagator<Tspace> mv(in, pot, spc);// Monte Carlo move class
Expand All @@ -19,6 +19,7 @@ int main()
This is a minimal example of how to set up a Metropolis Monte Carlo simulation
with the following characteristics:
- Lennard-Jones particles
- Periodic boundaries, minimum image convention
- Canonical ensemble (NVT)
Expand Down Expand Up @@ -61,9 +62,8 @@ int main()
well as geometry information
- **line 7**
- Load the user input parameters into a `Faunus::InputMap` object.
This simply uses the JSON format
to get user input and is heavily used in constructors throughout Faunus.
- Load the user input parameters into a JSON object
heavily used in constructors throughout Faunus.
- **line 8**
- Specify how to calculate energies in the system - i.e. the Hamiltonian.
Expand Down
2 changes: 1 addition & 1 deletion src/examples/water2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ typedef CombinedPairPotential<CoulombWolf,LennardJonesLB> Tpairpot;
int main() {

cout << textio::splash(); // show faunus banner and credits
InputMap mcp("water2.json"); // read input file
Tmjson mcp = openjson("water2.json");// read input file
Tspace spc(mcp);

// Energy functions and space
Expand Down

0 comments on commit f69faca

Please sign in to comment.