コード例 #1
0
ファイル: input.cpp プロジェクト: bvrstich/linmol
/**
 * Copy constructor for the input class
 * @param lisa the input to be copied
 */
input::input(input & lisa){

   initelements();
   Charge = lisa.gCharge();
   RotationSymm = lisa.gRotationSymm();
   basisset = lisa.gbasisset();
   Ncores = lisa.gNcores();
   cores = new int[Ncores];
   vectors = new R*[Ncores];
   GaussInfo = new Gauss*[Ncores];
   for (int cnt=0; cnt<Ncores; cnt++){
      cores[cnt] = lisa.gcore(cnt);
      vectors[cnt] = new R(*(lisa.gvector(cnt)));
      GaussInfo[cnt] = new Gauss(*(lisa.gGaussInfo(cnt)));
   }

}
コード例 #2
0
ファイル: MxElem.cpp プロジェクト: wpoely86/ThING
/**
 * Calculate the nuclear-nuclear potential energy of a problem
 * @param problem the problem to be solved
 */
double MxElem::NuclPotEn(input & problem){

   double energy = 0;
   int Ncores = problem.gNcores();

   for (int i=0; i<Ncores; i++){

      R Ri(*(problem.gvector(i)));
      int Zi = problem.gcore(i);

      for (int j=i+1; j<Ncores; j++){

         energy += Zi * problem.gcore(j) / sqrt(Ri.DistanceSquared(*(problem.gvector(j))));
      }
   }

   return energy;

}
コード例 #3
0
ファイル: MxElem.cpp プロジェクト: wpoely86/ThING
/**
 * Function to find the total number of orbitals corresponding to a problem
 * @param readin the problem to be solved
 * @return the number of different orbitals
 */
int MxElem::CalcTotalNumberOfOrbitals(input & readin){

   int counter = 0;
   int Ncores = readin.gNcores();

   for (int cnt=0; cnt<Ncores; cnt++){

      Gauss * atom = readin.gGaussInfo(cnt);
      int Ntypes = atom->gNtypes();
      
      for (int cnt2=0; cnt2<Ntypes; cnt2++){

         char type = atom->gtype(cnt2);
         int L = GetLofType(type);
         counter += ((L+1)*(L+2))/2;

      }

   }

   return counter;

}
コード例 #4
0
ファイル: MxElem.cpp プロジェクト: wpoely86/ThING
/**
 * Initialise the matrix elements
 * @param readin the problem to be solved
 */
