/************************************************************************************************************* The MIT License Copyright (C) 2006-2019 David Dubbeldam, Sofia Calero, Thijs Vlugt, Donald E. Ellis, and Randall Q. Snurr. D.Dubbeldam@uva.nl http://www.uva.nl/profiel/d/u/d.dubbeldam/d.dubbeldam.html scaldia@upo.es http://www.upo.es/raspa/ t.j.h.vlugt@tudelft.nl http://homepage.tudelft.nl/v9k6y don-ellis@northwestern.edu http://dvworld.northwestern.edu/ snurr@northwestern.edu http://zeolites.cqe.northwestern.edu/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include "constants.h" #include "utils.h" #include "simulation.h" #include "molecule.h" #include "framework.h" #include "framework_energy.h" #include "framework_force.h" #include "framework_born.h" #include "integration.h" #include "ewald.h" #include "internal_energy.h" #include "internal_force.h" #include "internal_born.h" #include "inter_energy.h" #include "inter_force.h" #include "inter_born.h" #include "thermo_baro_stats.h" #include "rigid.h" #include "mc_moves.h" #include "potentials.h" #include "sample.h" void ComputeKineticEnergySystem(void) { int i,j,l,f1; int Type,A; REAL Mass; VECTOR I,Velocity; QUATERNION p,q; INT_VECTOR3 Fixed; UHostKinetic[CurrentSystem]=0.0; if(Framework[CurrentSystem].FrameworkModel==FLEXIBLE) { for(f1=0;f10) NoseHooverNVTRotation(); // evolve the positions a half timestep UpdateVelocities(); UpdatePositionsVelocitiesNPTPR(); // evolve the part of rigid bodies involving free rotation NoSquishFreeRotorOrderTwo(); // compute the forces on all the atoms CalculateForce(); // evolve the positions a half timestep UpdateVelocities(); if(DegreesOfFreedomRotation[CurrentSystem]>0) NoseHooverNVTRotation(); NoseHooverNPTPR(); break; case NPHPR: NoseHooverNPHPR(); // evolve the positions a half timestep UpdateVelocities(); UpdatePositionsVelocitiesNPTPR(); // evolve the part of rigid bodies involving free rotation NoSquishFreeRotorOrderTwo(); // store the structure-factors for the Ewald-summations if((ChargeMethod==EWALD)&&(!OmitEwaldFourier)) { SetupKVectors(); EwaldEnergyIon(); } // compute the forces on all the atoms CalculateForce(); // evolve the positions a half timestep UpdateVelocities(); NoseHooverNPHPR(); break; case NPH: // update the velocity of the cell UpdateCellVelocity(); // evolve the positions a half timestep UpdateVelocities(); // evolve the positions a full timestep UpdatePositions(); // evolve the part of rigid bodies involving free rotation NoSquishFreeRotorOrderTwo(); // store the structure-factors for the Ewald-summations if((ChargeMethod==EWALD)&&(!OmitEwaldFourier)) { SetupKVectors(); EwaldEnergyIon(); } // compute the forces on all the atoms CalculateForce(); // evolve the positions a half timestep UpdateVelocities(); // update the velocity of the cell UpdateCellVelocity(); break; case NPT: case MuPT: // apply thermo/barostats for temperature, volume, and/or box-shape control // integrate the fictive velocities another half a timestep NoseHooverNPT(); if(Framework[CurrentSystem].FrameworkModel==FLEXIBLE) NoseHooverNVTFramework(); if(DegreesOfFreedomTranslationalAdsorbates[CurrentSystem]>0) NoseHooverNVTAdsorbates(); if(DegreesOfFreedomTranslationalCations[CurrentSystem]>0) NoseHooverNVTCations(); if(DegreesOfFreedomRotation[CurrentSystem]>0) NoseHooverNVTRotation(); // update the velocity of the cell UpdateCellVelocity(); // evolve the positions a half timestep UpdateVelocities(); // evolve the positions a full timestep UpdatePositions(); // evolve the part of rigid bodies involving free rotation NoSquishFreeRotorOrderTwo(); // compute the forces on all the atoms CalculateForce(); // evolve the positions a half timestep UpdateVelocities(); // update the velocity of the cell UpdateCellVelocity(); // apply thermo/barostats for temperature, volume, and/or box-shape control // integrate the fictive velocities another half a timestep if(Framework[CurrentSystem].FrameworkModel==FLEXIBLE) NoseHooverNVTFramework(); if(DegreesOfFreedomTranslationalAdsorbates[CurrentSystem]>0) NoseHooverNVTAdsorbates(); if(DegreesOfFreedomTranslationalCations[CurrentSystem]>0) NoseHooverNVTCations(); if(DegreesOfFreedomRotation[CurrentSystem]>0) NoseHooverNVTRotation(); NoseHooverNPT(); break; case NVT: case MuVT: if(Framework[CurrentSystem].FrameworkModel==FLEXIBLE) NoseHooverNVTFramework(); if(DegreesOfFreedomTranslationalAdsorbates[CurrentSystem]>0) NoseHooverNVTAdsorbates(); if(DegreesOfFreedomTranslationalCations[CurrentSystem]>0) NoseHooverNVTCations(); if(DegreesOfFreedomRotation[CurrentSystem]>0) NoseHooverNVTRotation(); // evolve the positions a half timestep UpdateVelocities(); // evolve the positions a full timestep UpdatePositions(); // first part of bond-constraints RattleStageOne(); // evolve the part of rigid bodies involving free rotation NoSquishFreeRotorOrderTwo(); // compute the forces on all the atoms CalculateForce(); // evolve the positions a half timestep UpdateVelocities(); // second part of bond-constraints RattleStageTwo(); // apply thermo/barostats for temperature, volume, and/or box-shape control // integrate the fictive velocities another half a timestep if(Framework[CurrentSystem].FrameworkModel==FLEXIBLE) NoseHooverNVTFramework(); if(DegreesOfFreedomTranslationalAdsorbates[CurrentSystem]>0) NoseHooverNVTAdsorbates(); if(DegreesOfFreedomTranslationalCations[CurrentSystem]>0) NoseHooverNVTCations(); if(DegreesOfFreedomRotation[CurrentSystem]>0) NoseHooverNVTRotation(); break; case NVE: default: // evolve the positions a half timestep UpdateVelocities(); // evolve the positions a full timestep UpdatePositions(); // first part of bond-constraints RattleStageOne(); // evolve the part of rigid bodies involving free rotation NoSquishFreeRotorOrderTwo(); // compute the forces on all the atoms CalculateForce(); // evolve the positions a half timestep UpdateVelocities(); // second part of bond-constraints RattleStageTwo(); break; } // for rigid units: create atomic velocities from com-velocity and quaternion-velocity CreateCartesianVelocities(); ComputeNoseHooverEnergySystem(); ComputeKineticEnergySystem(); ConservedEnergy[CurrentSystem]=UTotal[CurrentSystem]+UKinetic[CurrentSystem]+UNoseHoover[CurrentSystem]; } int CalculateElectricField(void) { int i,j,k,f1; REAL_MATRIX3x3 pol_factor; VECTOR electric_field,electric_field1,electric_field2; VECTOR induced_dipole; int Type; // set "static" polarization to zero UHostPolarization[CurrentSystem]=0.0; UAdsorbatePolarization[CurrentSystem]=0.0; UCationPolarization[CurrentSystem]=0.0; // set "back" polarization to zero UHostBackPolarization[CurrentSystem]=0.0; UAdsorbateBackPolarization[CurrentSystem]=0.0; UCationBackPolarization[CurrentSystem]=0.0; // set framework electric fields to zero if((BackPolarization)||(Framework[CurrentSystem].FrameworkModel==FLEXIBLE)) { for(f1=0;f11e-5); // store new quaternions Adsorbates[CurrentSystem][i].Groups[l].Quaternion=qn; } } } // translational motion for(i=0;i1e-5); // store new quaternions Adsorbates[CurrentSystem][i].Groups[l].Quaternion=qn; } } } // translational motion if(Framework[CurrentSystem].FrameworkModel==FLEXIBLE) { for(i=0;i %18.10f\n",pos.x,pos.y,pos.z,U*ENERGY_TO_KELVIN,NumericalElectrostaticPotential(pos)*ENERGY_TO_KELVIN); } }