Changeset a82602 for src/Jobs/VMGJob.cpp


Ignore:
Timestamp:
Dec 10, 2012, 10:10:59 AM (13 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, Candidate_v1.7.0, Candidate_v1.7.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
82cbe4
Parents:
5a5196
git-author:
Frederik Heber <heber@…> (09/12/12 15:23:13)
git-committer:
Frederik Heber <heber@…> (12/10/12 10:10:59)
Message:

InterfaceVMGJob now also calculates nuclei interaction energy.

  • necessiated to Particle::commMPI().
  • CommParticles() call in ImportRightHandSide().
  • in ExportSolution() we just copied stuff from interface_particles.cpp from VMG project.
  • returndata.e_long now contains calculated energy from there.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Jobs/VMGJob.cpp

    r5a5196 ra82602  
    6363//#include "solver/solver_regular.hpp"
    6464#include "solver/solver_singular.hpp"
    65 //#include "units/particle/comm_mpi_particle.hpp"
     65#include "units/particle/comm_mpi_particle.hpp"
    6666
    6767#include "CodePatterns/MemDebug.hpp"
     
    7171#include "LinearAlgebra/defs.hpp"
    7272#include "Jobs/InterfaceVMGJob.hpp"
     73
     74#include "CodePatterns/Assert.hpp"
    7375
    7476using namespace VMG;
     
    8587  particle_charges(_particle_charges),
    8688  near_field_cells(_near_field_cells),
    87   returndata(static_cast<const SamplingGridProperties &>(_density_grid))
     89  returndata(static_cast<const SamplingGridProperties &>(_density_grid)),
     90  num_particles(0),
     91  f(NULL),
     92  x(NULL),
     93  p(NULL),
     94  q(NULL)
    8895{}
    8996
    9097VMGJob::VMGJob() :
    9198  FragmentJob(JobId::IllegalJob),
    92   near_field_cells(5)
     99  near_field_cells(5),
     100  num_particles(0),
     101  f(NULL),
     102  x(NULL),
     103  p(NULL),
     104  q(NULL)
    93105{}
    94106
    95107VMGJob::~VMGJob()
    96 {}
     108{
     109  delete[] f;
     110  delete[] x;
     111  delete[] p;
     112  delete[] q;
     113}
     114
     115void VMGJob::InitVMGArrays()
     116{
     117  num_particles = particle_charges.size();
     118  f = new double[num_particles*3];
     119  x = new double[num_particles*3];
     120  p = new double[num_particles];
     121  q = new double[num_particles];
     122
     123  {
     124    size_t index=0;
     125    for (std::vector< std::vector< double > >::const_iterator iter = particle_positions.begin();
     126        iter != particle_positions.end(); ++iter) {
     127      for (std::vector< double >::const_iterator positer = (*iter).begin();
     128          positer != (*iter).end(); ++positer) {
     129        f[index] = 0.;
     130        x[index++] = *positer;
     131      }
     132    }
     133    ASSERT( index == num_particles*3,
     134        "VMGJob::VMGJob() - too many particles or components in particle_positions.");
     135  }
     136  {
     137    size_t index = 0;
     138    for (std::vector< double >::const_iterator iter = particle_charges.begin();
     139        iter != particle_charges.end(); ++iter) {
     140      p[index] = 0.;
     141      q[index++] = *iter;
     142    }
     143    ASSERT( index == num_particles,
     144        "VMGJob::VMGJob() - too many charges in particle_charges.");
     145  }
     146}
     147
    97148
    98149FragmentResult::ptr VMGJob::Work()
     
    137188   */
    138189#ifdef HAVE_MPI
    139   new CommMPI(boundary, new DomainDecompositionMPI());
     190  new Particle::CommMPI(boundary, new DomainDecompositionMPI());
    140191#else
    141192  new CommSerial(boundary);
     
    169220  new ObjectStorage<int>("PARTICLE_INTERPOLATION_DEGREE", 3);
    170221
     222  // first initialize f,x,p,q,... from STL vectors
     223  InitVMGArrays();
     224  // then initialize as objects with VMG's storage
     225  new ObjectStorage<vmg_float*>("PARTICLE_POS_ARRAY", x);
     226  new ObjectStorage<vmg_float*>("PARTICLE_CHARGE_ARRAY", q);
     227  new ObjectStorage<vmg_float*>("PARTICLE_POTENTIAL_ARRAY", p);
     228  new ObjectStorage<vmg_float*>("PARTICLE_FIELD_ARRAY", f);
     229  new ObjectStorage<vmg_int>("PARTICLE_NUM_LOCAL", num_particles);
     230
    171231  /*
    172232   * Post init
Note: See TracChangeset for help on using the changeset viewer.