Ejemplo n.º 1
0
 def init(self, iterative):
     self.timestep_press = iterative.timestep
     if not self.restart:
         clean_momenta(iterative.pos, iterative.vel, iterative.masses, iterative.ff.system.cell)
     # determine the internal degrees of freedom
     if iterative.ndof is None:
         iterative.ndof = get_ndof_internal_md(len(iterative.ff.system.numbers), iterative.ff.system.cell.nvec)
     # determine barostat 'mass' following W = timecon*np.sqrt(n_part) * m_av
     #n_part = len(iterative.masses)
     #self.mass_press = self.timecon_press*np.sum(iterative.masses)/np.sqrt(len(iterative.ff.system.numbers))
     angfreq = 2*np.pi/self.timecon_press
     self.mass_press = (iterative.ndof+self.dim**2)*boltzmann*self.temp/angfreq**2/self.vol0**(2./3)
     if self.vel_press is None:
         # define initial barostat velocity
         self.vel_press = get_random_vel_press(self.mass_press, self.temp)
         if not self.anisotropic:
             self.vel_press = self.vel_press[0][0]
     # initialize the barostat thermostat if present
     if self.baro_thermo is not None:
         self.baro_thermo.chain.timestep = iterative.timestep
         self.baro_thermo.chain.set_ndof(self.baro_ndof)
     # make sure the volume of the cell will not change if applicable
     if self.vol_constraint:
         self.vel_press -= np.trace(self.vel_press)/3*np.eye(3)
     # compute gpos and vtens, since they differ
     # after symmetrising the cell tensor
     iterative.gpos[:] = 0.0
     iterative.vtens[:] = 0.0
     iterative.epot = iterative.ff.compute(iterative.gpos,iterative.vtens)
Ejemplo n.º 2
0
Archivo: npt.py Proyecto: yfyh2013/yaff
 def init(self, iterative):
     self.timestep_press = iterative.timestep
     if not self.restart:
         clean_momenta(iterative.pos, iterative.vel, iterative.masses, iterative.ff.system.cell)
     # determine the internal degrees of freedom
     if iterative.ndof is None:
         iterative.ndof = get_ndof_internal_md(len(iterative.ff.system.numbers), iterative.ff.system.cell.nvec)
     # determine barostat 'mass' following W = timecon*np.sqrt(n_part) * m_av
     #n_part = len(iterative.masses)
     #self.mass_press = self.timecon_press*np.sum(iterative.masses)/np.sqrt(len(iterative.ff.system.numbers))
     angfreq = 2*np.pi/self.timecon_press
     self.mass_press = (iterative.ndof+self.dim**2)*boltzmann*self.temp/angfreq**2/self.vol0**(2./3)
     if self.vel_press is None:
         # define initial barostat velocity
         self.vel_press = get_random_vel_press(self.mass_press, self.temp)
         if not self.anisotropic:
             self.vel_press = self.vel_press[0][0]
     # initialize the barostat thermostat if present
     if self.baro_thermo is not None:
         self.baro_thermo.chain.timestep = iterative.timestep
         self.baro_thermo.chain.set_ndof(self.baro_ndof)
     # make sure the volume of the cell will not change if applicable
     if self.vol_constraint:
         self.vel_press -= np.trace(self.vel_press)/3*np.eye(3)
     # compute gpos and vtens, since they differ
     # after symmetrising the cell tensor
     iterative.gpos[:] = 0.0
     iterative.vtens[:] = 0.0
     iterative.epot = iterative.ff.compute(iterative.gpos,iterative.vtens)
Ejemplo n.º 3
0
Archivo: nvt.py Proyecto: boegel/yaff
 def init(self, iterative):
     # It is mandatory to zero the external momenta.
     clean_momenta(iterative.pos, iterative.vel, iterative.masses,
                   iterative.ff.system.cell)
     if iterative.ndof is None:
         iterative.ndof = get_ndof_internal_md(
             iterative.pos.shape[0], iterative.ff.system.cell.nvec)
     self.kin = 0.5 * iterative.ndof * boltzmann * self.temp
