121 bool diff2gs)
const {
123 throw std::runtime_error(
".orb file does not contain a basisset name");
126 throw std::runtime_error(
127 "fchk writer supports restricted closed-shell orbitals only; "
128 "unrestricted (beta) orbitals would be silently dropped.");
133 std::ofstream outFile(basename +
".fchk");
135 if (outFile.is_open()) {
137 <<
"Start writing to " << (basename +
".fchk") << std::flush;
140 outFile << basename <<
", fchk created by VOTCA-XTP\n";
143 outFile << boost::format(
"%-10s%-30s%-30s\n") %
"SP" %
"RHF" %
147 outFile << boost::format(
"%-43s%-2s%15d\n") %
"Number of atoms" %
"I" % orbitals.
QMAtoms().
size();
148 outFile << boost::format(
"%-43s%-2s%15d\n") %
"Charge" %
"I" % orbitals.
getCharge();
149 outFile << boost::format(
"%-43s%-2s%15d\n") %
"Multiplicity" %
"I" % orbitals.
getSpin();
153 outFile << boost::format(
"%-43s%-2s%15d\n") %
"Number of basis functions" %
"I" % basis.
AOBasisSize();
154 outFile << boost::format(
"%-43s%-2s%15d\n") %
"Number of independent functions" %
"I" % basis.
AOBasisSize();
157 outFile << boost::format(
"%-43s%-2s N= %10d\n") %
"Atomic numbers" %
"I" %
160 for (
const auto& atom : orbitals.
QMAtoms()) {
161 outFile << boost::format(
"%12d") % atom.getElementNumber();
162 if (temp_int % 6 == 0) {
167 outFile << ((temp_int - 1) % 6 == 0 ?
"" :
"\n");
169 outFile << boost::format(
"%-43s%-2s N= %10d\n") %
"Nuclear charges" %
"R" %
172 for (
const auto& atom : orbitals.
QMAtoms()) {
173 outFile << boost::format(
"%16.8e") % (double)atom.getNuccharge();
174 if (temp_int % 5 == 0) {
179 outFile << ((temp_int - 1) % 5 == 0 ?
"" :
"\n");
181 outFile << boost::format(
"%-43s%-2s N= %10d\n") %
182 "Current cartesian coordinates" %
"R" %
183 (3 * orbitals.
QMAtoms().size());
185 for (
const auto& atom : orbitals.
QMAtoms()) {
186 for (
int i = 0; i < 3; ++i) {
187 outFile << boost::format(
"%16.8e") % atom.getPos()(i);
188 if (temp_int % 5 == 0) {
194 outFile << ((temp_int - 1) % 5 == 0 ?
"" :
"\n");
196 outFile << boost::format(
"%-43s%-2s%15d\n") %
"Number of primitive shells" %
199 outFile << boost::format(
"%-43s%-2s%15d\n") %
202 outFile << boost::format(
"%-43s%-2s%15d\n") %
"Pure/Cartesian d shells " %
205 outFile << boost::format(
"%-43s%-2s%15d\n") %
"Pure/Cartesian f shells " %
208 outFile << boost::format(
"%-43s%-2s%15d\n") %
"Highest angular momentum " %
211 outFile << boost::format(
"%-43s%-2s%15d\n") %
212 "Largest degree of contraction " %
"I" % basis.
getMaxNprim();
214 outFile << boost::format(
"%-43s%-2s N= %10d\n") %
"Shell types" %
"I" %
217 for (
const auto& shell : basis) {
218 outFile << boost::format(
"%12d") %
toGaussianL(shell.getL());
219 if (temp_int % 6 == 0) {
224 outFile << ((temp_int - 1) % 6 == 0 ?
"" :
"\n");
226 outFile << boost::format(
"%-43s%-2s N= %10d\n") %
227 "Number of primitives per shell" %
"I" %
228 (basis.getNumofShells());
230 for (
const AOShell& shell : basis) {
231 outFile << boost::format(
"%12d") % shell.getSize();
232 if (temp_int % 6 == 0) {
237 outFile << ((temp_int - 1) % 6 == 0 ?
"" :
"\n");
239 outFile << boost::format(
"%-43s%-2s N= %10d\n") %
"Shell to atom map" %
240 "I" % (basis.getNumofShells());
242 for (
const AOShell& shell : basis) {
244 outFile << boost::format(
"%12d") % (shell.getAtomIndex() + 1);
245 if (temp_int % 6 == 0) {
250 outFile << ((temp_int - 1) % 6 == 0 ?
"" :
"\n");
252 outFile << boost::format(
"%-43s%-2s N= %10d\n") %
"Primitive exponents" %
253 "R" % basis.getNumberOfPrimitives();
255 for (
const AOShell& shell : basis) {
257 outFile << boost::format(
"%16.8e") % prim.getDecay();
258 if (temp_int % 5 == 0) {
264 outFile << ((temp_int - 1) % 5 == 0 ?
"" :
"\n");
266 outFile << boost::format(
"%-43s%-2s N= %10d\n") %
267 "Contraction coefficients" %
"R" %
268 basis.getNumberOfPrimitives();
270 for (
const AOShell& shell : basis) {
272 outFile << boost::format(
"%16.8e") % prim.getContraction();
273 if (temp_int % 5 == 0) {
279 outFile << ((temp_int - 1) % 5 == 0 ?
"" :
"\n");
281 outFile << boost::format(
"%-43s%-2s N= %10d\n") %
282 "Coordinates of each shell" %
"R" %
283 (3 * basis.getNumofShells());
285 for (
const AOShell& shell : basis) {
286 for (
int i = 0; i < 3; ++i) {
287 outFile << boost::format(
"%16.8e") % shell.getPos()(i);
288 if (temp_int % 5 == 0) {
294 outFile << ((temp_int - 1) % 5 == 0 ?
"" :
"\n");
296 outFile << boost::format(
"%-43s%-2s%22.15e\n") %
"Total Energy" %
"R" %
299 outFile << boost::format(
"%-43s%-2s N= %10d\n") %
300 "Alpha Orbital Energies" %
"R" %
303 const Eigen::VectorXd mo_energies =
moEnergies(orbitals);
304 for (
Index i = 0; i < mo_energies.size(); ++i) {
305 outFile << boost::format(
"%16.8e") % mo_energies[i];
306 if (temp_int % 5 == 0) {
311 outFile << ((temp_int - 1) % 5 == 0 ?
"" :
"\n");
313 outFile << boost::format(
"%-43s%-2s N= %10d\n") %
"Alpha MO coefficients" %
315 (orbitals.
MOs().eigenvalues().size() *
319 outFile << boost::format(
"%-43s%-2s N= %10d\n") %
"Total SCF Density" %
321 ((orbitals.
MOs().eigenvalues().size() *