IGMPlot 3.16 Optimized IGMplot version able to use wfn/wfx/xyz files

Loading...
Searching...
No Matches
WFreader.h
Go to the documentation of this file.
1/*
2 * Copyright University of Reims Champagne-Ardenne
3 * Authors and Contributors: Akilan RAJAMANI, Corentin LEFEBVRE, Johanna KLEIN,
4 * Emmanuel PLUOT, Hugo ROUSSEL, Gaetan RUBEZ, Hassan KHARTABIL,
5 * Jean-Charles BOISSON and Eric HENON
6 * (24/07/2017)
7 * jean-charles.boisson@univ-reims.fr, eric.henon@univ-reims.fr
8 *
9 * This software is a computer program whose purpose is to
10 * detect and quantify interactions from electron density
11 * obtained either internally from promolecular density or
12 * calculated from an input wave function input file. It also
13 * prepares for the visualization of isosurfaces representing
14 * several descriptors (dg) coming from the IGM methodology.
15 *
16 * This software is governed by the CeCILL-C license under French law and
17 * abiding by the rules of distribution of free software. You can use,
18 * modify and/ or redistribute the software under the terms of the CeCILL-C
19 * license as circulated by CEA, CNRS and INRIA at the following URL
20 * "http://www.cecill.info".
21 *
22 * As a counterpart to the access to the source code and rights to copy,
23 * modify and redistribute granted by the license, users are provided only
24 * with a limited warranty and the software's author, the holder of the
25 * economic rights, and the successive licensors have only limited
26 * liability.
27 *
28 * In this respect, the user's attention is drawn to the risks associated
29 * with loading, using, modifying and/or developing or reproducing the
30 * software by the user in light of its specific status of free software,
31 * that may mean that it is complicated to manipulate, and that also
32 * therefore means that it is reserved for developers and experienced
33 * professionals having in-depth computer knowledge. Users are therefore
34 * encouraged to load and test the software's suitability as regards their
35 * requirements in conditions enabling the security of their systems and/or
36 * data to be ensured and, more generally, to use and operate it in the
37 * same conditions as regards security.
38 *
39 * The fact that you are presently reading this means that you have had
40 * knowledge of the CeCILL-C license and that you accept its terms.
41 *
42 * */
43
48
49#ifndef _WFNREADER_H_
51#define _WFNREADER_H_
52
53
54// STL
55#include <fstream>
56#include <sstream>
57#include <iostream>
58#include <iomanip>
59#include <vector>
60#include <algorithm>
61#include <string>
62#include <cstdlib>
63#include <general.h>
64
65// ADF files management
66#include <ADF_KFReader.h>
67
69 typedef struct centerData
70 {
72 std::string* element;
74 unsigned int value;
76 unsigned int rank;
78 double coordinates[3];
80 double charge;
81 } centerData;
82
84 typedef struct moleculeOrbital
85 {
87 unsigned int rank;
89 double data2;
91 double occupancy;
93 double orbitalEnergy;
95 double* coefficients;
96 } moleculeOrbital;
97
103 void wf_load_file(const std::string & fileName, const bool verbose=false);
104
110 void wfn_load_file(std::ifstream & inputFile, const bool verbose=false);
111
117 void wfn_read_GAUSSIAN_line(const std::string & line, const bool verbose=false);
118
124 void wfn_read_center_data(std::ifstream & inputFile, const bool verbose=false);
125
131 void wfn_read_primitive_centers(std::ifstream & inputFile, const bool verbose=false);
132
138 void wfn_read_primitive_types(std::ifstream & inputFile, const bool verbose=false);
139
145 void wfn_read_exponents(std::ifstream & inputFile, const bool verbose=false);
146
152 void wfn_read_molecule_orbitals(std::ifstream & inputFile, const bool verbose=false);
153
159 void wfn_read_total_energy_and_virial(std::ifstream & inputFile, const bool verbose=false);
160
165 void wfn_fromFortranRealToCppReal(std::string & line);
166
170 void wfn_printTotalEnergyAndVirial();
171
172
178 void wfx_load_file(std::ifstream & inputFile, const bool verbose=false);
179
183 void wfx_init();
184
190 void wfx_read_data(std::ifstream & inputFile, const bool verbose=false);
191
192
196 void wf_cleaning(const bool verbose=false);
197
198
203 bool wf_file_already_loaded();
204
209 unsigned int wf_number_of_orbitals();
210
215 unsigned int wf_number_of_primitives();
216
221 unsigned int wf_number_of_nuclei();
222
227 unsigned int* wf_user2ADF_atomOrder();
228
233 unsigned int* wf_ADF2user_atomOrder();
234
235
240 centerData* wf_center_data();
241
246 unsigned int* wf_primitive_centers();
247
252 unsigned int* wf_primitive_types();
253
258 double* wf_primitive_exponents();
259
264 int wf_netCharge();
265
269 void wf_setNetCharge(int value);
270
275std::vector<moleculeOrbital>
276 wf_molecular_orbitals();
277
282 bool
283 wf_molecular_orbitals_sort();
284
288 void wf_allocateMemory();
289
293 void wf_printGlobalBounds();
294
298 void wf_printMO();
299
303 void wf_printPrimitiveExponents();
304
308 void wf_printPrimitiveTypes();
309
313 void wf_printPrimitiveCenters();
314
318 void wf_printCenterData();
319
327 template <typename T> void loadInputFileData(std::ifstream & inputFile, T *data, unsigned int nbData)
328{
329 unsigned int nbDataRead=0;
330
331 while(nbDataRead != nbData)
332 {
333 inputFile >> data[nbDataRead++];
334 }
335}
336
346 template <typename T> void wf_printInformation(const T *data, const unsigned int nbData, const unsigned int nbDataLine,const unsigned int borderShift=1,const bool scientific=true, const unsigned int precision=12)
347{
348 if(scientific)
349 {
350 std::cout << std::scientific << std::setprecision(precision);
351 }
352
353 for(unsigned int i(0);i<nbData;++i)
354 {
355 if(i%nbDataLine==0)
356 {
357 std::cout << std::endl;
358 for(unsigned int shift(0);shift<borderShift;++shift)
359 {
360 std::cout << "\t";
361 }
362 }
363
364 // JC 2.6.22 update : as data[i] is always a numerical information, cast to double for avoiding "pointless comparison of unsigned integer with zero" warning from PGI
365 if(((double)data[i])>=0.0)
366 {
367 std::cout << " ";
368 }
369 std::cout << data[i] << " ";
370 }
371 std::cout << std::endl;
372}
373
379std::string removeSpaces(std::string str);
380
386 bool isDouble(std::string text);
387
388
394 double toDouble(std::string text);
395
396
397/********************************************************************************
398 * For RKF reading *
399 ********************************************************************************/
400
401 void load_rkf_file(const std::string & fileName);
402
403 void rkf_load_nbNuclei(KFFile* kf);
404
405 void rkf_load_data(KFFile* kf, const char *filename);
406
411 unsigned int* wf_primitive_krs();
412
413
414#endif
wfn_fromFortranRealToCppReal
void wfn_fromFortranRealToCppReal(std::string &line)
Tool function which allows to transform a line with fortran real (with D) to C real (with E) in order...
Definition WFreader.cpp:713
toDouble
double toDouble(std::string text)
Function converting a string to a double.
Definition WFreader.cpp:1692
wfn_read_molecule_orbitals
void wfn_read_molecule_orbitals(std::ifstream &inputFile, const bool verbose=false)
Tool function which read the molecule orbital (multiple lines according to the number of primitives)
Definition WFreader.cpp:381
wfn_read_center_data
void wfn_read_center_data(std::ifstream &inputFile, const bool verbose=false)
Tool function which read the center data according to the number of nuclei.
Definition WFreader.cpp:192
loadInputFileData
void loadInputFileData(std::ifstream &inputFile, T *data, unsigned int nbData)
Template Tool procedure to load the data from an inputFile.
Definition WFreader.h:327
wf_number_of_nuclei
unsigned int wf_number_of_nuclei()
Tool function which allows to know the number of nuclei (if a file is loaded)
Definition WFreader.cpp:931
wfx_read_data
void wfx_read_data(std::ifstream &inputFile, const bool verbose=false)
Tool function which read the data of the corresponding wfx file (this method must be called after wfx...
Definition WFreader.cpp:1230
wf_number_of_orbitals
unsigned int wf_number_of_orbitals()
Tool function which allows to know the number of orbitals (if a file is loaded)
Definition WFreader.cpp:908
wf_printGlobalBounds
void wf_printGlobalBounds()
Tool procedure to print 3 importants values : the number of nuclei, of primitives and molecular orbit...
Definition WFreader.cpp:1624
wfn_printTotalEnergyAndVirial
void wfn_printTotalEnergyAndVirial()
Tool procedure to print the total energy and virial (only use with WFN reading for the moment.
Definition WFreader.cpp:1635
isDouble
bool isDouble(std::string text)
Function checking if a string is a number.
Definition WFreader.cpp:1678
wfn_read_exponents
void wfn_read_exponents(std::ifstream &inputFile, const bool verbose=false)
Tool function which read the exponents (multiple lines according to the number of primitives)
wf_netCharge
int wf_netCharge()
Tool function which returns the net charge of the whole system (if a file is loaded)
Definition WFreader.cpp:988
wf_printMO
void wf_printMO()
Tool procedure to print molecular orbitals information.
Definition WFreader.cpp:1528
wf_primitive_types
unsigned int * wf_primitive_types()
Tool function which allows to gain access to all the primitive types (if a file is loaded)
Definition WFreader.cpp:967
wf_molecular_orbitals
std::vector< moleculeOrbital > wf_molecular_orbitals()
Tool function which allows to gain access to all molecular orbitals (if a file is loaded)
Definition WFreader.cpp:1020
wf_user2ADF_atomOrder
unsigned int * wf_user2ADF_atomOrder()
Tool function which return the array storing the atom re-ordering (from user to ADF index)
Definition WFreader.cpp:883
wf_number_of_primitives
unsigned int wf_number_of_primitives()
Tool function which allows to know the number of primitives (if a file is loaded)
Definition WFreader.cpp:920
wf_ADF2user_atomOrder
unsigned int * wf_ADF2user_atomOrder()
Tool function which return the array storing the atom re-ordering (from ADF to user index)
Definition WFreader.cpp:894
wf_load_file
void wf_load_file(const std::string &fileName, const bool verbose=false)
Tool function which read the corresponding file.
Definition WFreader.cpp:622
wf_printInformation
void wf_printInformation(const T *data, const unsigned int nbData, const unsigned int nbDataLine, const unsigned int borderShift=1, const bool scientific=true, const unsigned int precision=12)
Template Tool procedure to print data.
Definition WFreader.h:346
wfn_read_total_energy_and_virial
void wfn_read_total_energy_and_virial(std::ifstream &inputFile, const bool verbose=false)
Tool function which read the total energy and associated virial.
Definition WFreader.cpp:529
wf_center_data
centerData * wf_center_data()
Tool function which allows to gain access to all the center data (if a file is loaded)
Definition WFreader.cpp:943
wf_allocateMemory
void wf_allocateMemory()
Tool procedure to allocate the memory for the array linked to the number of nuclei,...
Definition WFreader.cpp:131
wf_file_already_loaded
bool wf_file_already_loaded()
Tool function which allows to know if a file has already loaded.
Definition WFreader.cpp:876
wfn_read_GAUSSIAN_line
void wfn_read_GAUSSIAN_line(const std::string &line, const bool verbose=false)
Tool function which read the line starting by GAUSSIAN to extract the number of orbitals,...
Definition WFreader.cpp:160
wfn_load_file
void wfn_load_file(std::ifstream &inputFile, const bool verbose=false)
Tool function which load the corresponding wfn file.
Definition WFreader.cpp:553
wfx_load_file
void wfx_load_file(std::ifstream &inputFile, const bool verbose=false)
Tool function which load the corresponding wfx file.
Definition WFreader.cpp:1053
wf_printPrimitiveTypes
void wf_printPrimitiveTypes()
Tool procedure to print the primitive types.
Definition WFreader.cpp:1569
wfn_read_primitive_types
void wfn_read_primitive_types(std::ifstream &inputFile, const bool verbose=false)
Tool function which read the primitive types (multiple lines according to the number of primitives)
Definition WFreader.cpp:293
wf_printPrimitiveExponents
void wf_printPrimitiveExponents()
Tool procedure to print the primitive exponents.
Definition WFreader.cpp:1583
wfx_init
void wfx_init()
Tool procedure to initialize some stuff for wfx reading.
Definition WFreader.cpp:1197
wf_primitive_centers
unsigned int * wf_primitive_centers()
Tool function which allows to gain access to all the primitive centers (if a file is loaded)
Definition WFreader.cpp:955
wf_primitive_exponents
double * wf_primitive_exponents()
Tool function which allows to gain access to all the exponents (if a file is loaded)
Definition WFreader.cpp:978
wfn_read_primitive_centers
void wfn_read_primitive_centers(std::ifstream &inputFile, const bool verbose=false)
Tool function which read the primitive centers (multiple lines according to the number of primitives)
Definition WFreader.cpp:247
wf_printPrimitiveCenters
void wf_printPrimitiveCenters()
Tool procedure to print the primitive centers.
Definition WFreader.cpp:1555
wf_printCenterData
void wf_printCenterData()
Tool procedure to print the center data.
Definition WFreader.cpp:1597
wf_cleaning
void wf_cleaning(const bool verbose=false)
Tool function which frees all the allocated memory.
Definition WFreader.cpp:732
wf_molecular_orbitals_sort
bool wf_molecular_orbitals_sort()
Tool function which sort the MOs by ascending order of energy.
Definition WFreader.cpp:1032
general.h
all data types and constant data needed by the rest of the program
centerData
structure to save center data
Definition WFreader.h:70
centerData::rank
unsigned int rank
to doc
Definition WFreader.h:76
centerData::value
unsigned int value
to doc and rename
Definition WFreader.h:74
centerData::coordinates
double coordinates[3]
coordinates to doc and rename
Definition WFreader.h:78
centerData::charge
double charge
to doc
Definition WFreader.h:80
centerData::element
std::string * element
The atomic element, using a string for easing the use.
Definition WFreader.h:72
moleculeOrbital
structure to save molecule orbital data
Definition WFreader.h:85
moleculeOrbital::coefficients
double * coefficients
Primites coefficient for one molecular orbital.
Definition WFreader.h:95
moleculeOrbital::orbitalEnergy
double orbitalEnergy
to doc
Definition WFreader.h:93
moleculeOrbital::data2
double data2
to doc and rename
Definition WFreader.h:89
moleculeOrbital::rank
unsigned int rank
to doc and rename
Definition WFreader.h:87
moleculeOrbital::occupancy
double occupancy
TO DOCUMENT.
Definition WFreader.h:91