@@ -39,10 +39,11 @@ colvarbias_alb::colvarbias_alb(char const *key)
39
39
int colvarbias_alb::init (std::string const &conf)
40
40
{
41
41
colvarproxy *proxy = cvm::main ()->proxy ;
42
- int err = colvarbias::init (conf);
43
- if (err != COLVARS_OK) {
44
- return err ;
42
+ int error_code = colvarbias::init (conf);
43
+ if (error_code != COLVARS_OK) {
44
+ return error_code ;
45
45
}
46
+
46
47
cvm::main ()->cite_feature (" ALB colvar bias implementation" );
47
48
48
49
enable (f_cvb_scalar_variables);
@@ -80,21 +81,34 @@ int colvarbias_alb::init(std::string const &conf)
80
81
}
81
82
} else {
82
83
colvar_centers.clear ();
83
- cvm::error (" Error: must define the initial centers of adaptive linear bias .\n " );
84
+ error_code |= cvm::error (" Error: must define the initial centers of adaptive linear bias.\n " ,
85
+ COLVARS_INPUT_ERROR);
84
86
}
85
87
86
- if (colvar_centers.size () != num_variables ())
87
- cvm::error (" Error: number of centers does not match "
88
- " that of collective variables.\n " );
88
+ if (colvar_centers.size () != num_variables ()) {
89
+ error_code |=
90
+ cvm::error (" Error: number of centers does not match that of collective variables.\n " );
91
+ }
89
92
90
- if (!get_keyval (conf, " UpdateFrequency" , update_freq, 0 ))
91
- cvm::error (" Error: must set updateFrequency for adaptive linear bias.\n " );
93
+ if (!get_keyval (conf, " updateFrequency" , update_freq, 0 )) {
94
+ error_code |= cvm::error (" Error: must set updateFrequency for adaptive linear bias.\n " ,
95
+ COLVARS_INPUT_ERROR);
96
+ }
97
+
98
+ if (update_freq % time_step_factor != 0 ) {
99
+ error_code |= cvm::error (" updateFrequency (currently " + cvm::to_str (update_freq) +
100
+ " ) must be a multiple of timeStepFactor (" +
101
+ cvm::to_str (time_step_factor) + " ).\n " ,
102
+ COLVARS_INPUT_ERROR);
103
+ }
92
104
93
105
// we split the time between updating and equilibrating
94
106
update_freq /= 2 ;
95
107
96
- if (update_freq <= 1 )
97
- cvm::error (" Error: must set updateFrequency to greater than 2.\n " );
108
+ if (update_freq <= 1 ) {
109
+ error_code |=
110
+ cvm::error (" Error: must set updateFrequency to greater than 2.\n " , COLVARS_INPUT_ERROR);
111
+ }
98
112
99
113
enable (f_cvb_history_dependent);
100
114
@@ -136,7 +150,7 @@ int colvarbias_alb::init(std::string const &conf)
136
150
if (cvm::debug ())
137
151
cvm::log (" bias.\n " );
138
152
139
- return COLVARS_OK ;
153
+ return error_code ;
140
154
}
141
155
142
156
0 commit comments