void MxElem::Init(input & readin){

   MxElemFiller filler(readin);
   int count1, count2, count3, count4, start, start2, start3;
   double OneBodyElement;

   count1 = -1;

   for (int i=0; i<readin.gNcores(); i++){
      Gauss * first = readin.gGaussInfo(i);

      for (int k=0; k<(first->gNtypes()); k++){
         int L1 = GetLofType(first->gtype(k));

         // loop over different [n1x,n1y,n1z] contributions with n1x+n1y+n1z=L1;
         for (int n1x=L1; n1x>=0; n1x--){
            for (int n1y=L1-n1x; n1y>=0; n1y--){
               int n1z = L1-n1x-n1y;
               count1++;

               count2 = -1;

               for (int j=i; j<readin.gNcores(); j++){
                  Gauss * second = readin.gGaussInfo(j);
                  start = 0;
                  if (i==j) start=k;

                  for (int l=start; l<(second->gNtypes()); l++){
                     int L2 = GetLofType(second->gtype(l));

                     // loop over different [n2x,n2y,n2z] contributions with n2x+n2y+n2z=L2;
                     for (int n2x=L2; n2x>=0; n2x--){
                        for (int n2y=L2-n2x; n2y>=0; n2y--){
                           int n2z = L2-n2x-n2y;

                           if ((i==j)&&(l==k)){
                              if (n2x>n1x){
                                 n2x=n1x;
                                 n2y=n1y;
                                 n2z=n1z;
                              } else {
                                 if (n2x==n1x){
                                    if (n2y>n1y){
                                       n2y=n1y;
                                       n2z=n1z;
                                    }
                                 }
                              }
                           }

                           count2++;
                           //If they're centered on the same atom and n1i+n2i odd for i=x,y or z -> Overlap & KE 0.0
                           if ((i==j)&&((((n1x+n2x)%2)!=0)||(((n1y+n2y)%2)!=0)||(((n1z+n2z)%2)!=0))){
                              setSoverlap(count1,count1+count2,0.0);
                              setKEseparate(count1,count1+count2,0.0);
                              OneBodyElement = 0.0;
                           } else {
                              setSoverlap(count1,count1+count2,filler.Overlap(i,k,n1x,n1y,n1z,j,l,n2x,n2y,n2z));
                              OneBodyElement = filler.KE(i,k,n1x,n1y,n1z,j,l,n2x,n2y,n2z);
                              setKEseparate(count1,count1+count2,OneBodyElement);
                           }
                           
                           for (int Ncore=0; Ncore<readin.gNcores(); Ncore++)
                              OneBodyElement += filler.ElNucl(i,k,n1x,n1y,n1z,j,l,n2x,n2y,n2z,Ncore);

                           setTelem(count1,count1+count2,OneBodyElement);

                           count3 = -1;

                           for (int m=i; m<readin.gNcores(); m++){
                              Gauss * third = readin.gGaussInfo(m);
                              start2 = 0;
                              if (i==m) start2=k;

                              for (int n=start2; n<(third->gNtypes()); n++){
                                 int L3 = GetLofType(third->gtype(n));
                                 for (int n3x=L3; n3x>=0; n3x--){
                                    for (int n3y=L3-n3x; n3y>=0; n3y--){
                                       int n3z = L3-n3x-n3y;

                                       if ((i==m)&&(n==k)){
                                          if (n3x>n1x){
                                             n3x=n1x;
                                             n3y=n1y;
                                             n3z=n1z;
                                          } else {
                                             if (n3x==n1x){
                                                if (n3y>n1y){
                                                   n3y=n1y;
                                                   n3z=n1z;
                                                }
                                             }
                                          }
                                       }

                                       count3++;

                                       count4 = -1;
                                       for (int o=j; o<readin.gNcores(); o++){
                                          Gauss * fourth = readin.gGaussInfo(o);
                                          start3 = 0;
                                          if (j==o) start3=l;

                                          for (int p=start3; p<(fourth->gNtypes()); p++){
                                             int L4 = GetLofType(fourth->gtype(p));
                                             for (int n4x=L4; n4x>=0; n4x--){
                                                for (int n4y=L4-n4x; n4y>=0; n4y--){
                                                   int n4z = L4-n4x-n4y;

                                                   if ((j==o)&&(p==l)){
                                                      if (n4x>n2x){
                                                         n4x=n2x;
                                                         n4y=n2y;
                                                         n4z=n2z;
                                                      } else {
                                                         if (n4x==n2x){
                                                            if (n4y>n2y){
                                                               n4y=n2y;
                                                               n4z=n2z;
                                                            }
                                                         }
                                                      }
                                                   }

                                                   count4++;

                                                   //alpha=(i,k,1) beta=(j,l,2) gamma=(m,n,3) delta=(o,p,4)
                                                   //(alpha beta|V|gamma delta) = (alpha gamma beta delta) in MxElemFiller!!
                                                   setVelem(count1, count1+count2, count1+count3, count1+count2+count4, filler.ElEl(i,k,n1x,n1y,n1z,m,n,n3x,n3y,n3z,j,l,n2x,n2y,n2z,o,p,n4x,n4y,n4z));
                                                }
                                             }
                                          }
                                       }
                                    }
                                 }
                              }
                           }
                        }
                     }
                  }
               }
            }
         }
      }
   }

}