Merge pull request #883 from giacomofiorin/colvars-update

Fixes to Colvars library (version 2018-04-29)
This commit is contained in:
Steve Plimpton
2018-05-03 11:25:32 -06:00
committed by GitHub
21 changed files with 605 additions and 452 deletions

View File

@ -133,6 +133,8 @@ colvarproxy_lammps::colvarproxy_lammps(LAMMPS_NS::LAMMPS *lmp,
void colvarproxy_lammps::init(const char *conf_file)
{
version_int = get_version_from_string(COLVARPROXY_VERSION);
// create the colvarmodule instance
colvars = new colvarmodule(this);
@ -203,6 +205,25 @@ double colvarproxy_lammps::compute()
}
previous_step = _lmp->update->ntimestep;
unit_cell_x.set(_lmp->domain->xprd, 0.0, 0.0);
unit_cell_y.set(0.0, _lmp->domain->yprd, 0.0);
unit_cell_z.set(0.0, 0.0, _lmp->domain->zprd);
if (_lmp->domain->xperiodic == 0 && _lmp->domain->yperiodic == 0 &&
_lmp->domain->zperiodic == 0) {
boundaries_type = boundaries_non_periodic;
reset_pbc_lattice();
} else if ((_lmp->domain->nonperiodic == 0) &&
(_lmp->domain->dimension == 3) &&
(_lmp->domain->triclinic == 0)) {
// Orthogonal unit cell
boundaries_type = boundaries_pbc_ortho;
colvarproxy_system::update_pbc_lattice();
// It is safer to let LAMMPS deal with high-tilt triclinic boxes
} else {
boundaries_type = boundaries_unsupported;
}
if (cvm::debug()) {
cvm::log(std::string(cvm::line_marker)+
"colvarproxy_lammps, step no. "+cvm::to_str(colvars->it)+"\n"+
@ -263,8 +284,10 @@ bool colvarproxy_lammps::deserialize_status(std::string &rst)
}
}
cvm::rvector colvarproxy_lammps::position_distance(cvm::atom_pos const &pos1,
cvm::atom_pos const &pos2)
const
{
double xtmp = pos2.x - pos1.x;
double ytmp = pos2.y - pos1.y;
@ -273,28 +296,6 @@ cvm::rvector colvarproxy_lammps::position_distance(cvm::atom_pos const &pos1,
return cvm::rvector(xtmp, ytmp, ztmp);
}
cvm::real colvarproxy_lammps::position_dist2(cvm::atom_pos const &pos1,
cvm::atom_pos const &pos2)
{
double xtmp = pos2.x - pos1.x;
double ytmp = pos2.y - pos1.y;
double ztmp = pos2.z - pos1.z;
_lmp->domain->minimum_image(xtmp,ytmp,ztmp);
return cvm::real(xtmp*xtmp + ytmp*ytmp + ztmp*ztmp);
}
void colvarproxy_lammps::select_closest_image(cvm::atom_pos &pos,
cvm::atom_pos const &ref)
{
double xtmp = pos.x - ref.x;
double ytmp = pos.y - ref.y;
double ztmp = pos.z - ref.z;
_lmp->domain->minimum_image(xtmp,ytmp,ztmp);
pos.x = ref.x + xtmp;
pos.y = ref.y + ytmp;
pos.z = ref.z + ztmp;
}
void colvarproxy_lammps::log(std::string const &message)
{
@ -308,12 +309,14 @@ void colvarproxy_lammps::log(std::string const &message)
}
}
void colvarproxy_lammps::error(std::string const &message)
{
// In LAMMPS, all errors are fatal
fatal_error(message);
}
void colvarproxy_lammps::fatal_error(std::string const &message)
{
log(message);
@ -321,13 +324,6 @@ void colvarproxy_lammps::fatal_error(std::string const &message)
"Fatal error in the collective variables module.\n");
}
void colvarproxy_lammps::exit(std::string const &message)
{
log(message);
log("Request to exit the simulation made.\n");
do_exit=true;
}
int colvarproxy_lammps::backup_file(char const *filename)
{
@ -342,10 +338,12 @@ int colvarproxy_lammps::backup_file(char const *filename)
// multi-replica support
void colvarproxy_lammps::replica_comm_barrier() {
void colvarproxy_lammps::replica_comm_barrier()
{
MPI_Barrier(inter_comm);
}
int colvarproxy_lammps::replica_comm_recv(char* msg_data,
int buf_len, int src_rep)
{
@ -359,6 +357,7 @@ int colvarproxy_lammps::replica_comm_recv(char* msg_data,
return retval;
}
int colvarproxy_lammps::replica_comm_send(char* msg_data,
int msg_len, int dest_rep)
{

View File

@ -120,14 +120,9 @@ class colvarproxy_lammps : public colvarproxy {
void log(std::string const &message);
void error(std::string const &message);
void fatal_error(std::string const &message);
void exit(std::string const &message);
cvm::rvector position_distance(cvm::atom_pos const &pos1,
cvm::atom_pos const &pos2);
cvm::real position_dist2(cvm::atom_pos const &pos1,
cvm::atom_pos const &pos2);
void select_closest_image(cvm::atom_pos &pos,
cvm::atom_pos const &ref_pos);
cvm::atom_pos const &pos2) const;
int backup_file(char const *filename);

View File

@ -1,5 +1,5 @@
#ifndef COLVARPROXY_VERSION
#define COLVARPROXY_VERSION "2017-12-01"
#define COLVARPROXY_VERSION "2018-04-29"
// This file is part of the Collective Variables module (Colvars).
// The original version of Colvars and its updates are located at:
// https://github.com/colvars/colvars