Action_Thermostats
Add_AtomRandomPerturbation
Add_RotateAroundBondAction
Add_SelectAtomByNameAction
Adding_Graph_to_ChangeBondActions
Adding_MD_integration_tests
Adding_StructOpt_integration_tests
AutomationFragmentation_failures
Candidate_v1.6.0
Candidate_v1.6.1
ChangeBugEmailaddress
ChangingTestPorts
ChemicalSpaceEvaluator
Combining_Subpackages
Debian_Package_split
Debian_package_split_molecuildergui_only
Disabling_MemDebug
Docu_Python_wait
EmpiricalPotential_contain_HomologyGraph_documentation
Enable_parallel_make_install
Enhance_userguide
Enhanced_StructuralOptimization
Enhanced_StructuralOptimization_continued
Example_ManyWaysToTranslateAtom
Exclude_Hydrogens_annealWithBondGraph
FitPartialCharges_GlobalError
Fix_ChronosMutex
Fix_StatusMsg
Fix_StepWorldTime_single_argument
Fix_Verbose_Codepatterns
ForceAnnealing_goodresults
ForceAnnealing_oldresults
ForceAnnealing_tocheck
ForceAnnealing_with_BondGraph
ForceAnnealing_with_BondGraph_continued
ForceAnnealing_with_BondGraph_continued_betteresults
ForceAnnealing_with_BondGraph_contraction-expansion
GeometryObjects
Gui_displays_atomic_force_velocity
IndependentFragmentGrids_IntegrationTest
JobMarket_RobustOnKillsSegFaults
JobMarket_StableWorkerPool
JobMarket_unresolvable_hostname_fix
ODR_violation_mpqc_open
PartialCharges_OrthogonalSummation
PythonUI_with_named_parameters
QtGui_reactivate_TimeChanged_changes
Recreated_GuiChecks
RotateToPrincipalAxisSystem_UndoRedo
StoppableMakroAction
Subpackage_levmar
Subpackage_vmg
ThirdParty_MPQC_rebuilt_buildsystem
TremoloParser_IncreasedPrecision
TremoloParser_MultipleTimesteps
Ubuntu_1604_changes
stable
Line | |
---|
1 |
|
---|
2 | #ifdef __GNUG__
|
---|
3 | #pragma implementation
|
---|
4 | #endif
|
---|
5 |
|
---|
6 | #include <iostream>
|
---|
7 |
|
---|
8 | #include <util/misc/formio.h>
|
---|
9 | #include <chemistry/molecule/molecule.h>
|
---|
10 | #include <chemistry/molecule/atominfo.h>
|
---|
11 | #include <chemistry/qc/psi/psiexenv.h>
|
---|
12 | #include <chemistry/qc/psi/psifile11.h>
|
---|
13 |
|
---|
14 | using namespace std;
|
---|
15 |
|
---|
16 | namespace sc {
|
---|
17 |
|
---|
18 | PsiFile11::PsiFile11(const string& name) : file_()
|
---|
19 | {
|
---|
20 | filename_ = string(name);
|
---|
21 | }
|
---|
22 |
|
---|
23 | PsiFile11::~PsiFile11()
|
---|
24 | {
|
---|
25 | }
|
---|
26 |
|
---|
27 | void
|
---|
28 | PsiFile11::rewind()
|
---|
29 | {
|
---|
30 | file_.seekg(0,ios::beg);
|
---|
31 | }
|
---|
32 |
|
---|
33 | void
|
---|
34 | PsiFile11::skip_lines(int n)
|
---|
35 | {
|
---|
36 | // Lines in File11 are guaranteed to be 80 characters
|
---|
37 | char line[100];
|
---|
38 | for(int i=0; i<n; i++)
|
---|
39 | file_.getline(line,100);
|
---|
40 | }
|
---|
41 |
|
---|
42 | void
|
---|
43 | PsiFile11::skip_entry()
|
---|
44 | {
|
---|
45 | skip_lines(1);
|
---|
46 | int natom;
|
---|
47 | file_ >> natom;
|
---|
48 | double energy;
|
---|
49 | file_ >> energy;
|
---|
50 | skip_lines(2*natom);
|
---|
51 | }
|
---|
52 |
|
---|
53 | void
|
---|
54 | PsiFile11::open()
|
---|
55 | {
|
---|
56 | file_.open(filename_.c_str(),ios::in);
|
---|
57 | }
|
---|
58 |
|
---|
59 | void
|
---|
60 | PsiFile11::close()
|
---|
61 | {
|
---|
62 | if (!file_.is_open())
|
---|
63 | file_.close();
|
---|
64 | }
|
---|
65 |
|
---|
66 | void
|
---|
67 | PsiFile11::remove()
|
---|
68 | {
|
---|
69 | if (file_.is_open())
|
---|
70 | file_.close();
|
---|
71 | file_.open(filename_.c_str(),ios::out | ios::trunc);
|
---|
72 | file_.close();
|
---|
73 | }
|
---|
74 |
|
---|
75 | int
|
---|
76 | PsiFile11::get_natom(int entry)
|
---|
77 | {
|
---|
78 | skip_lines(1);
|
---|
79 |
|
---|
80 | int natom;
|
---|
81 | file_ >> natom;
|
---|
82 | rewind();
|
---|
83 | return natom;
|
---|
84 | }
|
---|
85 |
|
---|
86 | double
|
---|
87 | PsiFile11::get_energy(int entry)
|
---|
88 | {
|
---|
89 | skip_lines(1);
|
---|
90 |
|
---|
91 | int natom;
|
---|
92 | file_ >> natom;
|
---|
93 | double energy;
|
---|
94 | file_ >> energy;
|
---|
95 | rewind();
|
---|
96 | return energy;
|
---|
97 | }
|
---|
98 |
|
---|
99 | double
|
---|
100 | PsiFile11::get_coord(int entry, int atom, int xyz)
|
---|
101 | {
|
---|
102 | skip_lines(1);
|
---|
103 | int natom;
|
---|
104 | file_ >> natom;
|
---|
105 | if (natom <= atom)
|
---|
106 | abort();
|
---|
107 | double energy;
|
---|
108 | file_ >> energy;
|
---|
109 |
|
---|
110 | skip_lines(atom+1);
|
---|
111 | double charge;
|
---|
112 | file_ >> charge;
|
---|
113 | double trash;
|
---|
114 | for(int i=0; i<xyz; i++)
|
---|
115 | file_ >> trash;
|
---|
116 | double coord;
|
---|
117 | file_ >> coord;
|
---|
118 |
|
---|
119 | rewind();
|
---|
120 | return coord;
|
---|
121 | }
|
---|
122 |
|
---|
123 | double
|
---|
124 | PsiFile11::get_grad(int entry, int atom, int xyz)
|
---|
125 | {
|
---|
126 | skip_lines(1);
|
---|
127 | int natom;
|
---|
128 | file_ >> natom;
|
---|
129 | if (natom <= atom)
|
---|
130 | abort();
|
---|
131 | double energy;
|
---|
132 | file_ >> energy;
|
---|
133 |
|
---|
134 | skip_lines(natom+atom+1);
|
---|
135 | double trash;
|
---|
136 | for(int i=0; i<xyz; i++)
|
---|
137 | file_ >> trash;
|
---|
138 | double grad;
|
---|
139 | file_ >> grad;
|
---|
140 |
|
---|
141 | rewind();
|
---|
142 | return grad;
|
---|
143 | }
|
---|
144 |
|
---|
145 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.