source: ThirdParty/mpqc_open/src/lib/chemistry/qc/mbptr12/mbptr12test.cc@ 860145

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests Automaking_mpqc_open 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_mpqc_open Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 860145 was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100644
File size: 4.4 KB
Line 
1//
2// mbptr12test.cc
3//
4// Copyright (C) Edward Valeev
5//
6// Author: Edward Valeev <edward.valeev@chemistry.gatech.edu>
7// Maintainer: EV
8//
9// This file is part of the SC Toolkit.
10//
11// The SC Toolkit is free software; you can redistribute it and/or modify
12// it under the terms of the GNU Library General Public License as published by
13// the Free Software Foundation; either version 2, or (at your option)
14// any later version.
15//
16// The SC Toolkit is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Library General Public License for more details.
20//
21// You should have received a copy of the GNU Library General Public License
22// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24//
25// The U.S. Government is granted a limited license as per AL 91-7.
26//
27
28#ifdef HAVE_CONFIG_H
29#include <scconfig.h>
30#endif
31
32#include <string.h>
33
34#include <sys/stat.h>
35#include <unistd.h>
36#include <new>
37
38#include <util/keyval/keyval.h>
39#include <util/group/message.h>
40#include <util/group/pregtime.h>
41#include <util/misc/bug.h>
42#include <util/misc/formio.h>
43#include <util/state/stateio.h>
44#include <util/state/state_bin.h>
45
46#include <math/scmat/repl.h>
47#include <math/scmat/dist.h>
48
49#include <chemistry/molecule/coor.h>
50#include <chemistry/molecule/energy.h>
51
52#include <chemistry/qc/scf/clhf.h>
53
54#include <chemistry/qc/mbptr12/mbptr12.h>
55
56using namespace std;
57using namespace sc;
58
59// Force linkages:
60#ifndef __PIC__
61static ForceLink<CLHF> fl0a;
62
63static ForceLink<MBPT2_R12> fl0e;
64
65static ForceLink<ReplSCMatrixKit> fl6;
66static ForceLink<DistSCMatrixKit> fl7;
67
68# ifdef HAVE_SYSV_IPC
69# include <util/group/messshm.h>
70 static ForceLink<ShmMessageGrp> fl8;
71# endif
72static ForceLink<ProcMessageGrp> fl9;
73# ifdef HAVE_NX_H
74# include <util/group/messpgon.h>
75 static ForceLink<ParagonMessageGrp> fl10;
76# endif
77#endif
78
79Ref<RegionTimer> tim;
80Ref<MessageGrp> grp;
81
82static Ref<MessageGrp>
83init_mp(const Ref<KeyVal>& keyval)
84{
85 // if we are on a paragon then use a ParagonMessageGrp
86 // otherwise read the message group from the input file
87 grp << keyval->describedclassvalue("message");
88
89 if (grp.nonnull()) MessageGrp::set_default_messagegrp(grp);
90 else grp = MessageGrp::get_default_messagegrp();
91
92 Ref<Debugger> debugger; debugger << keyval->describedclassvalue(":debug");
93 // Let the debugger know the name of the executable and the node
94 if (debugger.nonnull()) {
95 debugger->set_exec("mbptr12test");
96 debugger->set_prefix(grp->me());
97 debugger->debug("curt is a hog");
98 }
99
100 tim = new ParallelRegionTimer(grp,"mbptr12test",1,0);
101 RegionTimer::set_default_regiontimer(tim);
102
103 SCFormIO::set_printnode(0);
104 SCFormIO::init_mp(grp->me());
105 //SCFormIO::set_debug(1);
106
107 SCFormIO::setindent(ExEnv::out0(), 2);
108 SCFormIO::setindent(cerr, 2);
109
110 return grp;
111}
112
113main(int argc, char**argv)
114{
115 const char *input = (argc > 1)? argv[1] : SRCDIR "/mbptr12test.in";
116 const char *keyword = (argc > 2)? argv[2] : "mole";
117 const char *optkeyword = (argc > 3)? argv[3] : "opt";
118
119 // open keyval input
120 Ref<KeyVal> rpkv(new ParsedKeyVal(input));
121
122 init_mp(rpkv);
123
124 tim->enter("input");
125
126 if (rpkv->exists("matrixkit")) {
127 Ref<SCMatrixKit> kit; kit << rpkv->describedclassvalue("matrixkit");
128 SCMatrixKit::set_default_matrixkit(kit);
129 }
130
131 struct stat sb;
132 Ref<MolecularEnergy> mole;
133
134 if (stat("mbptr12test.ckpt",&sb)==0 && sb.st_size) {
135 StateInBin si("mbptr12test.ckpt");
136 // opt << SavableState::restore_state(si);
137 // mole << opt->function();
138 } else {
139 mole << rpkv->describedclassvalue(keyword);
140 }
141
142 tim->exit("input");
143
144 if (mole.nonnull()) {
145 ExEnv::out0() << indent << "energy: " << mole->energy() << endl;
146 if (mole->value_implemented()) {
147 ExEnv::out0() << indent
148 << scprintf("value of mole is %20.15f\n\n", mole->energy());
149 }
150
151 mole->print(ExEnv::out0());
152 }
153
154 StateOutBin so("mbptr12test.wfn");
155 SavableState::save_state(mole.pointer(),so);
156
157 tim->print(ExEnv::out0());
158
159 tim = 0;
160 grp = 0;
161 RegionTimer::set_default_regiontimer(0);
162 MessageGrp::set_default_messagegrp(0);
163
164 return 0;
165}
166
167/////////////////////////////////////////////////////////////////////////////
168
169// Local Variables:
170// mode: c++
171// c-file-style: "CLJ-CONDENSED"
172// End:
Note: See TracBrowser for help on using the repository browser.