OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Installing mechanica on windows

  • Thread starter Thread starter eraldcoil
  • Start date Start date
E

eraldcoil

Guest
I'm window user. I want to executes this code

(code: Mechanica Documentation Release 0.0.14)

Code:
import mechanica as m
import numpy as np
# potential cutoff distance
cutoff = 1
# dimensions of universe
dim=[10., 10., 10.]
# new simulator, don't load any example
m.Simulator(example="", dim=dim)
# create a potential representing a 12-6 Lennard-Jones potential
(continues on next page)
10 Chapter 3. Quickstart
Mechanica Documentation, Release 0.0.14
(continued from previous page)
# A The first parameter of the Lennard-Jones potential.
# B The second parameter of the Lennard-Jones potential.
# cutoff
pot = m.Potential.lennard_jones_12_6(0.275 , cutoff, 9.5075e-06 , 6.1545e-03 , 1.0e-3
˓→)
# create a particle type
# all new Particle derived types are automatically
# registered with the universe
class Argon(m.Particle):
mass = 39.4
# bind the potential with the *TYPES* of the particles
m.Universe.bind(pot, Argon, Argon)
# uniform random cube
positions = np.random.uniform(low=0, high=10, size=(10000, 3))
for pos in positions:
# calling the particle constructor implicitly adds
# the particle to the universe
Argon(pos)
# run the simulator interactive
m.Simulator.run()

but i don't know how can install mechanica. In cmd line command, I write this:

Code:
C:\Users\Usuario>pip install mechanica

and appears

Code:
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement mechanica (from versions: none)
ERROR: No matching distribution found for mechanica`

How can I install mechanica?

Additional information: I have python and pip installed.

Code:
C:\Users\Usuario>python3 --version
Python 3.12.4
C:\Users\Usuario>python3 -m pip --version
pip 24.0 from C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\site-packages\pip (python 3.12)

C:\Users\Usuario>python3 -m pip install --upgrade pip setuptools wheel
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in c:\program files\windowsapps\pythonsoftwarefoundation.python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\lib\site-packages (24.0)
Collecting pip
  Downloading pip-24.1-py3-none-any.whl.metadata (3.6 kB)
Requirement already satisfied: setuptools in c:\users\usuario\appdata\local\packages\pythonsoftwarefoundation.python.3.12_qbz5n2kfra8p0\localcache\local-packages\python312\site-packages (70.1.0)
Requirement already satisfied: wheel in c:\users\usuario\appdata\local\packages\pythonsoftwarefoundation.python.3.12_qbz5n2kfra8p0\localcache\local-packages\python312\site-packages (0.43.0)
Downloading pip-24.1-py3-none-any.whl (1.8 MB)
   ---------------------------------------- 1.8/1.8 MB 3.6 MB/s eta 0:00:00
Installing collected packages: pip
  WARNING: The scripts pip.exe, pip3.12.exe and pip3.exe are installed in 'C:\Users\Usuario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-24.1

I want execute this code and view the simulation
<p>I'm window user. I want to executes this code</p>
<p>(code: Mechanica Documentation Release 0.0.14)</p>
<pre><code>import mechanica as m
import numpy as np
# potential cutoff distance
cutoff = 1
# dimensions of universe
dim=[10., 10., 10.]
# new simulator, don't load any example
m.Simulator(example="", dim=dim)
# create a potential representing a 12-6 Lennard-Jones potential
(continues on next page)
10 Chapter 3. Quickstart
Mechanica Documentation, Release 0.0.14
(continued from previous page)
# A The first parameter of the Lennard-Jones potential.
# B The second parameter of the Lennard-Jones potential.
# cutoff
pot = m.Potential.lennard_jones_12_6(0.275 , cutoff, 9.5075e-06 , 6.1545e-03 , 1.0e-3
˓→)
# create a particle type
# all new Particle derived types are automatically
# registered with the universe
class Argon(m.Particle):
mass = 39.4
# bind the potential with the *TYPES* of the particles
m.Universe.bind(pot, Argon, Argon)
# uniform random cube
positions = np.random.uniform(low=0, high=10, size=(10000, 3))
for pos in positions:
# calling the particle constructor implicitly adds
# the particle to the universe
Argon(pos)
# run the simulator interactive
m.Simulator.run()

</code></pre>
<p>but i don't know how can install mechanica. In cmd line command, I write this:</p>
<pre><code>C:\Users\Usuario>pip install mechanica
</code></pre>
<p>and appears</p>
<pre><code>Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement mechanica (from versions: none)
ERROR: No matching distribution found for mechanica`
</code></pre>
<p>How can I install mechanica?</p>
<p>Additional information: I have python and pip installed.</p>
<pre><code>C:\Users\Usuario>python3 --version
Python 3.12.4
C:\Users\Usuario>python3 -m pip --version
pip 24.0 from C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\site-packages\pip (python 3.12)

C:\Users\Usuario>python3 -m pip install --upgrade pip setuptools wheel
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in c:\program files\windowsapps\pythonsoftwarefoundation.python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\lib\site-packages (24.0)
Collecting pip
Downloading pip-24.1-py3-none-any.whl.metadata (3.6 kB)
Requirement already satisfied: setuptools in c:\users\usuario\appdata\local\packages\pythonsoftwarefoundation.python.3.12_qbz5n2kfra8p0\localcache\local-packages\python312\site-packages (70.1.0)
Requirement already satisfied: wheel in c:\users\usuario\appdata\local\packages\pythonsoftwarefoundation.python.3.12_qbz5n2kfra8p0\localcache\local-packages\python312\site-packages (0.43.0)
Downloading pip-24.1-py3-none-any.whl (1.8 MB)
---------------------------------------- 1.8/1.8 MB 3.6 MB/s eta 0:00:00
Installing collected packages: pip
WARNING: The scripts pip.exe, pip3.12.exe and pip3.exe are installed in 'C:\Users\Usuario\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-24.1
</code></pre>
<p>I want execute this code and view the simulation</p>
 

Latest posts

Top