Open RudolfWeeber opened 1 year ago
Please assign not only the center of mass position/velocity to the virtual site, but also the total mass of the non-virtual particles making up the object
the backtransfer funciton should do the follow
If the partice's molid is in m_vs_pid_for_mol_id map:
Add a new virtual site class in src/script_interface/virtual_sites. Look for VirtualStiesRelative in the script interface and use as template
@jngrad Where can an exammple for the script interface stuff for the std::map<int,int> be stolen?
Goal
Design choices
mol_id
particle property is used to distinguish between the different objects/molecules(mol_id, virtual_stie_particle_id)
pairs is stored in the class implementing the algorithm. Obtaining this informaiton on the fly would require a second pass over the particles and a global communication.The center of mass is calculated using unfolded positions. I.e. if the user creates a
molecule
wrapping across the periodic boundaries, they need to make sure to set this correctly:p1.pos = syste.box_l-dx; p2.pos= system.box_l +dx
rather thanp2.pos=dx/2
Steps
Core class
src/core/virtual_sites/VirtualSitesCenterOfMass.cpp/hpp
std::map<int,int> m_vs_pid_for_mol_mid
implement
void VirtualSitesCenterOfMass::update()
m_vs_pid_by_mol_id
Loop over all particles
cell_sturcuter().local_particles()
com_by_mol_id
map, add itts mass to teComInfo::total_mass
and the UNFOLDED position times mass to theiwieghted_sum
loop over all
(mol_id, ComINfo)
pairswieghed_sum/total_mass
m_vs_pid_by_mol_id
mapcell_srucutre().get_local_particle()
nullptr
is returend, through (will have to e be changed in a parlallel implementation)box_geo.fold_position()
VirtualStiesCenterOfMass::backtransfer_forces_and_torques()
funciont to be contineud