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
69typedef struct centerData
70 {
72 std::string* element;
74 unsigned int value;
76 unsigned int rank;
78 double coordinates[3];
80 double charge;
82
84typedef struct moleculeOrbital
85 {
87 unsigned int rank;
89 double data2;
91 double occupancy;
95 double* coefficients;
97
103void wf_load_file(const std::string & fileName, const bool verbose=false);
104
110void wfn_load_file(std::ifstream & inputFile, const bool verbose=false);
111
117void wfn_read_GAUSSIAN_line(const std::string & line, const bool verbose=false);
118
124void wfn_read_center_data(std::ifstream & inputFile, const bool verbose=false);
125
131void wfn_read_primitive_centers(std::ifstream & inputFile, const bool verbose=false);
132
138void wfn_read_primitive_types(std::ifstream & inputFile, const bool verbose=false);
139
145void wfn_read_exponents(std::ifstream & inputFile, const bool verbose=false);
146
152void wfn_read_molecule_orbitals(std::ifstream & inputFile, const bool verbose=false);
153
159void wfn_read_total_energy_and_virial(std::ifstream & inputFile, const bool verbose=false);
160
165void wfn_fromFortranRealToCppReal(std::string & line);
166
171
172
178void wfx_load_file(std::ifstream & inputFile, const bool verbose=false);
179
183void wfx_init();
184
190void wfx_read_data(std::ifstream & inputFile, const bool verbose=false);
191
192
196void wf_cleaning(const bool verbose=false);
197
198
204
209unsigned int wf_number_of_orbitals();
210
215unsigned int wf_number_of_primitives();
216
221unsigned int wf_number_of_nuclei();
222
227unsigned int* wf_user2ADF_atomOrder();
228
233unsigned int* wf_ADF2user_atomOrder();
234
235
241
246unsigned int* wf_primitive_centers();
247
252unsigned int* wf_primitive_types();
253
258double* wf_primitive_exponents();
259
264int wf_netCharge();
265
269void wf_setNetCharge(int value);
270
275std::vector<moleculeOrbital>
277
282bool
284
288void wf_allocateMemory();
289
294
298void wf_printMO();
299
304
309
314
318void wf_printCenterData();
319
327template <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
346template <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
386bool isDouble(std::string text);
387
388
394double toDouble(std::string text);
395
396
397/********************************************************************************
398 * For RKF reading *
399 ********************************************************************************/
400
401void load_rkf_file(const std::string & fileName);
402
403void rkf_load_nbNuclei(KFFile* kf);
404
405void rkf_load_data(KFFile* kf, const char *filename);
406
411unsigned int* wf_primitive_krs();
412
413
414#endif
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
double toDouble(std::string text)
Function converting a string to a double.
Definition WFreader.cpp:1692
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
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
void loadInputFileData(std::ifstream &inputFile, T *data, unsigned int nbData)
Template Tool procedure to load the data from an inputFile.
Definition WFreader.h:327
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
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
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
void wf_printGlobalBounds()
Tool procedure to print 3 importants values : the number of nuclei, of primitives and molecular orbit...
Definition WFreader.cpp:1624
void wfn_printTotalEnergyAndVirial()
Tool procedure to print the total energy and virial (only use with WFN reading for the moment.
Definition WFreader.cpp:1635
bool isDouble(std::string text)
Function checking if a string is a number.
Definition WFreader.cpp:1678
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)
int wf_netCharge()
Tool function which returns the net charge of the whole system (if a file is loaded)
Definition WFreader.cpp:988
void wf_printMO()
Tool procedure to print molecular orbitals information.
Definition WFreader.cpp:1528
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
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
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
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
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
void wf_load_file(const std::string &fileName, const bool verbose=false)
Tool function which read the corresponding file.
Definition WFreader.cpp:622
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
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
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
void wf_allocateMemory()
Tool procedure to allocate the memory for the array linked to the number of nuclei,...
Definition WFreader.cpp:131
bool wf_file_already_loaded()
Tool function which allows to know if a file has already loaded.
Definition WFreader.cpp:876
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
void wfn_load_file(std::ifstream &inputFile, const bool verbose=false)
Tool function which load the corresponding wfn file.
Definition WFreader.cpp:553
void wfx_load_file(std::ifstream &inputFile, const bool verbose=false)
Tool function which load the corresponding wfx file.
Definition WFreader.cpp:1053
void wf_printPrimitiveTypes()
Tool procedure to print the primitive types.
Definition WFreader.cpp:1569
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
void wf_printPrimitiveExponents()
Tool procedure to print the primitive exponents.
Definition WFreader.cpp:1583
void wfx_init()
Tool procedure to initialize some stuff for wfx reading.
Definition WFreader.cpp:1197
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
double * wf_primitive_exponents()
Tool function which allows to gain access to all the exponents (if a file is loaded)
Definition WFreader.cpp:978
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
void wf_printPrimitiveCenters()
Tool procedure to print the primitive centers.
Definition WFreader.cpp:1555
void wf_printCenterData()
Tool procedure to print the center data.
Definition WFreader.cpp:1597
void wf_cleaning(const bool verbose=false)
Tool function which frees all the allocated memory.
Definition WFreader.cpp:732
bool wf_molecular_orbitals_sort()
Tool function which sort the MOs by ascending order of energy.
Definition WFreader.cpp:1032
all data types and constant data needed by the rest of the program
structure to save center data
Definition WFreader.h:70
unsigned int rank
to doc
Definition WFreader.h:76
unsigned int value
to doc and rename
Definition WFreader.h:74
double coordinates[3]
coordinates to doc and rename
Definition WFreader.h:78
double charge
to doc
Definition WFreader.h:80
std::string * element
The atomic element, using a string for easing the use.
Definition WFreader.h:72
structure to save molecule orbital data
Definition WFreader.h:85
double * coefficients
Primites coefficient for one molecular orbital.
Definition WFreader.h:95
double orbitalEnergy
to doc
Definition WFreader.h:93
double data2
to doc and rename
Definition WFreader.h:89
unsigned int rank
to doc and rename
Definition WFreader.h:87
double occupancy
TO DOCUMENT.
Definition WFreader.h:91