📄 psifile11.cc
字号:
#ifdef __GNUG__#pragma implementation#endif#include <iostream>#include <util/misc/formio.h>#include <chemistry/molecule/molecule.h>#include <chemistry/molecule/atominfo.h>#include <chemistry/qc/psi/psiexenv.h>#include <chemistry/qc/psi/psifile11.h>using namespace std;namespace sc {PsiFile11::PsiFile11(const string& name) : file_(){ filename_ = string(name);}PsiFile11::~PsiFile11(){}voidPsiFile11::rewind(){ file_.seekg(0,ios::beg);}voidPsiFile11::skip_lines(int n){ // Lines in File11 are guaranteed to be 80 characters char line[100]; for(int i=0; i<n; i++) file_.getline(line,100);}voidPsiFile11::skip_entry(){ skip_lines(1); int natom; file_ >> natom; double energy; file_ >> energy; skip_lines(2*natom);}voidPsiFile11::open(){ file_.open(filename_.c_str(),ios::in);}voidPsiFile11::close(){ if (!file_.is_open()) file_.close();}voidPsiFile11::remove(){ if (file_.is_open()) file_.close(); file_.open(filename_.c_str(),ios::out | ios::trunc); file_.close();}intPsiFile11::get_natom(int entry){ skip_lines(1); int natom; file_ >> natom; rewind(); return natom;}doublePsiFile11::get_energy(int entry){ skip_lines(1); int natom; file_ >> natom; double energy; file_ >> energy; rewind(); return energy;}doublePsiFile11::get_coord(int entry, int atom, int xyz){ skip_lines(1); int natom; file_ >> natom; if (natom <= atom) abort(); double energy; file_ >> energy; skip_lines(atom+1); double charge; file_ >> charge; double trash; for(int i=0; i<xyz; i++) file_ >> trash; double coord; file_ >> coord; rewind(); return coord;}doublePsiFile11::get_grad(int entry, int atom, int xyz){ skip_lines(1); int natom; file_ >> natom; if (natom <= atom) abort(); double energy; file_ >> energy; skip_lines(natom+atom+1); double trash; for(int i=0; i<xyz; i++) file_ >> trash; double grad; file_ >> grad; rewind(); return grad;}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -