POV-Ray : Newsgroups : povray.general : PovDynamics : PovDynamics Server Time
29 Jul 2024 18:16:11 EDT (-0400)
  PovDynamics  
From: kike
Date: 17 Nov 2010 07:20:01
Message: <web.4ce3c83dfb7127c1519bbb570@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!!


Post a reply to this message

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