source: ThirdParty/mpqc_open/src/lib/chemistry/qc/intv3/store.cc@ bbc982

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
Last change on this file since bbc982 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: 3.6 KB
Line 
1//
2// store.cc
3//
4// Copyright (C) 1996 Limit Point Systems, Inc.
5//
6// Author: Curtis Janssen <cljanss@limitpt.com>
7// Maintainer: LPS
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 __GNUC__
29#pragma implementation
30#endif
31
32#include <stdlib.h>
33#include <chemistry/qc/intv3/macros.h>
34#include <chemistry/qc/intv3/flags.h>
35#include <chemistry/qc/intv3/types.h>
36
37#include <chemistry/qc/intv3/storage.h>
38#include <chemistry/qc/intv3/int2e.h>
39
40using namespace sc;
41
42void
43Int2eV3::init_storage(int size)
44{
45 storer = new IntegralStorer();
46 storer->init(size);
47 if (size) int_integral_storage = size;
48 else int_integral_storage = 0;
49}
50
51void
52Int2eV3::done_storage()
53{
54 if (storer.nonnull()) {
55 storer->done();
56 }
57 int_integral_storage = 0;
58}
59
60int
61Int2eV3::int_have_stored_integral(int sh1,int sh2,int sh3,int sh4,
62 int p12,int p34,int p13p24)
63{
64 IntegralKey key(sh1,sh2,sh3,sh4,p12,p34,p13p24);
65 IntegralLink *integral = storer->find(key);
66
67 if (!integral) return 0;
68
69#if PRINT_STORED
70 if (sh1 != integral->intlist.key.sh0()
71 ||sh2 != integral->intlist.key.sh1()
72 ||sh3 != integral->intlist.key.sh2()
73 ||sh4 != integral->intlist.key.sh3()
74 ||p12 != integral->intlist.key.p12()
75 ||p34 != integral->intlist.key.p34()
76 ||p13p24 != integral->intlist.key.p13p24()) {
77 ExEnv::outn() << scprintf("!!!!! SHELL INFO INCONSISTENCY\n");
78 abort();
79 }
80 ExEnv::outn() << scprintf("===== %d %d %d %d, %d %d %d size %5d cost %7d at 0x%x slot %5d\n",
81 sh1, sh2, sh3, sh4,
82 p12, p34, p13p24,
83 integral->size, integral->costlist.key,
84 integral, integral->hash()%storer->table_size());
85#endif
86
87 int i;
88 double *buffer = integral->buffer();
89 for (i=0; i<integral->size; i++) {
90 int_buffer[i] = buffer[i];
91 }
92
93 return 1;
94}
95
96void
97Int2eV3::int_store_integral(int sh1,int sh2,int sh3,int sh4,
98 int p12,int p34,int p13p24,
99 int size)
100{
101 // the cost of the integral is the time to evaluate it
102 // times the number of times it is needed
103 // divided by the amount of memory required to store it
104 int cost;
105 if (int_Qvec) cost = erep_4bound(sh1,sh2,sh3,sh4) + 30;
106 else cost = 1;
107 if (cost <= 0) return;
108 cost *= int_shell1->nprimitive()
109 * int_shell2->nprimitive()
110 * int_shell3->nprimitive()
111 * int_shell4->nprimitive()
112 * size
113 * 1024; // the 1024 is arbitrary
114 int actualsize = IntegralLink::size_to_actualsize(size);
115 cost /= actualsize;
116
117 if (storer->should_store(cost, actualsize)) {
118 IntegralKey key(sh1,sh2,sh3,sh4,p12,p34,p13p24);
119 storer->store(key,int_buffer,size,cost,actualsize);
120 }
121}
122
123/////////////////////////////////////////////////////////////////////////////
124
125// Local Variables:
126// mode: c++
127// c-file-style: "CLJ"
128// End:
Note: See TracBrowser for help on using the repository browser.