@@ -125,50 +125,22 @@ void RotatedSPOs::resetParametersExclusive(const opt_variables_type& active)
125
125
myVars[i] = active[loc];
126
126
}
127
127
128
- if (use_global_rot_)
129
- {
130
- std::vector<ValueType> old_param (m_full_rot_inds_.size ());
131
- std::copy_n (myVarsFull_.data (), myVarsFull_.size (), old_param.data ());
132
-
133
- applyDeltaRotation (delta_param, old_param, myVarsFull_);
134
- }
135
- else
136
- {
137
- apply_rotation (delta_param, false );
128
+ std::vector<ValueType> old_param (m_full_rot_inds_.size ());
129
+ std::copy_n (myVarsFull_.data (), myVarsFull_.size (), old_param.data ());
138
130
139
- // Save the parameters in the history list
140
- history_params_.push_back (delta_param);
141
- }
131
+ applyDeltaRotation (delta_param, old_param, myVarsFull_);
142
132
}
143
133
144
134
void RotatedSPOs::writeVariationalParameters (hdf_archive& hout)
145
135
{
146
136
hout.push (" RotatedSPOs" );
147
- if (use_global_rot_)
148
- {
149
- hout.push (" rotation_global" );
150
- const std::string rot_global_name = std::string (" rotation_global_" ) + SPOSet::getName ();
151
137
152
- hout.write (myVarsFull_, rot_global_name);
153
- hout.pop ();
154
- }
155
- else
156
- {
157
- hout.push (" rotation_history" );
158
- size_t rows = history_params_.size ();
159
- size_t cols = 0 ;
160
- if (rows > 0 )
161
- cols = history_params_[0 ].size ();
162
-
163
- Matrix<ValueType> tmp (rows, cols);
164
- for (size_t i = 0 ; i < rows; i++)
165
- for (size_t j = 0 ; j < cols; j++)
166
- tmp[i][j] = history_params_[i][j];
167
- std::string rot_hist_name = std::string (" rotation_history_" ) + SPOSet::getName ();
168
- hout.write (tmp, rot_hist_name);
169
- hout.pop ();
170
- }
138
+ hout.push (" rotation_global" );
139
+ const std::string rot_global_name = std::string (" rotation_global_" ) + SPOSet::getName ();
171
140
141
+ hout.write (myVarsFull_, rot_global_name);
142
+ hout.pop ();
143
+
172
144
// Save myVars in order to restore object state exactly
173
145
// The values aren't meaningful, but they need to match those saved in VariableSet
174
146
hout.push (" rotation_params" );
@@ -189,11 +161,7 @@ void RotatedSPOs::readVariationalParameters(hdf_archive& hin)
189
161
{
190
162
hin.push (" RotatedSPOs" , false );
191
163
192
- bool grp_hist_exists = hin.is_group (" rotation_history" );
193
164
bool grp_global_exists = hin.is_group (" rotation_global" );
194
- if (!grp_hist_exists && !grp_global_exists)
195
- app_warning () << " Rotation parameters not found in VP file" ;
196
-
197
165
198
166
if (grp_global_exists)
199
167
{
@@ -217,29 +185,9 @@ void RotatedSPOs::readVariationalParameters(hdf_archive& hin)
217
185
218
186
applyFullRotation (myVarsFull_, true );
219
187
}
220
- else if (grp_hist_exists)
188
+ else
221
189
{
222
- hin.push (" rotation_history" , false );
223
- std::string rot_hist_name = std::string (" rotation_history_" ) + SPOSet::getName ();
224
- std::vector<int > sizes (2 );
225
- if (!hin.getShape <ValueType>(rot_hist_name, sizes))
226
- throw std::runtime_error (" Failed to read rotation history in VP file" );
227
-
228
- int rows = sizes[0 ];
229
- int cols = sizes[1 ];
230
- history_params_.resize (rows);
231
- Matrix<ValueType> tmp (rows, cols);
232
- hin.read (tmp, rot_hist_name);
233
- for (size_t i = 0 ; i < rows; i++)
234
- {
235
- history_params_[i].resize (cols);
236
- for (size_t j = 0 ; j < cols; j++)
237
- history_params_[i][j] = tmp (i, j);
238
- }
239
-
240
- hin.pop ();
241
-
242
- applyRotationHistory ();
190
+ throw std::runtime_error (" Error. No global rotation group in h5. Abort." );
243
191
}
244
192
245
193
hin.push (" rotation_params" , false );
@@ -290,8 +238,8 @@ void RotatedSPOs::buildOptVariables(const size_t nel)
290
238
RotationIndices created_m_act_rot_inds;
291
239
292
240
RotationIndices created_full_rot_inds;
293
- if (use_global_rot_)
294
- createRotationIndicesFull (nel, nmo, created_full_rot_inds);
241
+
242
+ createRotationIndicesFull (nel, nmo, created_full_rot_inds);
295
243
296
244
createRotationIndices (nel, nmo, created_m_act_rot_inds);
297
245
@@ -306,13 +254,9 @@ void RotatedSPOs::buildOptVariables(const RotationIndices& rotations, const Rota
306
254
// create active rotations
307
255
m_act_rot_inds_ = rotations;
308
256
309
- if (use_global_rot_)
310
- m_full_rot_inds_ = full_rotations;
257
+ m_full_rot_inds_ = full_rotations;
311
258
312
- if (use_global_rot_)
313
- app_log () << " Orbital rotation using global rotation" << std::endl;
314
- else
315
- app_log () << " Orbital rotation using history" << std::endl;
259
+ app_log () << " Orbital rotation using global rotation" << std::endl;
316
260
317
261
// This will add the orbital rotation parameters to myVars
318
262
// and will also read in initial parameter values supplied in input file
@@ -349,13 +293,10 @@ void RotatedSPOs::buildOptVariables(const RotationIndices& rotations, const Rota
349
293
registerParameter (i, p, q, myVars, params_, false );
350
294
}
351
295
352
- if (use_global_rot_)
353
- {
354
- const size_t nfull_rot = m_full_rot_inds_.size ();
355
- myVarsFull_.resize (nfull_rot);
356
- for (int i = 0 ; i < nfull_rot; i++)
357
- myVarsFull_[i] = (params_supplied_ && i < m_act_rot_inds_.size ()) ? params_[i] : 0.0 ;
358
- }
296
+ const size_t nfull_rot = m_full_rot_inds_.size ();
297
+ myVarsFull_.resize (nfull_rot);
298
+ for (int i = 0 ; i < nfull_rot; i++)
299
+ myVarsFull_[i] = (params_supplied_ && i < m_act_rot_inds_.size ()) ? params_[i] : 0.0 ;
359
300
360
301
// Printing the parameters
361
302
if (true )
@@ -464,14 +405,6 @@ void RotatedSPOs::applyFullRotation(const std::vector<ValueType>& full_param, bo
464
405
Phi_->applyRotation (rot_mat, use_stored_copy);
465
406
}
466
407
467
- void RotatedSPOs::applyRotationHistory ()
468
- {
469
- for (auto delta_param : history_params_)
470
- {
471
- apply_rotation (delta_param, false );
472
- }
473
- }
474
-
475
408
// compute exponential of a real, antisymmetric matrix by diagonalizing and exponentiating eigenvalues
476
409
void RotatedSPOs::exponentiate_antisym_matrix (ValueMatrix& mat)
477
410
{
@@ -1640,8 +1573,6 @@ std::unique_ptr<SPOSet> RotatedSPOs::makeClone() const
1640
1573
myclone->m_full_rot_inds_ = this ->m_full_rot_inds_ ;
1641
1574
myclone->myVars = this ->myVars ;
1642
1575
myclone->myVarsFull_ = this ->myVarsFull_ ;
1643
- myclone->history_params_ = this ->history_params_ ;
1644
- myclone->use_global_rot_ = this ->use_global_rot_ ;
1645
1576
return myclone;
1646
1577
}
1647
1578
0 commit comments