Ejemplo n.º 4
0
Archivo: nvt.py Proyecto: boegel/yaff
 def init(self, iterative):
     if not self.restart:
         # It is mandatory to zero the external momenta.
         clean_momenta(iterative.pos, iterative.vel, iterative.masses,
                       iterative.ff.system.cell)
     if iterative.ndof is None:
         iterative.ndof = get_ndof_internal_md(
             iterative.pos.shape[0], iterative.ff.system.cell.nvec)
Ejemplo n.º 5
0
Archivo: nvt.py Proyecto: tovrstra/yaff
 def init(self, iterative):
     # It is mandatory to zero the external momenta.
     clean_momenta(iterative.pos, iterative.vel, iterative.masses, iterative.ff.system.cell)
     # If needed, determine the number of _internal_ degrees of freedom.
     if iterative.ndof is None:
         iterative.ndof = get_ndof_internal_md(iterative.pos.shape[0], iterative.ff.system.cell.nvec)
     # Configure the chain.
     self.chain.timestep = iterative.timestep
     self.chain.set_ndof(iterative.ndof)
Ejemplo n.º 6
0
Archivo: nvt.py Proyecto: boegel/yaff
 def init(self, iterative):
     if not self.restart:
         # It is mandatory to zero the external momenta
         clean_momenta(iterative.pos, iterative.vel, iterative.masses,
                       iterative.ff.system.cell)
     # If needed, determine the number of _internal_ degrees of freedom
     if iterative.ndof is None:
         iterative.ndof = get_ndof_internal_md(
             iterative.pos.shape[0], iterative.ff.system.cell.nvec)
     # Configure the chain
     self.chain.timestep = iterative.timestep
     self.chain.set_ndof(iterative.ndof)
Ejemplo n.º 7
0
 def init(self, iterative):
     self.timestep_press = iterative.timestep
     if not self.restart:
         clean_momenta(iterative.pos, iterative.vel, iterative.masses, iterative.ff.system.cell)
     # compute gpos and vtens, since they differ
     # after symmetrising the cell tensor
     iterative.gpos[:] = 0.0
     iterative.vtens[:] = 0.0
     iterative.epot = iterative.ff.compute(iterative.gpos,iterative.vtens)
     if iterative.ndof is None:
         iterative.ndof = get_ndof_internal_md(iterative.pos.shape[0], iterative.ff.system.cell.nvec)
     # rescaling of the barostat mass, to be in accordance with Langevin and MTTK
     self.mass_press *= np.sqrt(iterative.ndof)
Ejemplo n.º 8
0
Archivo: npt.py Proyecto: yfyh2013/yaff
 def init(self, iterative):
     self.timestep_press = iterative.timestep
     if not self.restart:
         clean_momenta(iterative.pos, iterative.vel, iterative.masses, iterative.ff.system.cell)
     # compute gpos and vtens, since they differ
     # after symmetrising the cell tensor
     iterative.gpos[:] = 0.0
     iterative.vtens[:] = 0.0
     iterative.epot = iterative.ff.compute(iterative.gpos,iterative.vtens)
     if iterative.ndof is None:
         iterative.ndof = get_ndof_internal_md(iterative.pos.shape[0], iterative.ff.system.cell.nvec)
     # rescaling of the barostat mass, to be in accordance with Langevin and MTTK
     self.mass_press *= np.sqrt(iterative.ndof)
Ejemplo n.º 9
0
 def init(self, iterative):
     # It is mandatory to zero the external momenta.
     clean_momenta(iterative.pos, iterative.vel, iterative.masses, iterative.ff.system.cell)
     if iterative.ndof is None:
         iterative.ndof = get_ndof_internal_md(iterative.pos.shape[0], iterative.ff.system.cell.nvec)
     self.kin = 0.5*iterative.ndof*boltzmann*self.temp
Ejemplo n.º 10
0
 def init(self, iterative):
     if not self.restart:
         # It is mandatory to zero the external momenta.
         clean_momenta(iterative.pos, iterative.vel, iterative.masses, iterative.ff.system.cell)
     if iterative.ndof is None:
         iterative.ndof = get_ndof_internal_md(iterative.pos.shape[0], iterative.ff.system.cell.nvec)