@@ -141,9 +141,23 @@ template <typename DoFSetType>
141
141
Eigen::MatrixXd local_to_standard_values (
142
142
Eigen::MatrixXd const &dof_values, Index N_sublat, Index N_volume,
143
143
std::vector<DoFSetType> const &dof_info) {
144
+ Index N_sites = N_volume * N_sublat;
144
145
Index rows = dof_info.front ().basis ().rows ();
145
- Eigen::MatrixXd standard_values (rows, dof_values.cols ());
146
+ if (dof_values.rows () != max_dim (dof_info) || dof_values.cols () != N_sites) {
147
+ std::stringstream msg;
148
+ msg << " Invalid dof values input size in "
149
+ " local_to_standard_values: "
150
+ << " Expected rows=" << max_dim (dof_info)
151
+ << " , received rows=" << dof_values.rows ()
152
+ << " , expected cols=" << N_sites
153
+ << " , received cols=" << dof_values.cols ();
154
+ throw std::runtime_error (msg.str ());
155
+ }
156
+ Eigen::MatrixXd standard_values = Eigen::MatrixXd::Zero (rows, N_sites);
146
157
for (Index b = 0 ; b < N_sublat; ++b) {
158
+ if (dof_info[b].dim () == 0 ) {
159
+ continue ;
160
+ }
147
161
standard_values.block (0 , b * N_volume, rows, N_volume) =
148
162
dof_info[b].basis () *
149
163
sublattice_block (dof_values, b, N_volume).topRows (dof_info[b].dim ());
@@ -161,18 +175,22 @@ Eigen::MatrixXd local_from_standard_values(
161
175
standard_values.cols () != N_sites) {
162
176
std::stringstream msg;
163
177
msg << " Invalid standard values input size in "
164
- " local_dof_values_from_standard_basis : "
178
+ " local_from_standard_value : "
165
179
<< " Expected rows=" << dof_info.front ().basis ().rows ()
166
180
<< " , received rows=" << standard_values.rows ()
167
181
<< " , expected cols=" << N_sites
168
182
<< " , received cols=" << standard_values.cols ();
169
183
throw std::runtime_error (msg.str ());
170
184
}
171
185
Eigen::MatrixXd result = Eigen::MatrixXd::Zero (max_dim (dof_info), N_sites);
172
- for (Index b = 0 ; b < N_sublat; ++b)
186
+ for (Index b = 0 ; b < N_sublat; ++b) {
187
+ if (dof_info[b].dim () == 0 ) {
188
+ continue ;
189
+ }
173
190
sublattice_block (result, b, N_volume).topRows (dof_info[b].dim ()) =
174
191
dof_info[b].inv_basis () *
175
192
sublattice_block (standard_values, b, N_volume);
193
+ }
176
194
return result;
177
195
}
178
196
0 commit comments