POV-Ray : Newsgroups : povray.general : PovDynamics : Re: PovDynamics Server Time
29 Jul 2024 18:25:14 EDT (-0400)
  Re: PovDynamics  
From: Alain
Date: 17 Nov 2010 17:08:28
Message: <4ce4525c$1@news.povray.org>

> Hi all:
>
> Long time since my last post!
> I'm working in a very nerd thing. I want to do a molecular dynamic simulation
> with Pov... not in fortran (C or whatever) and then export data to Pov. I mean
> with Pov.
>
> My problem was to save information from one frame to other. And I have solve it
> by writing an external file. Its something like this:
>
> //You define the time
> #declare ti=frame_number;
> #declare dt=1/25;
>
> //then open a file with the initial conditions
> #fopen MyFile "dypov.dat" read
> #read (MyFile,x0,v0)
> #fclose MyFile
>
> //this is the Euler method for a spring in 1D
> #declare k0=1;
> #declare F0=-k0*x0;
> #declare v0=v0+dt*F0;
> #declare x0=x0+dt*v0;
>
> sphere{<x0,0,0>,.2}
> //then you write the result in the same file so in the next frame these will be
> //the data for the next step in the simulation
> #fopen MyFile "dypov.dat" write
> #write (MyFile,x0,",",v0,",")
> #fclose MyFile
>
> Dont know if this is old but seems funny to me and I'm working in something more
> complicated.
>
> Cheers!!
>
>
Not odd at all.
There are some other animation scenes that do use that exact same 
read/write technique to do the exact same thing.


Alain


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.