source: ThirdParty/mpqc_open/src/lib/chemistry/cca/basis_cca_to_sc.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#include <iostream>
2#include <sstream>
3#include <iomanip>
4#include <chemistry/qc/basis/basis.h>
5#include <chemistry/molecule/atominfo.h>
6#include <Chemistry_QC_GaussianBasis_Molecular.hh>
7#include <Chemistry_Molecule.hh>
8
9using namespace std;
10using namespace sc;
11using namespace Chemistry;
12using namespace Chemistry::QC::GaussianBasis;
13
14Ref<GaussianBasisSet> basis_cca_to_sc( Molecular &cca_basis ) {
15
16 const char* am_to_symbol[] = {"s", "p", "d", "f", "g", "h", "i", "k", "l",
17 "m", "n", "o", "p", "q", "r", "s", "t", "u",
18 "v", "w", "x", "y", "z"};
19
20 //cca_basis.print_molecular();
21
22 Chemistry::Molecule cca_mol = cca_basis.get_molecule();
23
24 ostringstream input;
25
26 // form molecule keyval
27 double conv = cca_mol.get_units().convert_to("bohr");
28 input
29 << "molecule<Molecule>: (\n"
30 << " symmetry = auto\n"
31 << " unit = bohr\n"
32 << " {n atoms geometry } = {\n";
33 for( int i=0; i<cca_mol.get_n_atom(); ++i ) {
34 input << setprecision(16);
35 input << "\t" << i << "\t" << cca_mol.get_atomic_number(i)
36 << "\t[ " << cca_mol.get_cart_coor(i,0)*conv
37 << " " << cca_mol.get_cart_coor(i,1)*conv
38 << " " << cca_mol.get_cart_coor(i,2)*conv << " ]\n";
39 }
40 input << " }\n" << ")\n";
41
42 // form basis keyval
43 input.precision(18);
44 input << "scbasis<GaussianBasisSet>:(\n"
45 << " molecule = $:molecule\n"
46 << " basis = [";
47 for(int i=0; i<cca_mol.get_n_atom(); ++i)
48 input << " basis" << i;
49 input << " ]\n" << ")\n";
50
51 input << "basis:(\n";
52
53 // form atomic set for each individual center (possibly redundant)
54 // <atomname>: <basisname>: [
55 AtomInfo empty_info;
56 for(int i=0; i<cca_mol.get_n_atom(); ++i) {
57 Atomic atomic = cca_basis.get_atomic(i);
58 input << " " << empty_info.name( cca_mol.get_atomic_number(i) ) << ": "
59 << " basis" << i << ": [\n";
60
61 // form shells
62 for(int ishell=0; ishell<atomic.get_n_shell(); ++ishell) {
63 Shell shell = atomic.get_shell(ishell);
64 // (type: [ am = <symbol> ...]
65 input << " (normalized = 0\n";
66 //input << " (normalized = 1\n";
67 input << " type: [";
68 for(int icon=0; icon<shell.get_n_contraction(); ++icon) {
69 input << " (am = " << am_to_symbol[shell.get_angular_momentum(icon)];
70 if( shell.get_max_angular_momentum() > 1 ) {
71 if( shell.get_angular_type() == AngularType_CARTESIAN )
72 input << " puream = 0)";
73 else if( shell.get_angular_type() == AngularType_SPHERICAL )
74 input << " puream = 1)";
75 else if( shell.get_angular_type() == AngularType_MIXED )
76 std::cerr << " mixed angular types?";
77 }
78 else input << ")";
79 }
80 input << "]\n";
81 // {exp coef:<am> ...} = {
82 input << " {exp";
83 for(int icon=0; icon<shell.get_n_contraction(); ++icon)
84 input << " coef:" << icon;
85 input << "} = {\n";
86 // <exp> <coef> ...
87 for(int iprim=0; iprim<shell.get_n_primitive(); ++iprim) {
88 input << "\t" << shell.get_exponent(iprim);
89 for(int icon=0; icon<shell.get_n_contraction(); ++icon)
90 input << "\t" << shell.get_contraction_coef(icon, iprim);
91 input << endl;
92 }
93 input << "\n })\n";
94 }
95 input << " ]\n";
96 }
97 input << ")\n";
98
99 //cout << " basis input:\n" << input.str() << endl;
100
101 Ref<ParsedKeyVal> kv = new ParsedKeyVal();
102 kv->parse_string( input.str().c_str() );
103 Ref<DescribedClass> dc = kv->describedclassvalue("scbasis");
104 GaussianBasisSet *sc_basis =
105 dynamic_cast< GaussianBasisSet* >( dc.pointer() );
106
107 Ref<GaussianBasisSet> gbs;
108 gbs.assign_pointer(sc_basis);
109
110 //for(int i=0; i<gbs->nshell(); ++i)
111 // gbs->shell(i).print();
112
113 return gbs;
114}
Note: See TracBrowser for help on using the repository browser.