Tree @debian/0_20161109.git9806da6-6 (Download .tar.gz)
- ..
- ASPHERE
- BODY
- CLASS2
- COLLOID
- COMPRESS
- CORESHELL
- DEPEND
- DIPOLE
- GPU
- GRANULAR
- KIM
- KOKKOS
- KSPACE
- MAKE
- MANYBODY
- MC
- MEAM
- MISC
- MOLECULE
- MPIIO
- OPT
- PERI
- POEMS
- PYTHON
- QEQ
- REAX
- REPLICA
- RIGID
- SHOCK
- SNAP
- SRD
- STUBS
- USER-ATC
- USER-AWPMD
- USER-CG-CMM
- USER-COLVARS
- USER-DIFFRACTION
- USER-DPD
- USER-DRUDE
- USER-EFF
- USER-FEP
- USER-H5MD
- USER-INTEL
- USER-LB
- USER-MANIFOLD
- USER-MGPT
- USER-MISC
- USER-MOLFILE
- USER-NC-DUMP
- USER-OMP
- USER-PHONON
- USER-QMMM
- USER-QTB
- USER-QUIP
- USER-REAXC
- USER-SMD
- USER-SMTBQ
- USER-SPH
- USER-TALLY
- USER-VTK
- VORONOI
- accelerator_intel.h
- accelerator_kokkos.h
- accelerator_omp.h
- angle.cpp
- angle.h
- angle_hybrid.cpp
- angle_hybrid.h
- angle_zero.cpp
- angle_zero.h
- atom.cpp
- atom.h
- atom_map.cpp
- atom_masks.h
- atom_vec.cpp
- atom_vec.h
- atom_vec_atomic.cpp
- atom_vec_atomic.h
- atom_vec_body.cpp
- atom_vec_body.h
- atom_vec_charge.cpp
- atom_vec_charge.h
- atom_vec_ellipsoid.cpp
- atom_vec_ellipsoid.h
- atom_vec_hybrid.cpp
- atom_vec_hybrid.h
- atom_vec_line.cpp
- atom_vec_line.h
- atom_vec_sphere.cpp
- atom_vec_sphere.h
- atom_vec_tri.cpp
- atom_vec_tri.h
- balance.cpp
- balance.h
- body.cpp
- body.h
- bond.cpp
- bond.h
- bond_hybrid.cpp
- bond_hybrid.h
- bond_zero.cpp
- bond_zero.h
- change_box.cpp
- change_box.h
- citeme.cpp
- citeme.h
- comm.cpp
- comm.h
- comm_brick.cpp
- comm_brick.h
- comm_tiled.cpp
- comm_tiled.h
- compute.cpp
- compute.h
- compute_angle.cpp
- compute_angle.h
- compute_angle_local.cpp
- compute_angle_local.h
- compute_angmom_chunk.cpp
- compute_angmom_chunk.h
- compute_bond.cpp
- compute_bond.h
- compute_bond_local.cpp
- compute_bond_local.h
- compute_centro_atom.cpp
- compute_centro_atom.h
- compute_chunk_atom.cpp
- compute_chunk_atom.h
- compute_cluster_atom.cpp
- compute_cluster_atom.h
- compute_cna_atom.cpp
- compute_cna_atom.h
- compute_com.cpp
- compute_com.h
- compute_com_chunk.cpp
- compute_com_chunk.h
- compute_contact_atom.cpp
- compute_contact_atom.h
- compute_coord_atom.cpp
- compute_coord_atom.h
- compute_dihedral.cpp
- compute_dihedral.h
- compute_dihedral_local.cpp
- compute_dihedral_local.h
- compute_dipole_chunk.cpp
- compute_dipole_chunk.h
- compute_displace_atom.cpp
- compute_displace_atom.h
- compute_erotate_sphere.cpp
- compute_erotate_sphere.h
- compute_erotate_sphere_atom.cpp
- compute_erotate_sphere_atom.h
- compute_group_group.cpp
- compute_group_group.h
- compute_gyration.cpp
- compute_gyration.h
- compute_gyration_chunk.cpp
- compute_gyration_chunk.h
- compute_heat_flux.cpp
- compute_heat_flux.h
- compute_hexorder_atom.cpp
- compute_hexorder_atom.h
- compute_improper.cpp
- compute_improper.h
- compute_improper_local.cpp
- compute_improper_local.h
- compute_inertia_chunk.cpp
- compute_inertia_chunk.h
- compute_ke.cpp
- compute_ke.h
- compute_ke_atom.cpp
- compute_ke_atom.h
- compute_msd.cpp
- compute_msd.h
- compute_msd_chunk.cpp
- compute_msd_chunk.h
- compute_omega_chunk.cpp
- compute_omega_chunk.h
- compute_orientorder_atom.cpp
- compute_orientorder_atom.h
- compute_pair.cpp
- compute_pair.h
- compute_pair_local.cpp
- compute_pair_local.h
- compute_pe.cpp
- compute_pe.h
- compute_pe_atom.cpp
- compute_pe_atom.h
- compute_pressure.cpp
- compute_pressure.h
- compute_property_atom.cpp
- compute_property_atom.h
- compute_property_chunk.cpp
- compute_property_chunk.h
- compute_property_local.cpp
- compute_property_local.h
- compute_rdf.cpp
- compute_rdf.h
- compute_reduce.cpp
- compute_reduce.h
- compute_reduce_region.cpp
- compute_reduce_region.h
- compute_slice.cpp
- compute_slice.h
- compute_stress_atom.cpp
- compute_stress_atom.h
- compute_temp.cpp
- compute_temp.h
- compute_temp_chunk.cpp
- compute_temp_chunk.h
- compute_temp_com.cpp
- compute_temp_com.h
- compute_temp_deform.cpp
- compute_temp_deform.h
- compute_temp_partial.cpp
- compute_temp_partial.h
- compute_temp_profile.cpp
- compute_temp_profile.h
- compute_temp_ramp.cpp
- compute_temp_ramp.h
- compute_temp_region.cpp
- compute_temp_region.h
- compute_temp_sphere.cpp
- compute_temp_sphere.h
- compute_torque_chunk.cpp
- compute_torque_chunk.h
- compute_vacf.cpp
- compute_vacf.h
- compute_vcm_chunk.cpp
- compute_vcm_chunk.h
- create_atoms.cpp
- create_atoms.h
- create_bonds.cpp
- create_bonds.h
- create_box.cpp
- create_box.h
- delete_atoms.cpp
- delete_atoms.h
- delete_bonds.cpp
- delete_bonds.h
- Depend.sh
- dihedral.cpp
- dihedral.h
- dihedral_hybrid.cpp
- dihedral_hybrid.h
- dihedral_zero.cpp
- dihedral_zero.h
- displace_atoms.cpp
- displace_atoms.h
- domain.cpp
- domain.h
- dump.cpp
- dump.h
- dump_atom.cpp
- dump_atom.h
- dump_cfg.cpp
- dump_cfg.h
- dump_custom.cpp
- dump_custom.h
- dump_dcd.cpp
- dump_dcd.h
- dump_image.cpp
- dump_image.h
- dump_local.cpp
- dump_local.h
- dump_movie.cpp
- dump_movie.h
- dump_xyz.cpp
- dump_xyz.h
- error.cpp
- error.h
- exceptions.h
- finish.cpp
- finish.h
- fix.cpp
- fix.h
- fix_adapt.cpp
- fix_adapt.h
- fix_addforce.cpp
- fix_addforce.h
- fix_ave_atom.cpp
- fix_ave_atom.h
- fix_ave_chunk.cpp
- fix_ave_chunk.h
- fix_ave_correlate.cpp
- fix_ave_correlate.h
- fix_ave_histo.cpp
- fix_ave_histo.h
- fix_ave_histo_weight.cpp
- fix_ave_histo_weight.h
- fix_ave_time.cpp
- fix_ave_time.h
- fix_aveforce.cpp
- fix_aveforce.h
- fix_balance.cpp
- fix_balance.h
- fix_box_relax.cpp
- fix_box_relax.h
- fix_controller.cpp
- fix_controller.h
- fix_deform.cpp
- fix_deform.h
- fix_deprecated.cpp
- fix_deprecated.h
- fix_drag.cpp
- fix_drag.h
- fix_dt_reset.cpp
- fix_dt_reset.h
- fix_enforce2d.cpp
- fix_enforce2d.h
- fix_external.cpp
- fix_external.h
- fix_gravity.cpp
- fix_gravity.h
- fix_group.cpp
- fix_group.h
- fix_halt.cpp
- fix_halt.h
- fix_heat.cpp
- fix_heat.h
- fix_indent.cpp
- fix_indent.h
- fix_langevin.cpp
- fix_langevin.h
- fix_lineforce.cpp
- fix_lineforce.h
- fix_minimize.cpp
- fix_minimize.h
- fix_momentum.cpp
- fix_momentum.h
- fix_move.cpp
- fix_move.h
- fix_nh.cpp
- fix_nh.h
- fix_nh_sphere.cpp
- fix_nh_sphere.h
- fix_nph.cpp
- fix_nph.h
- fix_nph_sphere.cpp
- fix_nph_sphere.h
- fix_npt.cpp
- fix_npt.h
- fix_npt_sphere.cpp
- fix_npt_sphere.h
- fix_nve.cpp
- fix_nve.h
- fix_nve_limit.cpp
- fix_nve_limit.h
- fix_nve_noforce.cpp
- fix_nve_noforce.h
- fix_nve_sphere.cpp
- fix_nve_sphere.h
- fix_nvt.cpp
- fix_nvt.h
- fix_nvt_sllod.cpp
- fix_nvt_sllod.h
- fix_nvt_sphere.cpp
- fix_nvt_sphere.h
- fix_planeforce.cpp
- fix_planeforce.h
- fix_press_berendsen.cpp
- fix_press_berendsen.h
- fix_print.cpp
- fix_print.h
- fix_property_atom.cpp
- fix_property_atom.h
- fix_read_restart.cpp
- fix_read_restart.h
- fix_recenter.cpp
- fix_recenter.h
- fix_respa.cpp
- fix_respa.h
- fix_restrain.cpp
- fix_restrain.h
- fix_setforce.cpp
- fix_setforce.h
- fix_shear_history.cpp
- fix_shear_history.h
- fix_spring.cpp
- fix_spring.h
- fix_spring_chunk.cpp
- fix_spring_chunk.h
- fix_spring_rg.cpp
- fix_spring_rg.h
- fix_spring_self.cpp
- fix_spring_self.h
- fix_store.cpp
- fix_store.h
- fix_store_force.cpp
- fix_store_force.h
- fix_store_state.cpp
- fix_store_state.h
- fix_temp_berendsen.cpp
- fix_temp_berendsen.h
- fix_temp_csld.cpp
- fix_temp_csld.h
- fix_temp_csvr.cpp
- fix_temp_csvr.h
- fix_temp_rescale.cpp
- fix_temp_rescale.h
- fix_tmd.cpp
- fix_tmd.h
- fix_vector.cpp
- fix_vector.h
- fix_viscous.cpp
- fix_viscous.h
- fix_wall.cpp
- fix_wall.h
- fix_wall_harmonic.cpp
- fix_wall_harmonic.h
- fix_wall_lj1043.cpp
- fix_wall_lj1043.h
- fix_wall_lj126.cpp
- fix_wall_lj126.h
- fix_wall_lj93.cpp
- fix_wall_lj93.h
- fix_wall_reflect.cpp
- fix_wall_reflect.h
- fix_wall_region.cpp
- fix_wall_region.h
- force.cpp
- force.h
- group.cpp
- group.h
- image.cpp
- image.h
- imbalance.cpp
- imbalance.h
- imbalance_group.cpp
- imbalance_group.h
- imbalance_neigh.cpp
- imbalance_neigh.h
- imbalance_store.cpp
- imbalance_store.h
- imbalance_time.cpp
- imbalance_time.h
- imbalance_var.cpp
- imbalance_var.h
- improper.cpp
- improper.h
- improper_hybrid.cpp
- improper_hybrid.h
- improper_zero.cpp
- improper_zero.h
- info.cpp
- info.h
- input.cpp
- input.h
- Install.sh
- integrate.cpp
- integrate.h
- irregular.cpp
- irregular.h
- kspace.cpp
- kspace.h
- lammps.cpp
- lammps.h
- lattice.cpp
- lattice.h
- library.cpp
- library.h
- lmptype.h
- lmpwindows.h
- main.cpp
- Make.py
- Make.sh
- Makefile
- Makefile.list
- Makefile.package.empty
- Makefile.package.settings.empty
- math_complex.h
- math_const.h
- math_extra.cpp
- math_extra.h
- math_special.cpp
- math_special.h
- math_vector.h
- memory.cpp
- memory.h
- min.cpp
- min.h
- min_cg.cpp
- min_cg.h
- min_fire.cpp
- min_fire.h
- min_hftn.cpp
- min_hftn.h
- min_linesearch.cpp
- min_linesearch.h
- min_quickmin.cpp
- min_quickmin.h
- min_sd.cpp
- min_sd.h
- minimize.cpp
- minimize.h
- modify.cpp
- modify.h
- molecule.cpp
- molecule.h
- mpiio.h
- my_page.h
- my_pool_chunk.h
- neigh_bond.cpp
- neigh_bond.h
- neigh_derive.cpp
- neigh_derive.h
- neigh_full.cpp
- neigh_full.h
- neigh_gran.cpp
- neigh_gran.h
- neigh_half_bin.cpp
- neigh_half_bin.h
- neigh_half_multi.cpp
- neigh_half_multi.h
- neigh_half_nsq.cpp
- neigh_half_nsq.h
- neigh_list.cpp
- neigh_list.h
- neigh_request.cpp
- neigh_request.h
- neigh_respa.cpp
- neigh_respa.h
- neigh_shardlow.cpp
- neigh_shardlow.h
- neigh_stencil.cpp
- neighbor.cpp
- neighbor.h
- output.cpp
- output.h
- pack.h
- Package.sh
- pair.cpp
- pair.h
- pair_beck.cpp
- pair_beck.h
- pair_born.cpp
- pair_born.h
- pair_born_coul_dsf.cpp
- pair_born_coul_dsf.h
- pair_born_coul_wolf.cpp
- pair_born_coul_wolf.h
- pair_buck.cpp
- pair_buck.h
- pair_buck_coul_cut.cpp
- pair_buck_coul_cut.h
- pair_coul_cut.cpp
- pair_coul_cut.h
- pair_coul_debye.cpp
- pair_coul_debye.h
- pair_coul_dsf.cpp
- pair_coul_dsf.h
- pair_coul_streitz.cpp
- pair_coul_streitz.h
- pair_coul_wolf.cpp
- pair_coul_wolf.h
- pair_dpd.cpp
- pair_dpd.h
- pair_dpd_tstat.cpp
- pair_dpd_tstat.h
- pair_gauss.cpp
- pair_gauss.h
- pair_hybrid.cpp
- pair_hybrid.h
- pair_hybrid_overlay.cpp
- pair_hybrid_overlay.h
- pair_lj96_cut.cpp
- pair_lj96_cut.h
- pair_lj_cubic.cpp
- pair_lj_cubic.h
- pair_lj_cut.cpp
- pair_lj_cut.h
- pair_lj_cut_coul_cut.cpp
- pair_lj_cut_coul_cut.h
- pair_lj_cut_coul_debye.cpp
- pair_lj_cut_coul_debye.h
- pair_lj_cut_coul_dsf.cpp
- pair_lj_cut_coul_dsf.h
- pair_lj_expand.cpp
- pair_lj_expand.h
- pair_lj_gromacs.cpp
- pair_lj_gromacs.h
- pair_lj_gromacs_coul_gromacs.cpp
- pair_lj_gromacs_coul_gromacs.h
- pair_lj_smooth.cpp
- pair_lj_smooth.h
- pair_lj_smooth_linear.cpp
- pair_lj_smooth_linear.h
- pair_mie_cut.cpp
- pair_mie_cut.h
- pair_morse.cpp
- pair_morse.h
- pair_soft.cpp
- pair_soft.h
- pair_table.cpp
- pair_table.h
- pair_yukawa.cpp
- pair_yukawa.h
- pair_zbl.cpp
- pair_zbl.h
- pair_zero.cpp
- pair_zero.h
- pointers.h
- procmap.cpp
- procmap.h
- Purge.list
- python_wrapper.h
- random_mars.cpp
- random_mars.h
- random_park.cpp
- random_park.h
- rcb.cpp
- rcb.h
- read_data.cpp
- read_data.h
- read_dump.cpp
- read_dump.h
- read_restart.cpp
- read_restart.h
- reader.cpp
- reader.h
- reader_native.cpp
- reader_native.h
- reader_xyz.cpp
- reader_xyz.h
- region.cpp
- region.h
- region_block.cpp
- region_block.h
- region_cone.cpp
- region_cone.h
- region_cylinder.cpp
- region_cylinder.h
- region_intersect.cpp
- region_intersect.h
- region_plane.cpp
- region_plane.h
- region_prism.cpp
- region_prism.h
- region_sphere.cpp
- region_sphere.h
- region_union.cpp
- region_union.h
- replicate.cpp
- replicate.h
- rerun.cpp
- rerun.h
- respa.cpp
- respa.h
- run.cpp
- run.h
- set.cpp
- set.h
- special.cpp
- special.h
- suffix.h
- thermo.cpp
- thermo.h
- timer.cpp
- timer.h
- universe.cpp
- universe.h
- update.cpp
- update.h
- variable.cpp
- variable.h
- velocity.cpp
- velocity.h
- verlet.cpp
- verlet.h
- version.h
- write_coeff.cpp
- write_coeff.h
- write_data.cpp
- write_data.h
- write_dump.cpp
- write_dump.h
- write_restart.cpp
- write_restart.h
fix_nh_sphere.cpp @debian/0_20161109.git9806da6-6 — raw · history · blame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- Contributing author: Mike Brown (SNL) ------------------------------------------------------------------------- */ #include <math.h> #include "fix_nh_sphere.h" #include "atom.h" #include "atom_vec.h" #include "group.h" #include "error.h" #include "force.h" #include "math_vector.h" #include "math_extra.h" using namespace LAMMPS_NS; using namespace FixConst; using namespace MathExtra; #define INERTIA 0.4 // moment of inertia prefactor for sphere /* ---------------------------------------------------------------------- */ FixNHSphere::FixNHSphere(LAMMPS *lmp, int narg, char **arg) : FixNH(lmp, narg, arg) { if (!atom->sphere_flag) error->all(FLERR,"Fix nvt/nph/npt sphere requires atom style sphere"); } /* ---------------------------------------------------------------------- */ void FixNHSphere::init() { // check that all particles are finite-size // no point particles allowed double *radius = atom->radius; int *mask = atom->mask; int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) if (radius[i] == 0.0) error->one(FLERR,"Fix nvt/npt/nph/sphere require extended particles"); FixNH::init(); } /* ---------------------------------------------------------------------- perform half-step update of rotational velocities -----------------------------------------------------------------------*/ void FixNHSphere::nve_v() { // standard nve_v velocity update FixNH::nve_v(); double **omega = atom->omega; double **torque = atom->torque; double *radius = atom->radius; double *rmass = atom->rmass; int *mask = atom->mask; int nlocal = atom->nlocal; if (igroup == atom->firstgroup) nlocal = atom->nfirst; // set timestep here since dt may have changed or come via rRESPA double dtfrotate = dtf / INERTIA; double dtirotate; // update omega for all particles // d_omega/dt = torque / inertia // 4 cases depending on radius vs shape and rmass vs mass for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { dtirotate = dtfrotate / (radius[i]*radius[i]*rmass[i]); omega[i][0] += dtirotate*torque[i][0]; omega[i][1] += dtirotate*torque[i][1]; omega[i][2] += dtirotate*torque[i][2]; } } /* ---------------------------------------------------------------------- perform full-step update of position with dipole orientation, if requested -----------------------------------------------------------------------*/ void FixNHSphere::nve_x() { // standard nve_x position update FixNH::nve_x(); // update mu for dipoles if (dipole_flag) { double **mu = atom->mu; double **omega = atom->omega; int *mask = atom->mask; int nlocal = atom->nlocal; if (dlm_flag == 0){ // d_mu/dt = omega cross mu // renormalize mu to dipole length double msq,scale,g[3]; for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) if (mu[i][3] > 0.0) { g[0] = mu[i][0] + dtv * (omega[i][1]*mu[i][2]-omega[i][2]*mu[i][1]); g[1] = mu[i][1] + dtv * (omega[i][2]*mu[i][0]-omega[i][0]*mu[i][2]); g[2] = mu[i][2] + dtv * (omega[i][0]*mu[i][1]-omega[i][1]*mu[i][0]); msq = g[0]*g[0] + g[1]*g[1] + g[2]*g[2]; scale = mu[i][3]/sqrt(msq); mu[i][0] = g[0]*scale; mu[i][1] = g[1]*scale; mu[i][2] = g[2]*scale; } } else { // Integrate orientation following Dullweber-Leimkuhler-Maclachlan scheme vector w, w_temp, a; matrix Q, Q_temp, R; double scale,s2,inv_len_mu; for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit && mu[i][3] > 0.0) { // Construct Q from dipole: // Q is the rotation matrix from space frame to body frame // i.e. v_b = Q.v_s // Define mu to lie along the z axis in the body frame // We take the unit dipole to avoid getting a scaling matrix inv_len_mu = 1.0/mu[i][3]; a[0] = mu[i][0]*inv_len_mu; a[1] = mu[i][1]*inv_len_mu; a[2] = mu[i][2]*inv_len_mu; // v = a x [0 0 1] - cross product of mu in space and body frames // s = |v| // c = a.[0 0 1] = a[2] // vx = [ 0 -v[2] v[1] // v[2] 0 -v[0] // -v[1] v[0] 0 ] // then // Q = I + vx + vx^2 * (1-c)/s^2 s2 = a[0]*a[0] + a[1]*a[1]; if (s2 != 0.0){ // i.e. the vectors are not parallel scale = (1.0 - a[2])/s2; Q[0][0] = 1.0 - scale*a[0]*a[0]; Q[0][1] = -scale*a[0]*a[1]; Q[0][2] = -a[0]; Q[1][0] = -scale*a[0]*a[1]; Q[1][1] = 1.0 - scale*a[1]*a[1]; Q[1][2] = -a[1]; Q[2][0] = a[0]; Q[2][1] = a[1]; Q[2][2] = 1.0 - scale*(a[0]*a[0] + a[1]*a[1]); } else { // if parallel then we just have I or -I Q[0][0] = 1.0/a[2]; Q[0][1] = 0.0; Q[0][2] = 0.0; Q[1][0] = 0.0; Q[1][1] = 1.0/a[2]; Q[1][2] = 0.0; Q[2][0] = 0.0; Q[2][1] = 0.0; Q[2][2] = 1.0/a[2]; } // Local copy of this particle's angular velocity (in space frame) w[0] = omega[i][0]; w[1] = omega[i][1]; w[2] = omega[i][2]; // Transform omega into body frame: w_temp= Q.w matvec(Q,w,w_temp); // Construct rotation R1 BuildRxMatrix(R, dtf/force->ftm2v*w_temp[0]); // Apply R1 to w: w = R.w_temp matvec(R,w_temp,w); // Apply R1 to Q: Q_temp = R^T.Q transpose_times3(R,Q,Q_temp); // Construct rotation R2 BuildRyMatrix(R, dtf/force->ftm2v*w[1]); // Apply R2 to w: w_temp = R.w matvec(R,w,w_temp); // Apply R2 to Q: Q = R^T.Q_temp transpose_times3(R,Q_temp,Q); // Construct rotation R3 BuildRzMatrix(R, 2.0*dtf/force->ftm2v*w_temp[2]); // Apply R3 to w: w = R.w_temp matvec(R,w_temp,w); // Apply R3 to Q: Q_temp = R^T.Q transpose_times3(R,Q,Q_temp); // Construct rotation R4 BuildRyMatrix(R, dtf/force->ftm2v*w[1]); // Apply R4 to w: w_temp = R.w matvec(R,w,w_temp); // Apply R4 to Q: Q = R^T.Q_temp transpose_times3(R,Q_temp,Q); // Construct rotation R5 BuildRxMatrix(R, dtf/force->ftm2v*w_temp[0]); // Apply R5 to w: w = R.w_temp matvec(R,w_temp,w); // Apply R5 to Q: Q_temp = R^T.Q transpose_times3(R,Q,Q_temp); // Transform w back into space frame w_temp = Q^T.w transpose_matvec(Q_temp,w,w_temp); omega[i][0] = w_temp[0]; omega[i][1] = w_temp[1]; omega[i][2] = w_temp[2]; // Set dipole according to updated Q: mu = Q^T.[0 0 1] * |mu| mu[i][0] = Q_temp[2][0] * mu[i][3]; mu[i][1] = Q_temp[2][1] * mu[i][3]; mu[i][2] = Q_temp[2][2] * mu[i][3]; } } } } } /* ---------------------------------------------------------------------- perform half-step scaling of rotatonal velocities -----------------------------------------------------------------------*/ void FixNHSphere::nh_v_temp() { // standard nh_v_temp scaling FixNH::nh_v_temp(); double **omega = atom->omega; int *mask = atom->mask; int nlocal = atom->nlocal; if (igroup == atom->firstgroup) nlocal = atom->nfirst; for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { omega[i][0] *= factor_eta; omega[i][1] *= factor_eta; omega[i][2] *= factor_eta; } } } |