Allow extended Lagrangian on non-scalar collective variables

This commit is contained in:
Giacomo Fiorin
2016-10-27 18:31:06 -04:00
parent 62dea1bb63
commit 7a45c72b97
7 changed files with 50 additions and 11 deletions

View File

@ -70,6 +70,39 @@ void colvarvalue::set_elem(int const icv, colvarvalue const &x)
}
void colvarvalue::set_random()
{
switch (this->type()) {
case colvarvalue::type_scalar:
this->real_value = cvm::rand_gaussian();
break;
case colvarvalue::type_3vector:
case colvarvalue::type_unit3vector:
case colvarvalue::type_unit3vectorderiv:
this->rvector_value.x = cvm::rand_gaussian();
this->rvector_value.y = cvm::rand_gaussian();
this->rvector_value.z = cvm::rand_gaussian();
break;
case colvarvalue::type_quaternion:
case colvarvalue::type_quaternionderiv:
this->quaternion_value.q0 = cvm::rand_gaussian();
this->quaternion_value.q1 = cvm::rand_gaussian();
this->quaternion_value.q2 = cvm::rand_gaussian();
this->quaternion_value.q3 = cvm::rand_gaussian();
break;
case colvarvalue::type_vector:
for (size_t ic = 0; ic < this->vector1d_value.size(); ic++) {
this->vector1d_value[ic] = cvm::rand_gaussian();
}
break;
case colvarvalue::type_notset:
default:
undef_op();
break;
}
}
colvarvalue colvarvalue::inverse() const
{
switch (value_type) {