27 gpr::InputParameters p;
45 p.divisor_T_dimer_gp.value =
54 p.jitter_sigma2.value =
62 p.check_derivative.value =
74 p.prune_threshold.value =
77 p.report_level.value =
80 p.debug_output_dir.value =
82 p.debug_output_file_R.value =
84 p.debug_output_file_E.value =
86 p.debug_output_file_G.value =
88 p.debug_output_file_extension.value =
90 p.debug_offset_from_mid_point.value =
114 throw std::invalid_argument(
"eon_matter_to_atmconf: null Matter");
116 gpr::AtomsConfiguration atoms_config;
117 aux::ProblemSetUp problem_setup;
118 gpr::Index_t number_of_mov_atoms;
119 gpr::Index_t number_of_fro_atoms;
120 std::set<int> unique_atomtypes;
122 std::vector<int> atomnrs;
123 std::unordered_map<int, int>
129 atoms_config.clear();
132 copyAtomMatrixToCoord(matter->
getPositions(), atoms_config.positions);
134 atoms_config.is_frozen.resize(1, nAtoms);
135 atoms_config.id.resize(1, nAtoms);
136 atoms_config.atomicNrs.resize(1, nAtoms);
137 for (
auto i = 0; i < nAtoms; i++) {
140 atoms_config.atomicNrs(0, i) = matter->
getAtomicNr(i);
141 atoms_config.is_frozen(0, i) =
142 matter->
getFixed(i) ? FROZEN_ATOM : MOVING_ATOM;
143 atoms_config.id(0, i) =
static_cast<gpr::Index_t
>(i + 1);
146 unique_atomtypes = std::set<int>(atomnrs.begin(), atomnrs.end());
147 n_at = unique_atomtypes.size();
149 for (
auto uatom : unique_atomtypes) {
150 atype_to_gprd_atype.insert(
151 std::pair<int, int>(
static_cast<int>(uatom), fake_atype));
155 number_of_mov_atoms = atoms_config.countMovingAtoms();
156 number_of_fro_atoms =
157 static_cast<gpr::Index_t
>(atoms_config.is_frozen.size()) -
160 if (number_of_fro_atoms > 0 && number_of_mov_atoms > 0) {
162 atoms_config.atoms_mov.resize(number_of_mov_atoms);
163 atoms_config.atoms_froz_inactive.resize(number_of_fro_atoms);
166 if (atype_to_gprd_atype.size() > 1) {
168 int froz_inactive_counter = 0;
169 for (
auto i = 0; i < nAtoms; i++) {
173 atoms_config.atoms_froz_inactive.type(0, froz_inactive_counter) =
174 atype_to_gprd_atype.at(atomnrs[i]);
175 froz_inactive_counter++;
178 atoms_config.atoms_mov.type(0, mov_counter) =
179 atype_to_gprd_atype.at(atomnrs[i]);
186 else if (atype_to_gprd_atype.size() == 1) {
187 atoms_config.atoms_mov.type.setConstant(
188 atype_to_gprd_atype.at(atomnrs[0]));
189 atoms_config.atoms_froz_inactive.type.setConstant(
190 atype_to_gprd_atype.at(atomnrs[0]));
193 gpr::Index_t counter_f = 0, counter_m = 0;
194 for (gpr::Index_t n = 0;
195 n < static_cast<gpr::Index_t>(atoms_config.is_frozen.size()); ++n) {
196 if (atoms_config.is_frozen(0, n) == MOVING_ATOM)
197 gpr::coord::set(atoms_config.atoms_mov.positions, 0, counter_m++,
198 gpr::coord::at(atoms_config.positions, n));
200 gpr::coord::set(atoms_config.atoms_froz_inactive.positions, 0,
201 counter_f++, gpr::coord::at(atoms_config.positions, n));
205 if (number_of_mov_atoms == 0) {
206 throw std::runtime_error(
"eon_matter_to_atmconf: no moving atoms");
210 atoms_config.atoms_mov.resize(number_of_mov_atoms);
213 if (atype_to_gprd_atype.size() > 1) {
215 for (
auto i = 0; i < nAtoms; i++) {
216 atoms_config.atoms_mov.type(0, mov_counter) =
217 atype_to_gprd_atype.at(atomnrs[i]);
223 else if (atype_to_gprd_atype.size() == 1) {
224 atoms_config.atoms_mov.type.setConstant(
225 atype_to_gprd_atype.at(atomnrs[0]));
231 atoms_config.pairtype.resize(n_at, n_at);
232 atoms_config.pairtype.setConstant(EMPTY);
236 problem_setup.setPairtypeForMovingAtoms(
237 atoms_config.atoms_mov.type, atoms_config.n_pt, atoms_config.pairtype);