New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Units and sanity checking for box potential with non-periodic b.c. #96
Conversation
Added a bond breaking preset for structural topology reactions, example: sys = readdy.ReactionDiffusionSystem(box_size=[150,150,150])
sys.topologies.add_type("Toptype")
sys.add_topology_species("T", diffusion_constant=1.)
sys.topologies.configure_harmonic_bond("T", "T", force_constant=20., length=2.)
# breaks bonds with a topology-global rate of .01 * n_edges
sys.topologies.add_topology_dissociation("Toptype", .01) |
Temperature is not a Energy. I think you mean that kT is 2.437 kJ/mol, and the temperature would probably be 300 K or so. If you are using units, I suggest that the temperature is the unit to be set, and kT is computed. Without units the convention would be that energies are measured in kT. |
I have introduced a temperature unit (default Kelvin) and removed the setter property for # default units
system = readdy.ReactionDiffusionSystem(box_size=[1., 1., 1.])
# temperature in kelvin, internally expressed in kT/mol
system.temperature = 293
print(system.temperature)
>>> 293
print(system.kbt)
>>> 2.4361374086224026 kJ/mol
# custom units
system = ReactionDiffusionSystem(box_size=[1., 1., 1.], unit_system={
'energy_unit': 'kcal/mol',
'temperature_unit': 'rankine',
'time_unit': 'hour'
})
print(system.temperature.to(system.units.kelvin))
>>> 293 kelvin |
OK, but the sentence "internally expressed in kT/mol" does not make sense. |
Yeah right, sorry, I meant kJ/mol. |
No, the temperature cannot be expressed in kJ/mol. kT could be expressed in kJ/mol. T is the temperature, kT is the thermal energy. |
BTW, I don't know what "rankine" is |
Ok thanks! I have updated the documentation and will merge when the tests are passing if that is alright. 0° Rankine are, same as 0° Kelvin, absolute zero, however Rankine operates on the Fahrenheit scale. |
Units
Introduced a runtime dependency to pint. Units can now be used in all relevant api functions:
Construct a system with a simulation box size of (10, 10, 10) and units of:
- length in nanometers
- time in nanoseconds
- energy in kJ/mol
The temperature is defaulted to 2.437 kJ/mol, all boundaries are set to be periodic.
The simulation box size is the only required constructor argument of a reaction diffusion system.
Construct a system with a simulation box size of (10, 10, 10) and units of:
- length in kilometers
- time in hours
- energy in kcal/mol
The room temperature as well as any other units of time/length/energy will be automatically converted to this particular set of system units.
Construct a unitless system with a simulation box size of (10, 10, 10):
If time, length, and energy units are set to None or empty strings, the system will be treated as completely unitless system.
If properties are set without providing a particular unit, e.g.,
the system's units are assumed without further conversion, i.e.,
energy/length**2
for the force constant, andlength
for the interaction distance. Providing a unit will trigger a conversion:or also trigger an error if the dimensionality does not match:
raises an
PBC and box potentials
Upon simulation start there will be a check on the particle types together with periodicity of the simulation box and box potentials, in particular:
If the simulation box is not completely periodic and if the particle types in that box have no box potential to keep them contained in the non-periodic directions, i.e.,
is
true
for any non-periodicdim
, an exception is thrown.