def compute_volume(self, pressure=0., temperature=0.): """ Computes the unit cell volume of the material. It can compute volumes at different pressures and temperatures. Keywords: pressure: The pressure in GPa. If not present then the pressure is assumed to be 0. temperature: The temperature in K. If not present or zero, then the temperature is assumed to be 298K, i.e. room temperature. Procedure: This procedure computes the unit cell volume. It starts with the volume read from the JCPDS file or computed from the zero-pressure, room temperature lattice constants. It does the following: 1) Corrects K0 for temperature if DK0DT is non-zero. 2) Computes volume at zero-pressure and the specified temperature if ALPHAT0 is non-zero. 3) Computes the volume at the specified pressure if K0 is non-zero. The routine uses the IDL function FX_ROOT to solve the third order Birch-Murnaghan equation of state. Example: Compute the unit cell volume of alumina at 100 GPa and 2500 K. j = jcpds() j.read_file('alumina.jcpds') j.compute_volume(100, 2500) """ # Assume 0 K really means room T if (temperature == 0): temperature = 298. # Compute values of K0, K0P and alphat at this temperature self.alphat = self.alphat0 + self.dalphadt * (temperature - 298.) self.k0p = self.k0p0 + self.dk0pdt * (temperature - 298.) if (pressure == 0.): self.v = self.v0 * (1 + self.alphat * (temperature - 298.)) else: if (self.k0 <= 0.): print 'K0 is zero, computing zero pressure volume' self.v = self.v0 else: self.mod_pressure = pressure - \ self.alphat*self.k0*(temperature-298.) v0_v = CARSMath.newton(self.bm3_inverse, 1.) self.v = self.v0 / v0_v
def compute_volume(self, pressure=0., temperature=0.): """ Computes the unit cell volume of the material. It can compute volumes at different pressures and temperatures. Keywords: pressure: The pressure in GPa. If not present then the pressure is assumed to be 0. temperature: The temperature in K. If not present or zero, then the temperature is assumed to be 298K, i.e. room temperature. Procedure: This procedure computes the unit cell volume. It starts with the volume read from the JCPDS file or computed from the zero-pressure, room temperature lattice constants. It does the following: 1) Corrects K0 for temperature if DK0DT is non-zero. 2) Computes volume at zero-pressure and the specified temperature if ALPHAT0 is non-zero. 3) Computes the volume at the specified pressure if K0 is non-zero. The routine uses the IDL function FX_ROOT to solve the third order Birch-Murnaghan equation of state. Example: Compute the unit cell volume of alumina at 100 GPa and 2500 K. j = jcpds() j.read_file('alumina.jcpds') j.compute_volume(100, 2500) """ # Assume 0 K really means room T if (temperature == 0): temperature=298. # Compute values of K0, K0P and alphat at this temperature self.alphat = self.alphat0 + self.dalphadt*(temperature-298.) self.k0p = self.k0p0 + self.dk0pdt*(temperature-298.) if (pressure == 0.): self.v = self.v0 * (1 + self.alphat*(temperature-298.)) else: if (self.k0 <= 0.): print 'K0 is zero, computing zero pressure volume' self.v = self.v0 else: self.mod_pressure = pressure - \ self.alphat*self.k0*(temperature-298.) v0_v = CARSMath.newton(self.bm3_inverse, 1.) self.v = self.v0/v0_v